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

Re: Failing string() test fail

Subject: Re: Failing string() test fail
From: "Christopher R. Maden" <crism@xxxxxxxxx>
Date: Fri, 26 Jun 2009 02:09:43 -0400
Re:  Failing string() test fail
Karl Stubsjoen wrote:
> What would cause a string() test to fail?  I've tested on a simple
> xml, like this, with the following test:
> Assume we are matching on B
> <xsl:if test="string(C/@test)">Yes</xsl:if> You get one Yes.
> <A>
>     <B>
>         <C/>
>         <C/>
>         <C/>
>     </B>
>     <B>
>         <C/>
>         <C test="yes"/>
>         <C/>
>     </B>
> </A>

What would you expect to get?

Remember that in the context of xsl:if test, there is a coercion to
Boolean.  When there is no @test attribute, the string() will evaluate
to the empty string, which in turn evaluates to false.  So I would
expect no Yes for the first <B> and a Yes for the second <B>.

Chris Maden, text nerd  <URL: http://crism.maden.org/ >
bAll I ask of living is to have no chains on me,
 And all I ask of dying is to go naturally.b b Laura Nyro
GnuPG Fingerprint: C6E4 E2A9 C9F8 71AC 9724 CAA3 19F8 6677 0077 C319

Current Thread


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.
First Name
Last Name
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.