This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]