Re: [xsl] XSLT: Are XML Comments parseable?

Subject: Re: [xsl] XSLT: Are XML Comments parseable?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 20 Sep 2005 16:33:05 +0100
> I do understand what guys are trying to say, yet it doesn't work.

You have done something rather different to what was suggested.

You no longer have a template matching comment() so when you do
		<xsl:apply-templates select="comment()"/>
the default template will be executed, which in the case of coment nodes
produces no output.

Then you generate a c element node and do
			<xsl:value-of select="."/>

. here is / ie the whole document, and value-of therefore produces the
string value of the document which is the concatenation of all
characters contained in any element (but not comments).


you want
<c><xsl:apply-templates select="comment()"/></c>

together with a template matching comment that does

<xsl:value-of select="."/>

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread