|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: looping (was msxml install)
> Also, I've got a loop question to ask. I've got this bit of XML code
>
> <reference id="K132H" models="3"/>
>
> What I want is to take the number of models (here 3) and write
>
> <img src="img/d1.jpg"/>
> <img src="img/d2.jpg"/>
> <img src="img/d3.jpg"/>
>
> to my output xhtml file... I can't seem to find a way to work
> around a while-loop in XSLt. Any help? Thanks much in advance!
Use recursion. Write a named template that takes parameters called "first"
and "last", call it with first=1, last=3. Within the named template, do:
<img src="img/d{$first}.jpg"/>
<xsl:if test="$first!=$last">
<xsl:call-template name="...">
<xsl:with-param name="first" select="$first + 1"/>
<xsl:with-param name="last" select="$last"/>
</xsl;call-template>
</xsl:if>
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








