|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: incrementing a variable
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()<(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
|
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








