[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

thoroughly confused about node() matching

Subject: thoroughly confused about node() matching
From: "Robert P. J. Day" <rpjday@xxxxxxxxxxxxxx>
Date: Mon, 3 Mar 2003 11:08:14 -0500 (EST)
xsl template match
  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

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.