OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xml-dev] Variables in XSL!



Peter,

> Is it possible to have variables/counters
> in XSL, like in vbscript: i=i+1 etc?.

Not like that, no. You can assign values to "variables" but then you cannot
change the value once you have set it (in the current scope).

> I would like to keep track of when the 10th value comes and then
> do a line break...

Something like this will do the trick.

<xsl:for-each select="/MyElements">
  <xsl:if test="position()=10">
    <br />
  </xsl:if>
</xsl:for-each>

In order to actually maintain variables you have to convert the template to
operate recursively and then you can use the output.

HTH,
Jeff Rafter
Defined Systems
http://www.defined.net
XML Development and Developer Web Hosting