Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Cookie Monster 7 posts 27 karma points
    Oct 13, 2011 @ 18:49
    Cookie Monster
    0

    Get Media Item

    Hi all,

    im trying to get a media item from the media lib via xslt using the new schema, but for some reason it comes back as empty

     

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet 
      version="1.0" 
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
      xmlns:msxml="urn:schemas-microsoft-com:xslt"
      xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" 
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">


    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>

    <xsl:template match="/">
    <xsl:variable name="Home" select="$currentPage/ancestor-or-self::* [@level=1]/* [@isDoc and string(umbracoNaviHide) = '1']"/>

    <div id="slider" class="nivoSlider theme-default"
    <xsl:for-each select="$Home/Slide">
    <a>

    <xsl:attribute name="href">
    <xsl:value-of select="linkUrl"/>
    </xsl:attribute>



    <xsl:variable name="media" select="image"/>
    <xsl:value-of select="$media"/>
    <xsl:if test="$media/umbracoFile">
    <img src="{$media/umbracoFile}">
    <xsl:attribute name="title">#caption<xsl:value-of select="position()"/></xsl:attribute>
    </img>
    </xsl:if>

    </a>
    </xsl:for-each>
    </div>
     
    <div class="captions">  
    <xsl:for-each select="$Home/Slide">
    <div class="nivo-html-caption">
    <xsl:attribute name="id">caption<xsl:value-of select="position()"/></xsl:attribute>
    <h2><xsl:value-of select="heading"/></h2>
    <p><xsl:value-of select="content"/></p>
    </div>  
    </xsl:for-each>
        </div>  
      
        
        </xsl:template>
    </xsl:stylesheet>

     

    Any help will be greatly appreciated 

  • Fuji Kusaka 2203 posts 4220 karma points
    Oct 13, 2011 @ 19:13
    Fuji Kusaka
    0

    Hi, can you tell us how you are accessing the media section? Are you using a mediaPicker Type in the back end to access a specific folder in media lib?

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Oct 13, 2011 @ 19:24
    Jan Skovgaard
    0

    Hi Cookie Monster

    Do you get any XML returned in your home variable?

    try making writing this

    <textarea>
    <xsl:copy-of select="$Home" />
    </textarea>

    If the textarea contains any xml, copy it to an editor where you can better view the structure and then see if you're matching the elements correctly.

    Hope this helps.

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft