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

Re: xsl:variable

Subject: Re: xsl:variable
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 10 May 2000 15:32:11 +0100 (BST)
xsl variable empty
  <xsl:template match="/">
  <xsl:variable name="global"/>
  <!-- Other tag -->
  </xsl:template>
  Is it correct?
  Is the variable empty?

It is syntactically correct, but strange.
If you define it like that then 
a) the variable is only usable in that one template rather than in all
   of them as it would have been if you had put the xsl:variable outside
   the template and
b) It has value a result tree template that just has a root node.
   Thus acts in almost all contexts like the empty string.
   An XSL variable never changes its value once it is bound so
   this is not very useful definition for $global.


  <xsl:template match="pb">
  <xsl:variable name="global">
  <xsl:value-of select="$global"/>

This is again correct put again strange.
You have defined another variable (also called global)
that is local to this template, and again defined it to be empty.

  Another question why the <div> and </div> are not in
  the variable global

Because you defined the variable to be empty.

You quoted my suggestion of defining it to be

> <xsl:variable name="global">
>   <xsl:value-of select="/the/first/node/you/want"/>
>   <xsl:value-of select="/the/second/node/you/want"/>
>   <xsl:value-of select="/the/third/node/you/want"/>
> </xsl:variable>

but you didn't put this declaration at the top level of your stylesheet,
and you didn't change those xpaths to select whatever it is you want to
select. 

David


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


Current Thread
  • xsl:variable
    • Sydney - Wed, 10 May 2000 14:37:33 +0200 (CEST)
      • <Possible follow-ups>
      • Sydney - Wed, 10 May 2000 16:01:21 +0200 (CEST)
        • David Carlisle - Wed, 10 May 2000 15:32:11 +0100 (BST) <=
      • Sydney - Wed, 10 May 2000 17:33:52 +0200 (CEST)
      • Kay Michael - Thu, 11 May 2000 09:18:11 +0100

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.