Copied to clipboard

Flag this post as spam?

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


  • Stephen Davidson 216 posts 392 karma points
    Apr 07, 2013 @ 21:32
    Stephen Davidson
    0

    Display image from Doc type

    I'm a little rusty but I want to return all nodes of a document type and display an image from each node...sure this should work but nothing coming up on the page.

     

    <?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="/">
    
    <!-- start writing XSLT -->
      <xsl:variable name="SponsorNode" select="$currentPage/parent::*/child::*[@level=1]"/>
    
                <xsl:for-each select="$SponsorNode/child::Sponsor">
    
                    <a href="{umbraco.library:NiceUrl(siteLink)}">
                    <img src='/ImageGen.ashx?image={current()/logo}&amp;width=200&amp;height=100&amp;Constrain=True' alt="{@nodeName}" class="sponsorLogo"  />
                    </a>
    
                </xsl:for-each>
    
    
    </xsl:template>
    
    </xsl:stylesheet>
    

     

    anyone spot anything obvious?

    S

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Apr 07, 2013 @ 22:00
    Dennis Aaen
    0

    Hi Stephan,

    I have taken a little look at your code, and the only thing I just immediately think you are missing is to add umbracoFiIe, where you print the image.

    So I would try would be something like this:

    <imgsrc='/ImageGen.ashx?image={current()/logo/umbracoFile}&amp;width=200&amp;height=100&amp;Constrain=True'alt="{@nodeName}"class="sponsorLogo"  />

    Instead of this:

    <imgsrc='/ImageGen.ashx?image={current()/logo}&amp;width=200&amp;height=100&amp;Constrain=True'alt="{@nodeName}"class="sponsorLogo"  />

    I hope this can help you to a solution.

    /Dennis

  • Stephen Davidson 216 posts 392 karma points
    Apr 07, 2013 @ 23:58
    Stephen Davidson
    0

    Thanks for the feedback Dennis...tried that and no luck. Also tried just displaying the node name and nothing so must be something to do with my foreach or variable...

     

     

Please Sign in or register to post replies

Write your reply to:

Draft