Re: [xsl] Commenting selected elements (parents) and keeping the child elements with attributes/restoring parents elements somewhere else

Subject: Re: [xsl] Commenting selected elements (parents) and keeping the child elements with attributes/restoring parents elements somewhere else
From: Michael Ludwig <mlu@xxxxxxxxxxxxx>
Date: Fri, 09 May 2008 12:23:32 +0200
Pankaj Chaturvedi schrieb:
<xsl:template match="ignore:*">

I think I didn't get you. Could you be more specific? What about
trying disable-output-escaping to get this done.

Well, maybe I didn't get you either. I was just wondering what the underlying requirement was. To me, it sounded as if you were looking for a way to make some elements disappear while at the same time retaining them. In programing, that's often done via commenting out. So you asked the list how to comment out those element, and you got a good answer.

I need to restore these elements as comments (I thought that will be
best way) as I need to re-transform back to the original.

I probably got you wrong here. I was just thinking that an alternative way to make some elements disappear while at the same time retaining them (in order to be able to restore them later) might be to move them to another namespace, which I prefixed with "ignore". This presupposes, however, that whoever, or whatever, deals with your data knows how to ignore the elements in the "ignore" namespace. Assuming that it'll be XSLT that deals with your data, I suggested a way to ignore these elements in XSLT (by passing through).

And this assumption of mine may be wrong. Perhaps you just want elements
commented out, and the problem is solved thanks to Michael Kay's answer.

Michael Ludwig

Current Thread