This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Test existence of element


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) &gt; 0"
and similar expressions.

HTH
J.Pietschmann


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]