xsl-list
[Top] [All Lists]

Re: [xsl] shortest way to write this xsl:if statement

2012-06-15 08:22:23
= 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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--