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 />
  </xsl:if>
  ...
</xsl:template>

I hope that's what you were after.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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


Current Thread