The following is As I Understand It. The authority on this should be the
Recommendations(XSLT and XPath), on the w3.org site.
At 11:08 AM 3/3/2003, you wrote:
i get two different outputs using xsltproc and saxon.
xsltproc does *not* generate output for comments or
processing instructions, while saxon *does*.
i have read a number of docs, including tidwell's "XSLT",
kay's "XSLT Programmer's Reference", and the online docs
at www.w3.org, and i can say with assurance that every one
of those sources disagrees with the others when it comes to
defining what does and does not match "node()" in the context
of a template match. (e.g., kay, p. 440 states that node()
will *not* match attribute nodes, while tidwell, p. 51, says
it will. argh.)
This confusion arises because there's more than the node test "node()"
This template will match an attribute node:
but this one will not:
because it's short for
and no attribute sits on the child:: axis (by definition).
rather than get into the gory details of what each of these
sources says, it seems obvious to this here newbie that
*at least* one of xsltproc or saxon is generating incorrect
I believe Saxon's behavior is correct in your instance, but keep in mind
that nodes must be selected before they can be matched.
can anyone point me at the definitive explanation as to
what nodes the "node()" match really matches?
The XPath Rec in section 2.3 is quite explicit when it says "A node test
node() is true for any node of any type whatsoever". However a match
pattern "child::node()" will test true only for nodes that are on a child
axis (which excludes attribute nodes and the root node).
should the rules in my stylesheet match comment()s or
processing-instruction()s, to override the built-in
behavior which is to ignore them?
The subtlety is that the built-in behavior:
does select PIs and comments, only their built-in rule:
<xsl:template match="comment() | processing-instruction()"/>
So it's a bit complex. Another wrinkle is that it's possible there's
something different happening in the different processors' parsers. We'll
be hearing more.... :->
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
Mulberry Technologies: A Consultancy Specializing in SGML and XML
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list