This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: preserving comments in xml through xslt
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] preserving comments in xml through xslt
- From: David Carlisle <davidc at nag dot co dot uk>
- Date: Fri, 26 Jan 2001 16:09:16 GMT
- References: <100A6E7AD9CBD31192E900508BB1E9E77B2555@ctcjst-mail1.ctc.com>
- Reply-To: xsl-list at lists dot mulberrytech dot com
> How do I refer to the comments in the first XML to be sure that they appear
> in the finished XML?
match="comment()"
> They seem to be dissappearing.
They will anyway with some parsers (which are allowed to throw away
comments) (But I don't think this applies to msxsl)
> Additionally the root node of the input xml has an xmlns attribute
Two errors or terminology there.
The root node is not the top level element it is the conceptual root of
the tree corresponding to the whole document, and not to any explicit
markup. Root nodes can't have attributes. Also to a namespace aware
system xmlns:x= is _not_ an attribute. In Xpath they do not produce
attribute nodes, but rather result in namespace nodes.
You can't generate namespace declarations using xsl:attribute.
To get the namespace copied, since you are using xsl-element, you just
need to use the remaining attribute of that:
instead of
name="{translate(name(), 'A...
you could use something like:
name="{translate(name(), 'A...
namespace="namespace-uri())
David
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list