Copied to clipboard

Flag this post as spam?

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


  • vaibhav 119 posts 139 karma points
    Aug 09, 2011 @ 09:48
    vaibhav
    0

    using media picker with xslt

    Hi,

    I am using media picker to pick the image from media library.

    I will apply that image using xslt ...hoever i dont know how to use media picker in the xslt ....

    so can anyone help me in that ....

  • Fuji Kusaka 2203 posts 4220 karma points
    Aug 09, 2011 @ 09:55
    Fuji Kusaka
    0

    Hi,

    So far from what i understand you uploading all your images via the media section. Well its pretty simple using the media picker and getting your XSLT to render all images available in the media ID you picked.

    You could try something like that

     

     <xsl:choose>
            <xsl:when test="$currentPage/yourDocumentAlias!=''">
              <xsl:variable name="images" select="$currentPage/yourDocumentAlias"/>
                   <xsl:variable name="mediaItems" select="umbraco.library:GetMedia($images, true())/Image"/>
                
                    <xsl:for-each select="$mediaItems">
                       <xsl:variable name="picFile" select="umbracoFile"/>
                         
                          <xsl:element name="img">
                              <xsl:attribute name="src">
                                  <xsl:value-of select="./umbracoFile"/>
                              </xsl:attribute>                        
                          </xsl:element>                
                     
                    </xsl:for-each>
            </xsl:when>
            <xsl:otherwise>
                No Image found
            </xsl:otherwise>
            </xsl:choose>
Please Sign in or register to post replies

Write your reply to:

Draft