Re: [xsl] optional children

Subject: Re: [xsl] optional children
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Mon, 21 Oct 2002 12:55:28 +0100
Hi Andrew,

> I want to output <foo/> if and only if element <a> has child <b>,
> with optional children <c> and <d>.

In other words, you want to output <foo> if it has a child <b> and it
doesn't have any other children that are not <c> and <d>:

<xsl:template match="a">
  <xsl:if test="b and not(*[not(self::c or self::d)])">
    <foo />

I hope that's what you were after.



Jeni Tennison

 XSL-List info and archive:

Current Thread