This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]