|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Looping using XSL
Josh,
This is something shameful, but it works: <xsl:template match="mood">
<xsl:for-each select="//*[position() <= rating]">
<div class="moodbar">
<img src="layout/global/pics/mood-red.gif" alt="" />
</div>
</xsl:for-each>
</xsl:template>When this was first introduced a couple of years back, there was a discussion of how best to get a large enough set of nodes (the critical bit to avoid having this trick be painfully expensive ... *at least* bind that //* to a variable to avoid traversing it all the time): <xsl:variable name="plentynodes" select="//*"/> <xsl:for-each select="$plentynodes[position() <= rating]">... Note: it is *not* a loop, and is only iteration in some particular sense. Enjoy, Wendell At 11:05 PM 10/1/2002, you wrote: I am trying to use a number in an xml file to define the number of times an image gets placed on the page. As the number appears only once and there are no nodes to count or group I'm a little bit stuck.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








