Subject: Re: Test existence of element
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Mon, 25 Mar 2002 22:42:00 +0100
|
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
|