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 static typing rules for fn:subsequence() (http://www.w3.org/TR/2005/WD- xquery-semantics-20050915/#sec_fn_subsequence) consider a number of special cases: fn:subsequence (Expr, 1, 1) fn:subsequence (Expr, $fs:last, 1) fn:subsequence (Expr, $fs:position, 1) All of them result in the same static type, prime(Expr)?. This is not surprising, as the second function argument is actually completely irrelevant for the function's output type. The call fs:subsequence (Expr, 42, 1) would as well have the same static type, prime(Expr)?. (You may add that to the typing rules as well :-)) Note that, as I stated in http://www.w3.org/Bugs/Public/show_bug.cgi?id=1968, it is hardly sensible to use $fs:last and/or $fs:position here anyway. Both variables are not necessarily related to Expr, but should be treated like any other variable here.
Jens, This issue has already been discussed in the previous last call period. The reason for having specific typing rules only for those cases is that they cover exactly the cases that correspond to the normalized expressions for Expr[1] and Expr[last()]. This was already discussed as part of Bug #1728 (http://www.w3.org/Bugs/Public/show_bug.cgi?id=1728) Notably see Michael Rys's comment #2 in that Bug. Best regards, - Jerome On behalf of the XSLT and XML Query WGs *** This bug has been marked as a duplicate of 1728 ***
While processing this comment, the working group realized that the first of the three rules related to this comment had a bug. The intent is to have Expr[Numeric] be given a more specific type, not only Expr[1]. The rule should be revised to the following: statEnv |- QName of func expands to (FN-URI,"subsequence") statEnv |- Expr : Type quantifier(Type) in { * } ----------------------------------------------------------- statEnv |- QName(Expr, Numeric, 1) : prime(Type) ? Thanks again for your comment on our specifications, - Jerome One behalf of the XML Query and XSLT WGs