xsl-list
[Top] [All Lists]

RE: xsl:variable

2003-08-20 13:19:25
From: Zarana Shah [mailto:zarana(_at_)cs(_dot_)sunysb(_dot_)edu]
Sent: Wednesday, August 20, 2003 1:45 PM
To: XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] xsl:variable



how do i assign value to xsl:variable.

<xsl:variable name="some_var" select="'some value'"/>

The value of the select attribute may be an XPath expression, number or
literal string.  If you omit the select attribute:

<xsl:variable name="some_var">some value</xsl:variable>

then the contents of the xsl:variable element provide the value.  This is
invariably a string (or a result tree fragment, which in practice is the
same thing).

i think this question must be
answered on the group.

And the FAQ, among other places:
http://www.dpawson.co.uk/xsl/sect2/N8090.html

is ther any other way round this. all i need to do is 
maintain a counter
actually.

Ah, now we're getting somewhere.  You can't do a counter in the procedural
sense, because XSLT variables can't be updated with new values once bound.
You can, however, implement a loop (as one example requiring a counter)
using recursive techniques: http://www.dpawson.co.uk/xsl/sect2/N5019.html

but xsl:counter doesn't work either.

I'm not the first to say this, but you can't just invent syntax for a
language and expect it to work.  I recommend perusing the above-mentioned
FAQ or finding a good tutorial book for learning XSLT.

hth,
b.

| brian martinez                           
brian(_dot_)martinez(_at_)cendant(_dot_)com |
| lead gui programmer                                    303.357.3548 |
| cheap tickets, part of trip network                fax 303.357.3380 |
| 6560 greenwood plaza blvd., suite 400           englewood, co 80111 |
| cendant travel distribution services   http://www.cheaptickets.com/ |

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>