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]

Re: checking if child exists


> I wanted to know if there's a way with xslt (i'm sure there is) to check if
> a child of a node exists.

Yes, just write an XPath expression that would identify the node-set
that would be the children you're looking for. If it's empty, it will test
false. If there are nodes in the set, it will test true.

<xsl:if test="*">
  There exists an element child of current node, in the null namespace.
</xsl:if>

<xsl:if test="foo">
  There exists a 'foo' element child of current node, in the null namespace.
</xsl:if>

   - Mike
____________________________________________________________________
Mike J. Brown, software engineer at         My XML/XSL resources:
webb.net in Denver, Colorado, USA           http://www.skew.org/xml/


 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]