This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
startingLoc and length should be allowed to be empty. Often these values are being calculated and the static type of the calculation will result in an optionally empty type. With the current signature, this leads to a type error. Thus change the two parameter types to be optional. If any of them is () the result should be ().
Here is the proposed rewording: fn:substring( $sourceString as xs:string?, $startingLoc as xs:double?) as xs:string? fn:substring( $sourceString as xs:string?, $startingLoc as xs:double?, $length as xs:double?) as xs:string? Summary: Returns the portion of the value of $sourceString beginning at the position indicated by the value of $startingLoc and continuing for the number of characters indicated by the value of $length. The characters returned do not extend beyond $sourceString. If $startingLoc is zero or negative, only those characters in positions greater than zero are returned. If $startingLoc is the empty sequence an error FORG--99 is raised. If $length is the empty sequence, the length is considered to be 0 and the empty sequence is being returned. More specifically, the three argument version of the function returns the characters in $sourceString whose position $p obeys: fn:round($startingLoc) <= $p < fn:round($startingLoc) + fn:round($length) The two argument version of the function assumes that $length is infinite and returns the characters in $sourceString whose position $p obeys: fn:round($startingLoc) <= $p < fn:round(INF)
The working group considered this comment at its meeting today and decided not to accept it. For rationale, please see bug 1467.