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

RE: finite loop, incrementing, or...?

Subject: RE: finite loop, incrementing, or...?
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Thu, 3 Feb 2000 10:12:17 -0000
for loop incrementing
> <tscmeta>
>   <frequency code="ANNUAL" />
>   <date year="1994" month="1" day="1" />
>   <date year="1998" month="12" day="31" />
> </tscmeta>
> 
> Desired output: 
> <table><tr><td>1994</td><td>1995</td><td>1996</td><td>1997</td
> ><td>1998</td>
> </tr></table>
> 
> Any solutions? 

There's a nice little extension function coming out in the next Saxon
release that will allow you to do

<table><tr>
<xsl:for-each select="s:range(date[1]/@year, date[2]/@year)">
  <td><xsl:value-of select="."/></td>
</xsl:for-each>
</tr></table>

Meanwhile it has to be recursion. The principle is:

template do-range
  param from
  param to
  if $from<=$to
     <td><value-of $from></td>
     call-template do-range
        with-param from = $from+1
        with-param to = $to
     /call
  /if
/template

Mike Kay


 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.