[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

matching when the attribute or element is NOT there

Subject: matching when the attribute or element is NOT there
From: Carl Yu <carl.yu@xxxxxxxxxxxx>
Date: Wed, 19 Mar 2003 11:41:14 -0800 (PST)
xml subchild
So this works for detecting when elements or attributes exist...

<xsl:template match="/main/child[subchild]">
<xsl:text>Child contains a subchild element.</xsl:text>
</xsl:template>

<xsl:template match="/main/child[@attr]">
<xsl:text>Child contains the attr attribute.</xsl:text>
</xsl:template>

This does not work... is there another way to do this in the match statement?  I 
know I can write this with an if statement, but I'm trying to do some grouping 
work that requires the check occur in the match statement.

<xsl:template match="/main/child[not(subchild)]">
<xsl:text>Child does not contain a subchild element.</xsl:text>
</xsl:template>

<xsl:template match="/main/child[not(@attr)]">
<xsl:text>Child does not contain the attr attribute.</xsl:text>
</xsl:template>

Any help?
Thanks,
Carl


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.