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

Re: easy one

Subject: Re: easy one
From: Kevin Rodgers <kevin.rodgers@xxxxxxx>
Date: Fri, 22 Oct 2004 15:08:56 -0600
kevin rodgers
Gary Hegenbart writes:
> I'm not an expert, but you need to check to see if the node name
> starts with ERR. Assuming you are working in the 'user' node, you can
> try this:
> 
> <xsl:if test="count(./*[starts-with(name(), 'ERR')])&gt;0">
>   <!-- do something for an error node -->
> </xsl:if>
> 
> It counts all child nodes whose name starts with ERR, the tests if the
> count is greater than

Yes, but you don't need to count them.  The set of nodes that satisfy
the condition is automatically converted to a boolean value; only an
empty set is considered to be false:

<xsl:if test="./*[starts-with(name(), 'ERR')]">
  <!-- do something for a node with errors -->
</xsl:if>

http://www.w3.org/TR/xslt#section-Conditional-Processing-with-xsl:if
http://www.w3.org/TR/xpath#function-boolean

I'm not an expert either, so here's my followup question: what is the
point of specifying "./" in the above expression?

-- 
Kevin Rodgers

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.