xsl-list
[Top] [All Lists]

Re: optional children

2002-10-21 04:55:28
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



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