I have a situation where it would be very helpful to use a loop but I don't really get how to in XSLT. I have this simple template and what I would like to do is have it continue looping until it finds no more blogImageList_images or hits a point (10 images or so).
In XSLT a loop is created with a for-each. Like this:
<xsl:for-each select="$currentPage/node">
Your code here...
</xsl:for-each>
Right now I don't know how your document type is build, so it's a little difficult to give you the excact code in your example. But the code above will loop for as many times, as the number of child-nodes that the current page has. So if the current page have got four children, the loop will loop four times. Hopes this makes sense to you.
Emulating a loop in XSLT
Hi All,
I have a situation where it would be very helpful to use a loop but I don't really get how to in XSLT. I have this simple template and what I would like to do is have it continue looping until it finds no more blogImageList_images or hits a point (10 images or so).
I know that if it were in another language I would need to do something like
for( i=0, 10, i !='' )
{
call template and i++;
}
I know XSLT doesn't work like that persay but I'm not truely understanding the best way to tackle this.
I found this online somewhere for a project a while back
Dn
Hi Andrew
In XSLT a loop is created with a for-each. Like this:
Right now I don't know how your document type is build, so it's a little difficult to give you the excact code in your example. But the code above will loop for as many times, as the number of child-nodes that the current page has. So if the current page have got four children, the loop will loop four times. Hopes this makes sense to you.
/Kim A
Thanks guys
Hi Andrew,
This is how I'd do something like what you're trying to accomplish:
Feel free to ask about what's going on, if you like...
/Chriztian
is working on a reply...