xsl-list
[Top] [All Lists]

Re: optional children

2002-10-21 06:18:45
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



<Prev in Thread] Current Thread [Next in Thread>