This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: counting question
- From: "Michael Kay" <michael dot h dot kay at ntlworld dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Wed, 9 Jan 2002 10:33:52 -0000
- Subject: RE: [xsl] counting question
- Reply-to: xsl-list at lists dot mulberrytech dot com
> I am wanting to count all the child elements of a particular
> element and treat them one way if there is only one child and
> another if there are multiple. Is the best way to do this to
> test if the child is both first and last or is there some
> other more sensible method?
One simple way is
<xsl:choose>
<xsl:when test="child[2]">...(there are multiple children)
<xsl:otherwise>... (there's zero or one child)
But testing count(child)=1 is just as good and less "clever".
Mike Kay
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list