This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
The argument to fn:root is being typed as a zero-or-more sequence, hence there is a static type check error. (:*******************************************************:) (: Test: K2-DocumentURIFunc-10 :) (: Written by: Frans Englich :) (: Date: 2007-01-15T15:15:45+01:00 :) (: Purpose: Invoke on a tree document node with fn:root(). :) (:*******************************************************:) let $i := document { <e> <a/> <a/> <a/> <b/> <b/> <a/> <a/> </e> } return empty(document-uri(root($i/a/b[1])))
K2-StartsWithFunc-1 to 6 and K2-EndsWithFunc-1 to 6 also have the problem.
Doesn't the [1]-predicate ensure a more precise cardinality is inferred? Formal Semantics, 4.3.2 Filter Expressions reads: "When a predicate with a numeric literal or the last() expression is applied on a primary expression, it is normalized using the fn:subsequence function. This results in a more precise static type for those cases." 7.2.13 The fn:subsequence function, reads: "The fn:subsequence function has special static typing rules when its second argument is the numeric literal value 1 or the built-in variable $fs:last. These rules provide better typing for path expressions such as Expr[1] and Expr[fn:last()]." Therefore, I currently guess that the mentioned tests doesn't have cardinality-related errors. However, I think K2-StartsWithFunc-1 to 6 and K2-EndsWithFunc-1 to 6 should fail type check nevertheless because the declared type of the variable, doesn't match its operand: declare variable $vA as xs:string := ("B STRING", current-time(), string(<e>content</e>))[1];
$i/a/b[1] is treated as: $i / a / ( b [1] ) which types as a zero-or-more sequence. and not: ( $i / a / b )[1] would would type as a zero-or-one sequence.
Yes, I'll fix K2-DocumentURIFunc-10. Seems that K2-StartsWithFunc-1 to 6 and K2-EndsWithFunc-1 to 6 didn't have the cardinality error, but the item type mismatch previously fixed.
I believe all these issues should be fixed in recent CVS now.
K2-DocumentURIFunc-10 is now fixed. Thanks.