Copied to clipboard

Flag this post as spam?

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


  • Brian Olsen 143 posts 424 karma points
    Dec 03, 2012 @ 16:54
    Brian Olsen
    0

    get images path in xslt

    Umbraco 4.7.1.1

     

     

    <?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" xmlns:tagsLib="urn:tagsLib" xmlns:BlogLibrary="urn:BlogLibrary"
     exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets tagsLib BlogLibrary ">


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

    <xsl:param name="currentPage"/>
    <xsl:param name="mediaFolder" select="$currentPage/getImages" />

    <xsl:template match="/">

     

    <xsl:if test="$mediaFolder!=''"> <!-- Necessary test otherwise the GetMedia(...) call throws a compiler error !!  -->
     <xsl:for-each select="umbraco.library:GetMedia($mediaFolder, 'False')/descendant-or-self::*[@nodeTypeAlias='Image']">
        <xsl:if test="./umbracoFile">


                &#123;image : &#39;{umbracoFile}&#39;, title : &#39;&#39;, thumb : &#39;&#39;&#125;,
     
        </xsl:if>

    </xsl:for-each>
    </xsl:if>


    </xsl:template>

    </xsl:stylesheet>

     

    how to insert media path in this

     &#123;image : &#39;{umbracoFile}&#39;, title : &#39;&#39;, thumb : &#39;&#39;&#125;,

    {image : ' {umbracoFile} ', title : '', thumb : ''}

     

    If I use this

    <img src="{./umbracoFile}" alt="[image]" height="{umbracoHeight}" width="{umbracoWidth}" />

    then is showing the image but I just need it to write the image path

     

     

  • Jan Skovgaard 11258 posts 23500 karma points MVP 7x admin c-trib
    Dec 03, 2012 @ 18:13
    Jan Skovgaard
    0

    Hi Brian and welcome to our :)

    The above example looks a bit messy. But before going into further details I just need to understand this...all you want is the image path? You don't want to display the image?

    Then you could just write this in the above context instead of the <img> tag: <p><xsl:value-of select="./umbracoFile" /></p>.

    Hope this helps.

    /Jan

  • Brian Olsen 143 posts 424 karma points
    Dec 03, 2012 @ 18:43
    Brian Olsen
    0

    thank you Jan it was everything I wanted

  • Jan Skovgaard 11258 posts 23500 karma points MVP 7x admin c-trib
    Dec 03, 2012 @ 20:03
    Jan Skovgaard
    0

    Hi Brian

    Glad it helped.

    If you're going to use XSLT a lot then I recommend that you keep an eye on http://pimpmyxslt.com/, which is a XSLT blog done by mr. XSLT aka Chriztian Steinmeier.

    Please don't hesitate to ask further questions if you're in doubt about something.

    Cheers,

    Jan

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies