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

Re: shortest way to write this xsl:if statement

Subject: Re: shortest way to write this xsl:if statement
From: Andrew Welch <andrew.j.welch@xxxxxxxxx>
Date: Fri, 15 Jun 2012 14:22:13 +0100
Re:  shortest way to write this xsl:if statement
> = as Ken has very patiently described is an existential quantifier. If
> you want regular equality testing use eq.
>
> There are two categories of XPath comparators. General comparison
> operators like = that do existential quantification and value
> comparison operators like eq that compare atomic values.

One thing to be aware of is you have to be careful when using eq when
the sequence type is xs:boolean, for example:

<xsl:variable name="foo" select="/aaa eq '123'" as="xs:boolean"/>

will fail with an exception if /aaa returns the empty sequence. However:

<xsl:variable name="foo" select="/aaa = '123'" as="xs:boolean"/>

...will succeed as when you use = if either side is the empty sequence
it returns false, and not ()



-- 
Andrew Welch
http://andrewjwelch.com

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.