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

RE: XML Schema union type is evil (for XPath 2.0 proc

Subject: RE: XML Schema union type is evil (for XPath 2.0 processing)
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 10 Apr 2008 15:36:02 +0100
RE:  XML Schema union type is evil (for XPath 2.0  proc
or more naturally just


       if (quantity ='out-of-stock') then
          'Bummer'

If the typed value of quantity is an integer, then this comparison will fail
with a type error. You could protect yourself by

If (string(quantity) = 'out-of-stock'))

My own preference was that "=" should return false (rather than error) when
comparing to incomparable values; but the strong typists carried the day.
There are other functions where you do get the "false" behaviour, and you
can exploit this:

If (deep-equal(quantity, 'out-of-stock')) ...

Apologies for the rogue capitalisation, I'm using a reinstalled Outlook, and
I haven't worked out how to switch off Microsoft's random-error-generation
software.

Michael Kay
http://www.saxonica.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.