OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: DOCBOOK-APPS: Re: needing clarification about XSL transformation


On Mon, 3 Mar 2003, Vitaly Ostanin wrote:

> On Sun, 02 Mar 2003 14:51:41 -0500 (EST)
> "Robert P. J. Day" <rpjday@mindspring.com> wrote:
> 
> > 
> >   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>
> 
> Try:
> 
>   <xsl:template match="@*|comment()|processing-instruction()">
>     <xsl:copy/>
>   </xsl:template>
> 
>   <xsl:template match="*">
>     <xsl:copy>
>       <xsl:apply-templates select="@*|*"/>
>     </xsl:copy>
>   </xsl:template>
> 
> http://www.w3.org/TR/xslt#built-in-rule
> 
> IMHO, xsltproc - the best.

  before this gets even further afield, let me stress that i
*know* how to add extra rules to ensure processing of comments
and processing instructions.  what i was baffled by was the
clearly differing behaviour between xsltproc and saxon, using
the following stylesheet (shown in its entirety):

---------------------------

<?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>

----------------------------------------

  given that i'm not trying to do anything fancy, it
seems to me that using *any* XSL transformation tool 
should give me the same output.

  but xsltproc does *not* copy over comments or
processing instructions, while saxon *does*.  ergo,
at least one of them is incorrect.

  so my question is, given that the node() function
is defined as matching comment and processing instruction
nodes, which of these tools is behaving incorrectly?

  i apologize for flogging this, but i spent over
an hour yesterday convinced that i had no clue how
template matching worked until i tried a different
parser.

 so given that the default template rule for both
comments and processing instructions is to do nothing,
but i have an explicit rule for matching "node()",
what should i expect?

rday







[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]