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

RE: Incrementing a Global variable

Subject: RE: Incrementing a Global variable
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Wed, 27 Aug 2003 18:24:52 +0100
xsl simulate variable
> 
> Though the issue about incrementing the variables has
> been discussed a lot on this list, I feel if there is
> a feature where some sort of variable incrmenting is
> possible in XSLT, it will save lot of programming
> hours producing a trivial thing as generating serial
> nos. I am not suggesting to deviate from the viewpoint
> that XSLT should be a functional language.

But it would deviate from that principle. It would change it from a
functional language to a procedural one, in which instructions have to
be executed in a fixed order.


> Also if we can have looping constructs
> which can iterate over number ranges for e.g.
> 
> for (int i=0; i < n; i++) , it will facilitate
> processing loops in a diffrent way. 

XSLT 2.0 allows you to do this:

<xsl:for-each select="20 to 30">
  <xsl:value-of select="."/>
</xsl:for-each>

You can simulate this in 1.0 with

<xsl:for-each select="//node()[position() &lt;= 10]">
  <xsl:value-of select="position() + 20"/>
</xsl:for-each>

Michael 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.