[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] incrementing a variable
Subject: Re: [xsl] incrementing a variable From: "Carsten Klein" <carstenklein@xxxxxxxx> Date: Thu, 15 Aug 2002 13:18:43 +0200 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] incrementing a variable, John Moylan | Thread | RE: [xsl] incrementing a variable, Andrew Welch |
Re: [xsl] xsl/xslt coding standard, Carsten Klein | Date | RE: [xsl] incrementing a variable, Andrew Welch |
Month |
Keywords