[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: looping (was msxml install)

Subject: RE: looping (was msxml install)
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Tue, 17 Oct 2000 10:43:06 +0100
msxml loop 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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.