This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: preserving comments in xml through xslt



> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]