|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: thoroughly confused about node() matching
Robert,
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. Hm. xsltproc does *not* generate output for comments or processing instructions, while saxon *does*. This confusion arises because there's more than the node test "node()" involved here. This template will match an attribute node: <xsl:template match="attribute::node()"/> or equivalently <xsl:template match="@node()"/> but this one will not: <xsl:template match="node()"/> because it's short for <xsl:template match="child::node()"/> 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 output. 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). specifically, 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: <xsl:template match="*"> <xsl:template select="child::node()"/> </xsl:template> does select PIs and comments, only their built-in rule: <xsl:template match="comment() | processing-instruction()"/> suppresses them. 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.... :-> Cheers, Wendell
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








