Hi Hans-Juergen,

Thanks very much for reporting the bug, which has now been noted (sourceforge Bug report ID: 3419499) and the bug is now fixed, which will appear in the next patch release.

kind regards


On 05/10/11 13:06, Hans-Juergen Rennau wrote:
Hello Michael,

it seems to me there is a strange XQuery bug concerning sequence type matching.

Summry: typeswitch cases using "element(elemName)", as well as "instance of element(elemName)" do not match when they should; but the equivalent comparison of node names matches, as it should.
But this, of course, only in a very special context, which is given by how the candidate is provided:
   $def/(* except xs:annotation)

For full example code see below.

Version: saxon9-3-0-5j

Kind regards,
-- Hans-Juergen

   <xs:restriction xmlns:xs="http://www.w3.org/2001/XMLSchema" base="xs:string"/>

declare namespace xs="http://www.w3.org/2001/XMLSchema";
let $def :=
   <xs:simpleType name="yogi">
      <xs:restriction base="xs:string"/>
let $ref := $def/xs:restriction

      for $c in $def/(* except xs:annotation) return (
         case element(xs:restriction) return <MATCH_TYPESWITCH/>
         default return <NOMATCH_TYPESWITCH/>
         if ($c instance of element(xs:restriction))
         then <MATCH_INSTANCEOF/>
         else <NOMATCH_INSTANCEOF/>
         if (node-name($c) eq node-name($ref))
         then <MATCH_NODENAME/>
         else <NOMATCH_NODENAME/>

------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/saxon-help

O'Neil Delpratt
Software Developer, Saxonica Limited
Email: oneil@saxonica.com
Tel: +44 118 946 5894
Web: http://www.saxonica.com