[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Ouput escaping / XPath

Subject: Re: Ouput escaping / XPath
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 15 Nov 2005 18:45:45 GMT
select except
<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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.