This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
needing clarification about XSL transformation
- From: "Robert P. J. Day" <rpjday at mindspring dot com>
- To: docbook apps list <docbook-apps at lists dot oasis-open dot org>
- Date: Sun, 02 Mar 2003 14:51:41 -0500 (EST)
- Subject: DOCBOOK-APPS: needing clarification about XSL transformation
i spent the last hour trying to figure out why i was losing
my PIs and comments in transforming my original XML source file
to another XML format.
my stripped-down stylesheet to isolate the problem was
<?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>
so all i was doing was pretty much copying over the
original nodes. at least, that's what i *thought*.
what was not being copied were any of the processing instruction
or comment elements, even though the "node()" function call
specifically states that it matches *all* nodes except for root
nodes.
finally, i stopped using "xsltproc" and switched to saxon.
voila. suddenly, they get copied.
is this some kind of "feature" in xsltproc? should i have
expected this? am i correct in assuming that node() really
should match every node type except for the root node? argh.
rday