Subject: [xsl] thoroughly confused about node() matching From: "Robert P. J. Day" <rpjday@xxxxxxxxxxxxxx> Date: Mon, 3 Mar 2003 11:08:14 -0500 (EST) |
having thoroughly exhausted everyone on the docbook-apps list with this, i'd like to get some clarification on what does and does not constitute a template match with "node()". given a couple test files: 1.xml: ---------------------------------------- <?xml version="1.0" encoding="utf-8"?> <book id="id1"> <?whatever?> <!-- and a worthless comment --> <chapter id="chap2"><title>chapter 1</title> <para>this is a paragraph in chapter 1.</para> </chapter> </book> ---------------------------------------- 1.xsl ---------------------------------------- <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="@*"> <xsl:copy/> </xsl:template> <xsl:template match="node()"> <xsl:copy> <xsl:apply-templates select="@* | node()" /> </xsl:copy> </xsl:template> </xsl:stylesheet> --------------------------------------- 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.) 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. can anyone point me at the definitive explanation as to what nodes the "node()" match really matches? 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? rday XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] cobol --> xml, Paul | Thread | Re: [xsl] thoroughly confused about, Wendell Piez |
RE: [xsl] Maintainability Problem, Jarno . Elovirta | Date | RE: [xsl] thoroughly confused about, Yates, Danny (ANTS) |
Month |