RE: [xsl] thoroughly confused about node() matching

Subject: RE: [xsl] thoroughly confused about node() matching
From: "Lars Huttar" <lars_huttar@xxxxxxx>
Date: Mon, 3 Mar 2003 12:23:16 -0600
> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of 
> Robert P. J.
> Day
> Sent: Monday, March 03, 2003 11:07 AM
> To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
> Subject: RE: [xsl] thoroughly confused about node() matching
> 
> 
> On Mon, 3 Mar 2003, Yates, Danny (ANTS) wrote:
> 
> > Robert,
> > 
> > According to the XSLT 1.0 spec
> > (http://www.w3.org/TR/1999/REC-xslt-19991116),
> > section 5.2 
> (http://www.w3.org/TR/1999/REC-xslt-19991116#patterns), node()
> > matches "any node other than an attribute node and the root node".
> 
> which disagrees with tidwell's book, which claims that node(()
> matches attributes (p. 51)
> 
> which also disagrees with kay's book, which claims that node()
> does not match root, attribute *or* namespace nodes

By the way, just to clarify, you are looking
at the 2nd Edition of Kay's book, right? (you mentioned p. 440)

Note, though, that Kay says node() will never match root, attribute,
or namespace nodes *when used with the child axis* (the default).
Two bullet points later he notes that when used with the attribute axis,
node() matches attributes.

So, it seems to me that Tidwell and Kay agree: node() can match attributes,
but only if used in the right axis.

I'm not sure about the spec; it does say that AS A PATTERN, "node()
matches any node other than an attribute node and the root node."
Since it is considering "node()" to be the whole pattern, this would
seem to exclude the possibility of using a non-default axis, e.g.
attribute::.  So the spec is compatible with Kay and Tidwell about 
matching attributes.  As you point out, though, the spec disagrees with Kay
about child::node() matching namespace nodes.  Maybe the spec writers
forgot about namespace nodes when they wrote that??

>   and, related to this or not, the fact that saxon and xsltproc
> generate different output from the exact same stylesheet and
> XML file means that one of them is broken.

Only if they differ in ways not allowed by the standard.  (Which may well
be the case...  I haven't thought that far.)

Looking forward to hearing from others more knowledgeable.
Lars


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


Current Thread