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

Re: Value-of, copy-of

Subject: Re: Value-of, copy-of
From: Joerg Pietschmann <joerg.pietschmann@xxxxxx>
Date: Thu, 28 Feb 2002 09:36:06 +0100
template c1010
Mike Ferrando <mikeferrando@xxxxxxxxx> wrote:
> I would like to exclude some elements from my copy-of output.

Well, Wendell gave you already a solution for your specific
problem.

However, it could also be handled as special case of the more
general problem "How do i copy a node tree with small changes?"
(this is actually a FAQ).

The general solution is to start out with the generic copy
template
  <xsl:template match="node()|@*">
   <xsl:copy>
    <xsl:apply-templates select="node()|@*"/>
   </xsl:copy>
  </xsl:template>
and then override it with templates for the "small changes",
for example in your case "do nothing for C1007 and C1010
elements":
  <xsl:template match="C1007|C1010"/>
You have to be careful, this would also delete these elements
elsewhere, if you want to do this only in a specific context
you could write
  <xsl:template match="C1001/C1007|C1001/C1010"/>
(delete only if they are a child of C1001)
or, more general
  <xsl:template match="C1001//C1007|C1001//C1010"/>
(delete only if they are a descendant of C1001)

You see, this approach is easier to extend, but bear in mind that
Wendells tailored solution might have a noticable performance
advantage.

Regards
J.Pietschmann

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.