Subject: Re: [xsl] Ouput escaping / XPath From: David Carlisle <davidc@xxxxxxxxx> Date: Tue, 15 Nov 2005 18:45:45 GMT |
<xsl:message> <xsl:copy-of (or xsl:copy or whatever you need) select="."/> </xsl:message> <xsl:copy-of select="./child::node()"/> This obviously copies everything, even the comment. Apparently I would like to copy everything except the comment as to get the result: you never need to start an XPath with ./ (unless it starts with .//) and child:: is also the default so that is <xsl:copy-of select="node()"/> However you don't want to use copy-of at all as you do not want copies of the child nodes, youneed to transform them. So you want <xsl:apply-templates mode="copy"/> where mode="copy" is the identity transform, but just on elements and text: <xsl:template match="*" mode="copy"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:apply-templates mode="copy"/> </xsl:copy> </xsl:template> > The element() function seems to copy the comment > as well. What am I doing wrong here? If you copy an element node then the copy has exatly the same children as the original (or rather has copies of those children) so it has teh smae text, comments and child elements. 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Ouput escaping / XPath, Manuel Baehnisch | Thread | Re[2]: [xsl] Ouput escaping / XPath, Manuel Baehnisch |
RE: [xsl] XSL2 attribute and schema, Michael Kay | Date | Re: [xsl] XSL2 attribute and schema, Soren Kuula |
Month |