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

RE: xsl:variable

Subject: RE: xsl:variable
From: "Martinez, Brian" <brian.martinez@xxxxxxxxxxx>
Date: Wed, 20 Aug 2003 14:19:25 -0600
zarana shah
> From: Zarana Shah [mailto:zarana@xxxxxxxxxxxxx]
> Sent: Wednesday, August 20, 2003 1:45 PM
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  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.martinez@xxxxxxxxxxx |
| 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


Current Thread
  • xsl:variable
    • Zarana Shah - Wed, 20 Aug 2003 15:45:07 -0400 (EDT)
      • <Possible follow-ups>
      • Martinez, Brian - Wed, 20 Aug 2003 16:20:04 -0400 (EDT) <=
      • cknell - Wed, 20 Aug 2003 16:21:58 -0400 (EDT)

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.