xsl-list
[Top] [All Lists]

Re: [xsl] XML Schema union type is evil (for XPath 2.0 processing)

2008-04-10 06:47:12


Again, there is a way to protect yourself:

    if (data(quantity) instance of xs:string) then
       if (data(quantity) eq 'out-of-stock') then
          'Bummer'


or more naturally just


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

It's usually better to access the element rather than use data() or
text() and (especially in the face of variable input) to use = rather
than eq. the system then just does the right thing automatically.

Since this is what most people would writet anyway (and it's the version
that you need to use if the processor is not schema aware), it's not
normally an issue in practice.

David

--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>