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

Re: Conditional Assigining

Subject: Re: Conditional Assigining
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Wed, 16 May 2001 19:41:01 +0100
Re:  Conditional Assigining
Hi Sri,

> <xsl:variable name="ID">-1</xsl:variable>
> <xsl:for-each select="Section[parentID='0']">
>         <xsl:if test="$ID=-1">
>                 <xsl:variable name="ID" select="sectionID" />
>         </xsl:if>
> id <xsl:value-of select="$ID"/>

You cannot use variables in this way within XSLT. A variable's scope
is limited to its following siblings and their descendants, and you
cannot reassign a different value to the variable (unless you use an
extension element like saxon:assign).

If you want to get the value of the sectionID of that first Section
element, then that's what you should set the value of the variable to:

<xsl:variable name="ID" select="Section[parentID = '0'][1]" />

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



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


Current Thread
  • Re: nested templates?, (continued)
        • Kurt Cagle - Wed, 16 May 2001 17:08:02 -0400 (EDT)
        • Chris Bayes - Wed, 16 May 2001 17:48:49 -0400 (EDT)
        • Tim Watts - Wed, 16 May 2001 19:57:58 -0400 (EDT)
        • Alex Black - Wed, 16 May 2001 20:13:03 -0400 (EDT)
    • Jeni Tennison - Wed, 16 May 2001 14:45:37 -0400 (EDT) <=
    • Sri ni - Thu, 17 May 2001 05:01:59 -0400 (EDT)
    • Sri ni - Thu, 17 May 2001 06:49:56 -0400 (EDT)
    • Sri ni - Thu, 17 May 2001 07:20:34 -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.