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
I have a big problem with some xml and xslt. When a user watch a profilepage i generate the xml on-the-fly and in this xml can be several pictures.
I want to use for-each to list these pictures but now I have been using 4 hours and went 13 pages down on google.
Function call:
<xsl:variable name="boat" select="Customer.Xslt:GetBoatOnUrl()"/>
XML:
<boat> <name>name of test</name> <images> <url>image1.jpg</url> <url>image2.jpg</url> <url>image3.jpg</url> <url>image4.jpg</url> <url>image5.jpg</url> <url>image6.jpg</url> <url>image7.jpg</url> </images></boat>
XSLT for making the list
<xsl:variable name="boatimages" select="$boat/images/url"/><xsl:for-each select="$boatimages"> <div class="slide-pic"><img alt="" src="/gfx/showboat/{url}" /></div></xsl:for-each>
The result:
<div class="slide-pic"><img alt="" src="/gfx/showboat/"></div> <div class="slide-pic"><img alt="" src="/gfx/showboat/"></div> <div class="slide-pic"><img alt="" src="/gfx/showboat/"></div><div class="slide-pic"><img alt="" src="/gfx/showboat/"></div> <div class="slide-pic"><img alt="" src="/gfx/showboat/"></div> <div class="slide-pic"><img alt="" src="/gfx/showboat/"></div>
I think I have tried everything but right now Im lost :(
Hi,
You'll want to change the img src to: <img alt="" src="concat('/gfx/showboat/', .)"/>
That is, change {url} to just ".", since you are already selecting the /url node in your for-each.
-Tom
yes.... it worked :)
<img alt="" src="{concat('/gfx/showboat/', .)}"/>
Thanks Tom
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Problem with custom xml and for-each
I have a big problem with some xml and xslt. When a user watch a profilepage i generate the xml on-the-fly and in this xml can be several pictures.
I want to use for-each to list these pictures but now I have been using 4 hours and went 13 pages down on google.
Function call:
XML:
XSLT for making the list
The result:
I think I have tried everything but right now Im lost :(
Hi,
You'll want to change the img src to: <img alt="" src="concat('/gfx/showboat/', .)"/>
That is, change {url} to just ".", since you are already selecting the /url node in your for-each.
-Tom
yes.... it worked :)
Thanks Tom
is working on a reply...