[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: James Clark <jjc@xxxxxxxxxx>
Date: Thu, 17 Jun 1999 17:03:08 +0700
n queens extension
Oren Ben-Kiki wrote:

> Is this legal today? James clark wrote:
> 
> >You cannot use a variable as a location step, but the above examples are
> >valid.  See production [18] PathExpr.
> 
> And yes, PathExpr does allow "$Variable" as the first thing in a path
> (section 6.2.1, "PrimaryExpr") However, giving XT the above or even:
> 
> <xsl:copy-of select="$var/a"/>
> 
> Causes the error:
> 
> DID NOT EXPECT cannot convert to node-set

$var has to be a node-set.  The WD says this in 4th paragraph of section
6.2.2.

> And there's no word in the limitation sections about this. Given James is
> also the editor of the draft and the implementer of XT, I find the whole
> combination somewhat confusing. Examining the draft, I find that the
> introduction to section 6 states:

This is not relevant.  "Patterns" are the things that occur in match
attributes in xsl:template.

> "The only operations that can be performed on a result tree fragment are to
> convert it to a string or a boolean. In particular, it is not permitted to
> use the /, //, and [] on result tree fragments.
> 
> Expressions can only return values of type result tree fragment by
> referencing variables of type result tree fragment or calling extension
> functions that return a result tree fragment."
> 
> However it isn't defined what a "result fragment" is (there's an editorial
> note to fix that). I _assumed_ that a variable holding a node set would
> qualify, in which case the code above is invalid and XT is correct.

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.

James


 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.