Subject: Re: optional children
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Mon, 21 Oct 2002 14:18:45 +0100
|
Hi Andrew,
> <xsl:if test="b and not(*[not(self::c or self::d)])">
> <foo />
> </xsl:if>
>
> Ok so here you are using not() within a not() to exclude nodes from
> the list of excluded nodes... this doesnt work for me but I get the
> logic behind it. Does it fail because not(*[...]) will evaluate to
> false before it even gets to the predicates (because <b> must exist
> already)?? Or will the first predicate always be evaluated if there
> is one?
Sorry, I think it's because I missed self::b from the list:
b and not(*[not(self::b or self::c or self::d)])
should work better.
Oleg's solution is neater anyway though, as long as it's unlikely that
there'll be hordes of children of a (because if there were lots of
children then doing count()s would involve a lot of node visits which
would take time).
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|