Re: [xsl] How to copy all child elements except specific one?

Subject: Re: [xsl] How to copy all child elements except specific one?
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Tue, 16 Jan 2001 11:46:23 -0800 (PST)
Chris,

> I assume 
> 
> <xsl:copy-of select="" />
> 
> will do what I need assuming I can come up with the correct select
> expression. How do I build an expression that will choose all child
elements
> except for a specific one?
> 

Use:

<xsl:copy-of select="*[not(count(. | $thisChild) = 1)]" />

This can be generalised so that if $thisChild is a node-set containing
a subset of children, then this subset will be excluded from copying:

<xsl:copy-of select="*[not(count(. | $theseChildren) = 
                                          count($theseChildren) )]" />


In fact, this is an almost obvious application of the general XPath
expression for set difference (ns1 \ ns2):

ns1[not(count(. | ns2) = count(ns2))]

Dimitre.

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

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


Current Thread