[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Retaining Comments


Subject: Re: [xsl] Retaining Comments
From: andrew welch <andrew.j.welch@xxxxxxxxx>
Date: Tue, 22 Nov 2005 16:57:41 +0000

> I note that when I create (copy) an XSLT from another XSLT and the source
> contains comments, these are not copied across. I undestand that comments
> may not be significant to an XSLT processor but does anyone know whether it
> is in fact possible to copy them to the output.
>
> The situation I have is a base XSLT which is then transformed into a new
> XSLT with some small amendments, but I wnat to keep all of the useful
> comments that were in the original.

I don't think the xml parser has to report comments, so its worth
checking that the one you are using isn't dropping them.

Then it depends on how you are doing the copy in your XSLT, you may
just need to provide a matching template as the default one for
comments is to do nothing.

<xsl:template match="comment()">
  <xsl:copy>
    ....

cheers
andrew


Current Thread
Keywords