This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
preserving comments in xml through xslt
- To: xsl-list at lists dot mulberrytech dot com
- Subject: [xsl] preserving comments in xml through xslt
- From: "Snyder, Christopher" <SnyderC at ctc dot com>
- Date: Fri, 26 Jan 2001 10:35:54 -0500
- Reply-To: xsl-list at lists dot mulberrytech dot com
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