RE: [xsl] Newbie question, commenting out an element

Subject: RE: [xsl] Newbie question, commenting out an element
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sun, 21 Dec 2008 09:32:47 -0000
> I am new to the list and to XSLT. I want to transform a XML 
> file to another XML file. In the process I have a Applic tag 
> that I want to wrap in a comment.

Comments can't contain tags. If you look at XML more carefully, you will see
that any "<" and ">" characters are not treated as markup (or tags), they
are ordinary data characters. They might look like tags, but the appearance
is deceptive.

This is reflected in the XSLT/XPath data model: a comment node cannot have
element nodes as its children.

So to solve this, you need to serialize the elements as strings, and then
put the strings in the comment node. You can do the serialization by hand
(but be careful with special characters like "&"), or use something like

Michael Kay

> I cannot get anything to work with version 1 or 2. I have 
> played and learned a lot of things, but not how to get this to work.
> sample, something like this.
> <applic><assert></assert></
> applic>
> to
> <!-- <applic><assert></assert></applic> -->
> Any love, please, This seems that it would be so simple, but 
> I was not able to find how to do it.
> d

Current Thread