Re: [xsl] preserving comments in xml through xslt

Subject: Re: [xsl] preserving comments in xml through xslt
From: Jiri Jirat <Jiri.Jirat@xxxxxxxxx>
Date: Fri, 26 Jan 2001 16:53:53 +0100
Hello Christopher,
 here is a paragraph from
http://www.w3.org/TR/REC-xml#sec-comments

[Definition: Comments may appear anywhere in a document outside other
markup; in addition, they may appear within the document type
declaration at places allowed by the grammar. They are not part of the
document's character data; an XML processor may, but need not, make it
possible for an application to retrieve the text of comments. For
compatibility, the string "--" (double-hyphen) must not occur within
comments.] Parameter entity references are not recognized within
comments.


See the sentence with "an XML processor may, but need not, make it
possible ...", etc.

Best regards
Jirka


"Snyder, Christopher" wrote:
> 
> I'm using xslt to convert one xml document into another similar document
> with a slightly different DTD, using a pretty basic identity transformation.
> 
> How do I refer to the comments in the first XML to be sure that they appear
> in the finished XML?  They seem to be dissappearing.  I'm using ie5.0 with
> the updated MSXML3.dll installed in replacement mode.
> 
> Additionally the root node of the input xml has an xmlns attribute which
> doesn't want to show up in the finished xml.  Although I put an explicit
> xsl:attribute command in for the root, it was still missing in the final
> xml.
> 
> Thank you for your time,
> Chris
> 
> The xsl looks like this:
> 
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
> <xsl:output method="xml" indent="yes"/>
> 
>    <!-- Transform a document to itself, lowercasing all tag names -->
>    <!-- When you match any element -->
>    <xsl:template match="*">
>        <!-- Create the same element with a lowercase name -->
>        <xsl:element name="{translate(name(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
> 
> 'abcdefghijklmnopqrstuvwxyz')}">
>           <!-- Including any attributes it has and any child nodes -->
>           <xsl:apply-templates select="node()|@*"/>
>        </xsl:element>
>    </xsl:template>
> 
>    <xsl:template match="@*">
>       <xsl:attribute name="{translate(name(),'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
> 
> 'abcdefghijklmnopqrstuvwxyz')}">
>          <xsl:value-of select="current()"/>
>       </xsl:attribute>
>    </xsl:template>
> 
> </xsl:stylesheet>
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

-- 
 <name firstName="Jirka" surname="Jirat"/>
 <mail>     jiratj@xxxxxxxxx  </mail>
 <support>  http://www.zvon.org </support>
 <zvonMailingList> http://www.zvon.org/index.php?nav_id=4
</zvonMailingList>

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread