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

Re: incrementing a variable

Subject: Re: incrementing a variable
From: "Carsten Klein" <carstenklein@xxxxxxxx>
Date: Thu, 15 Aug 2002 13:18:43 +0200
incrementing a variable in xslt
Hi John

why would you want to use a variable in the first place?

You do not seem to use it at all. Or is the variable used at a later stage
of your stylesheet?

Or do you create multiple pages with just a few of the
images at ones?

When the latter is true, you may use a different approach.

Since you need to pass in the currently presented page, that is the range of
the images (links) being displayed on the page (start and number of images),
you may use these directly in the for-each instruction


<xsl:stylesheet ...>
    <xsl:param name="start" select="'0'"/>
    <xsl:param name="count" select="'5'"/>

    ....

    <xsl:template ...>
        <xsl:for-each select="//Encoding/DataContent[position()=start and
position()&lt;(start+count-1)">
            ...
        </xsl:for-each>
    </xsl:template>

Hope this gets you started...

Notes about xsl variables:

    In the functional programming language xsl you are not allowed to change
the value of a variable once it has been set. This is dependent on the scope
of a variable.

Global variables may not be changed at all.

Local variables exist only in the scope of the template.

You may use recursive templates to recursively "change"
a variables value:

    <xsl:template name="test" match="DataContent">
        <xsl:param name="var" select="'0'"/>

        ...

        <xsl:call-template name="test">
            <xsl:with-param name="var" select="$var+1"/>
        </xsl:call-template>

    </xsl:template>

For a better explanation see the XSL-FAQ at
    http://www.dpawson.co.uk/
or the official TR for XSL 1.0/1.1 or WD for the XSL 2.0 standards.

Bye

Carsten


 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.