Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hello,
I have the following XSLT code that is not looping correctly;
<xsl:for-each select="$sponsorsProfile"> <xsl:sort select="@nodeName" order="ascending"/> <xsl:variable name="media" select="umbraco.library:GetMedia(logo,0)"/> <a href="{$sponsorsProfile/uRL}"><img src="{$media/umbracoFile}" alt="{$sponsorsProfile/sponsor}" height="100"/></a> </xsl:for-each>
Currently the image of the logo is being shown correctly, however the URL and the ALT text is only appearing correct for the first node in the list.
I have the text under the for-each line however I cant seem to get this working.
Any help would be great.
Thanks
Hi Steven,
You just need to remove the $sponsorsProfile/ "prefixes" from all the places inside the loop:
<xsl:for-each select="$sponsorsProfile"> <xsl:sort select="@nodeName" order="ascending"/> <xsl:variable name="media" select="umbraco.library:GetMedia(logo, 0)"/> <a href="{uRL}"><img src="{$media/umbracoFile}" alt="{sponsor}" height="100"/></a> </xsl:for-each>
/Chriztian
Hi, you are using the $sponsorsProfile to loop trough and getting the uRL and sponsor from it, this means that you loop through the $sponsorsProfile and each time calling it again for the uRL and sponsor, you can just use
<xsl:for-each select="$sponsorsProfile"> <xsl:sort select="@nodeName" order="ascending"/> <xsl:variable name="media" select="umbraco.library:GetMedia(logo,0)"/> <a href="{uRL}"><img src="{$media/umbracoFile}" alt="{sponsor}" height="100"/></a> </xsl:for-each>
then you will use the one you are currently in like you do with your media
Hope this helps, Jan-Willem
Thanks guys, such a simple thing when you look back at it.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Not Looping Correctly
Hello,
I have the following XSLT code that is not looping correctly;
<xsl:for-each select="$sponsorsProfile">
<xsl:sort select="@nodeName" order="ascending"/>
<xsl:variable name="media" select="umbraco.library:GetMedia(logo,0)"/>
<a href="{$sponsorsProfile/uRL}"><img src="{$media/umbracoFile}" alt="{$sponsorsProfile/sponsor}" height="100"/></a>
</xsl:for-each>
Currently the image of the logo is being shown correctly, however the URL and the ALT text is only appearing correct for the first node in the list.
I have the text under the for-each line however I cant seem to get this working.
Any help would be great.
Thanks
Hi Steven,
You just need to remove the $sponsorsProfile/ "prefixes" from all the places inside the loop:
/Chriztian
Hi, you are using the $sponsorsProfile to loop trough and getting the uRL and sponsor from it, this means that you loop through the $sponsorsProfile and each time calling it again for the uRL and sponsor, you can just use
<xsl:for-each select="$sponsorsProfile">
<xsl:sort select="@nodeName" order="ascending"/>
<xsl:variable name="media" select="umbraco.library:GetMedia(logo,0)"/>
<a href="{uRL}"><img src="{$media/umbracoFile}" alt="{sponsor}" height="100"/></a>
</xsl:for-each>
then you will use the one you are currently in like you do with your media
Hope this helps, Jan-Willem
Thanks guys, such a simple thing when you look back at it.
is working on a reply...