[Bug 3011] Add clarifying note for typeswitch case matching

http://www.w3.org/Bugs/Public/show_bug.cgi?id=3011

           Summary: Add clarifying note for typeswitch case matching
           Product: XPath / XQuery / XSLT
           Version: Candidate Recommendation
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: minor
          Priority: P2
         Component: XQuery
        AssignedTo: chamberl@almaden.ibm.com
        ReportedBy: frans.englich@telia.com
         QAContact: public-qt-comments@w3.org


The resolution for bug report 2999[1] has the effect that certain typeswitches
have surprising results.

It's not possible to fix this due to practical reasons given in the resolution
of 2999. I think the next best one can do is to clearly communicate these
peculiarities.

I suggest that at the end of 3.12.2 Typeswitch, is added:

<quote>
Note:
If more than one case clause matches, the first matching case clause is the
effective case. For example, if $input in the example below is the xs:integer
value 3, the query evaluates to <a/>, and if $input is an element, the query
evaluates to <c/>.

typeswitch($input)
case xs:integer return <a/>
case xs:integer return <b/>
case node() return <c/>
case element() return <d/>

</quote>

This report was opened(as opposed to commenting directly in 2999) in the belief
that it would be easier to manage the issues this way.


Regards,
Frans

1.
http://www.w3.org/Bugs/Public/show_bug.cgi?id=2999

Received on Thursday, 16 March 2006 13:40:42 UTC