This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 3011 - Add clarifying note for typeswitch case matching
Summary: Add clarifying note for typeswitch case matching
Status: CLOSED INVALID
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XQuery 1.0 (show other bugs)
Version: Candidate Recommendation
Hardware: Other Linux
: P2 minor
Target Milestone: ---
Assignee: Don Chamberlin
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-16 13:40 UTC by Frans Englich
Modified: 2006-03-19 13:33 UTC (History)
0 users

See Also:


Attachments

Description Frans Englich 2006-03-16 13:40:38 UTC
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
Comment 1 Don Chamberlin 2006-03-16 22:38:26 UTC
Frans,
Section 3.12.2 Typeswitch states "The effective case in a typeswitch expression is the first case clase such that the value of the operand expression matches the SequenceType in the case clause, using the rules for SequenceType matching."

In my opinion, this is very clear and does not require an explanatory note.

Regards,
Don Chamberlin (personal opinion)
Comment 2 Frans Englich 2006-03-16 22:44:58 UTC
Well, if you think so, I'm fine with it(any WG member has more insight than me in such questions).

If not someone else in the next day or two feels the proposed Note paragraph would be an improvement, I will withdraw this bug report with resolution INVALID.


Regards,
Frans
Comment 3 Frans Englich 2006-03-19 13:33:11 UTC
I withdraw this comment.

Regards,
Frans