Subject: Re: [xsl] Looping using XSL From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Wed, 02 Oct 2002 00:33:36 -0400 |
<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>
Enjoy, Wendell
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.
The XML looks like this: <mood> <rating>5</rating> </mood>
In this case I want to put five iterations of the image on screen like this:
<div class="moodbar"><img src="layout/global/pics/mood-red.gif" alt="" /></div>
<div class="moodbar"><img src="layout/global/pics/mood-red.gif" alt="" /></div>
<div class="moodbar"><img src="layout/global/pics/mood-red.gif" alt="" /></div>
<div class="moodbar"><img src="layout/global/pics/mood-red.gif" alt="" /></div>
<div class="moodbar"><img src="layout/global/pics/mood-red.gif" alt="" /></div>
Is there a way of doing this so if the number is changed (with a max of 17 possible) the number of images will change?
___&&__&_&___&_&__&&&__&_&__&__&&____&&_&___&__&_&&_____&__&__&&_____&_&&_ "Thus I make my own use of the telegraph, without consulting the directors, like the sparrows, which I perceive use it extensively for a perch." -- Thoreau
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Looping using XSL, Josh Campbell | Thread | Re: [xsl] Looping using XSL, Vasu Chakkera |
Re: [xsl] Complicated Table, Wendell Piez | Date | Re: [xsl] handling embedded XML tag, Wendell Piez |
Month |