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 1422 - [FO] Types of substring arguments
Summary: [FO] Types of substring arguments
Status: CLOSED WONTFIX
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Functions and Operators 1.0 (show other bugs)
Version: Last Call drafts
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: Ashok Malhotra
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on: 1467
Blocks:
  Show dependency treegraph
 
Reported: 2005-05-13 21:26 UTC by Michael Rys
Modified: 2005-09-29 11:10 UTC (History)
0 users

See Also:


Attachments

Description Michael Rys 2005-05-13 21:26:06 UTC
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 ().
Comment 1 Michael Rys 2005-05-19 20:10:58 UTC
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)

Comment 2 Mary Holstege 2005-07-21 20:41:57 UTC
The working group considered this comment at its meeting today
and decided not to accept it. For rationale, please see bug 1467.