xsl-list
[Top] [All Lists]

RE: [xsl] applying code from inside the comment

2007-01-16 09:36:32
I've encountered the following problem:

input

<?xml version="1.0"?>
<A>
<!--<B>hello world</b>-->
<C>this should remain also</C>
</A>

I've tried different ways to convert comment into code. But 
none of them works and I dont have any clues. Can you help me?

I'm not sure what you want to do with the comment. But the important thing
is to note that the comment is just text. It doesn't contain an element
node, it just contains text with a strong resemblance to element markup. If
the structure is potentially more complex than your example, then perhaps
you should consider extracting the text of the comment and parsing it as an
XML document:

<xsl:template match="comment()">
  <xsl:apply-templates select="saxon:parse(.)"/>
</xsl:template>

Michael Kay
http://www.saxonica.com/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--