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

Re: Can solve the N-queens - but can't count!

Subject: Re: Can solve the N-queens - but can't count!
From: "Oren Ben-Kiki" <oren@xxxxxxxxxxxxx>
Date: Thu, 17 Jun 1999 12:41:52 +0200
Re: Can solve the N-queens - but can't count!
James Clark <jjc@xxxxxxxxxx> wrote:

>The value of a variable is a result tree fragment if you define the
>variable it using xsl:variable without an "expr" attribute.  For
>example, if you do:
>
> <xsl:variable name="x"><xsl:apply-templates/></xsl:variable>
>
>the $x refers to a result tree fragment, so doing
>
>  <xsl:copy-of select="$x/a"/>
>
>is an error.
>
>On the other hand if you do:
>
>  <xsl:variable name="x" expr="//foo"/>
>
>then $x refers to a node-set, so you can legally do
>
>  <xsl:copy-of select="$x/a"/>
>
>See the third paragraph of Section 13.


Oh! I missed that. So if I create a variable containing a 'foo' element, it
matters _how_ I created it - if it was using an expression, it is a node
set, otherwise it is a result tree fragment. And that makes a huge
difference in what can be done to it, even though the contents is "the
same". I must say I find this to be confusing - from a stylesheet writer's
point of view, why should it matter?

BTW, I tried writing:

<xsl:variable name="x" expr="//foo"/>
<xsl:copy-of select="$x"/>

And the obvious variants, but kept getting empty results (using XT
1999-05-14). I expected to get:

<foo></foo>

What am I doing wrong?

Have fun,

    Oren Ben-Kiki


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


Current Thread

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.