This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Test existence of element
- From: "J.Pietschmann" <j3322ptm at yahoo dot de>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Mon, 25 Mar 2002 22:42:00 +0100
- Subject: Re: [xsl] Test existence of element
- References: <5.1.0.14.0.20020325212621.00a10bf0@mail.unique.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Ralph Holz wrote:
> Is it possible to test if a child (or grand-child) element of the
> current node exists (within an xsl:if or :when expression)? If so, how?
Test for the existence of a child element named "foo":
<xsl:if test="foo">
Test for a grandchild:
<xsl:if test="*/foo">
Background: The expressions select a node set, which is
implicitely converted to boolean false if empty and
boolean true if non-empty.
Of course, you may also use
test="count(foo) > 0"
and similar expressions.
HTH
J.Pietschmann
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list