xqDoc Home

Module URI

http://www.w3.org/2003/05/xpath-functions

Module Description

This is the xqDoc XML version for the W3C XPath Functions and Operators Working Draft for May 2003, Copyright © 2003 W3C ® (MIT, ERCIM, Keio), All Rights Reserved.

The xqDoc version is a non-normative annotation (that may contain errors) and the W3C is not responsible for any content not found at the original URL. Since the information contained in the xqDoc XML version is only a subset of the W3C Working Draft, the W3C version should be consulted for the complete explanation.

This version of the W3C XPath Functions and Operators is not the most recent version available from the W3C.

All of the functions below contain helpful links (see:) that will lead the user to the particular function defined in the W3C XPath Functions and Operators Working Draft for May 2003. Please consult the latest version of the W3C XPath Functions and Operators specification for function definitions that may supersede these.

   

Function Summary

 

Function Detail

adjust-date-to-timezone

Adjusts an xs:date value to a specific timezone, or to no timezone at all. If $timezone is the empty sequence, returns an xs:date without a timezone. Otherwise, returns an xs:date with a timezone. If $timezone is not specified, then $timezone is the value of the implicit timezone in the evaluation context. If $srcval is the empty sequence, then the result is the empty sequence. A dynamic error is raised (invalid timezone value) if $timezone is less than -PT14H00M or greater than PT14H00M . If $srcval does not have a timezone component and $timezone is the empty sequence, then the result is $srcval . If $srcval does not have a timezone component and $timezone is not the empty sequence, then the result is $srcval with $timezone as the timezone component. If $srcval has a timezone component and $timezone is the empty sequence, then the result is $srcval without its timezone component. If $timezone is not the empty sequence, then the result is $srcval with $timezone as its timezone component.

 
adjust-dateTime-to-timezone

Adjusts an xs:dateTime value to a specific timezone, or to no timezone at all. If $timezone is the empty sequence, returns an xs:dateTime without a timezone. Otherwise, returns an xs:dateTime with a timezone. If $timezone is not specified, then $timezone is the value of the implicit timezone in the evaluation context. If $srcval is the empty sequence, then the result is the empty sequence. A dynamic error is raised (invalid timezone value) if $timezone is less than -PT14H00M or greater than PT14H00M . If $srcval does not have a timezone component and $timezone is the empty sequence, then the result is $srcval . If $srcval does not have a timezone component and $timezone is not the empty sequence, then the result is $srcval with $timezone as the timezone component. If $srcval has a timezone component and $timezone is the empty sequence, then the result is $srcval without its timezone component. If $srcval has a timezone component and $timezone is not the empty sequence, then the result is an xs:dateTime value with a timezone component of $timezone that is equal to $srcval .

 
adjust-time-to-timezone

Adjusts an xs:time value to a specific timezone, or to no timezone at all. If $timezone is the empty sequence, returns an xs:time without a timezone. Otherwise, returns an xs:time with a timezone. If $timezone is not specified, then $timezone is the value of the implicit timezone in the evaluation context. If $srcval is the empty sequence, then the result is the empty sequence. A dynamic error is raised (invalid timezone value) if $timezone is less than -PT14H00M or greater than PT14H00M . If $srcval does not have a timezone component and $timezone is the empty sequence, then the result is $srcval . If $srcval does not have a timezone component and $timezone is not the empty sequence, then the result is $srcval with $timezone as the timezone component. If $srcval has a timezone component and $timezone is the empty sequence, then the result is $srcval without its timezone component. If $srcval has a timezone component and $timezone is not the empty sequence, then:

 
avg

Returns a value of the same type as the items in $srcval that is the average of the values (computed as sum($srcval) div count($srcval) ). If $srcval is the empty sequence, the empty sequence is returned. $srcval must contain items of a single type or one if its subtypes. Duration values must either all be xdt:yearMonthDuration values or must all be xdt:dayTimeDuration values. For numeric values, the numeric promotion rules defined in 6.2 Operators on Numeric Values are used to promote all values to a single common type. Values of type xdt:untypedAtomic are cast to the type of the other items in $srcval . If all values in $srcval are of type xdt:untypedAtomic they are converted to xs:double . In addition, the type must support addition and division by an integer. If date/time values do not have a timezone, the implicit timezone provided by the evaluation context is added and the adjusted normalized value is used in the calculation. If the above conditions are not met, then an error is raised ("Invalid argument to fn:avg() function"). If $srcval contains xs:float or xs:double values, NaN values are discarded. For detailed semantics, see section 6.2.8 of [XQuery 1.0 and XPath 2.0 Formal Semantics] .

 
base-uri

Returns the value of the base-uri property for $srcval as defined by the accessor function dm:base-uri for that kind of node in [XQuery 1.0 and XPath 2.0 Data Model] . Document, element and processing-instruction nodes have a base-uri property. If that property is non-empty, its value is returned. The base-uri of all other node types is the empty sequence. If the accessor is called on a node that does not have a base-uri property, or whose base-uri property is empty, the base-uri of that node's parent is returned. If the node has no parent, the empty sequence is returned. This version of the function returns the value of the base-uri property from the static context using the preceding rules.

External Functions that invoke this Function
Module URIFunction Name
  
xqdoc/xqdoc-displayprint-imports
print-modules
 
boolean

Computes the xs:boolean value of the sequence $srcval . If $srcval is the empty sequence, returns false . If $srcval is an atomic value, then the function returns the same value as returned by the expression cast as xs:boolean ($srcval) with the one exception described below. This exception is for compatibility with [XPath 1.0] . Specifically, it returns false if $srcval is: Otherwise, returns true .

 
ceiling

Returns a value of the same type as $srcval . Specifically, returns the smallest (closest to negative infinity) number with no fractional part that is not less than the value of $srcval . For xs:float and xs:double arguments, if the argument is positive zero (+0), then positive zero (+0) is returned. If the argument is negative zero (-0), then negative zero (-0) is returned. If the argument is less than zero (0), but greater than or equal to -0.5, then negative zero (-0) is returned. For detailed semantics, see section 6.2.6 of [XQuery 1.0 and XPath 2.0 Formal Semantics] .

 
codepoints-to-string

Creates an xs:string from a sequence of code points. Returns the zero-length string if $srcval is the empty sequence. If any of the codepoints in $srcval is not a legal XML character, an error is raised ("codepoint not legal").

 
collection

Takes a xs:string as argument and returns a sequence of nodes obtained by casting $srcval to xs:anyURI and resolving it. If $srcval is not in the lexical space of xs:anyURI , an error is raised ("Invalid URI format"). If the xs:anyURI is a relative URI, it is resolved against the value of the base-URI property from the static context. If the xs:anyURI does not resolve to a collection, then an error is raised ("Invalid argument to collection function"). This function is · stable · . For detailed semantics, see section 6.2.3 of [XQuery 1.0 and XPath 2.0 Formal Semantics] .

 
compare

Returns -1, 0, or 1, depending on whether the value of the $comparand1 is respectively less than, equal to, or greater than the value of $comparand2 , according to the rules of the collation that is used. The collation used by the invocation of this function is determined according to the rules in 7.3 Equality and Comparison of Strings . If $collationLiteral is not in the lexical space of xs:anyURI , an error is raised ("Invalid argument to compare function"). If the value of $comparand2 begins with a string that is equal to the value of $comparand1 (according to the collation that is used) and has additional characters following that beginning string, then the result is -1. If the value of $comparand1 begins with a string that is equal to the value of $comparand2 (according to the collation that is used) and has additional characters following that beginning string, then the result is 1. If either argument is the empty sequence, the result is the empty sequence. This function backs up the "eq", "ne", "gt", "lt", "le" and "ge" operators on string values.

 
concat

Accepts zero or more xs:string s as arguments. Returns the xs:string that is the concatenation of the values of its arguments. The resulting xs:string might not be normalized according to any Unicode or W3C normalization form. If called with no arguments, returns the zero-length string. If any of the arguments is the empty sequence, it is treated as the zero-length string. The concat() function is specified to allow an arbitrary number of xs:string arguments that are concatenated together. This is the only function specified in this document that has that characteristic. This capability is retained for compatibility with [XPath 1.0] .

 
contains

If $collationLiteral is not in the lexical space of xs:anyURI , an error is raised ("Invalid collationURI"). If the value of $operand1 or $operand2 is the empty sequence, the empty sequence is returned. If the value of $operand2 is the zero-length string, then the function returns true . If the value of $operand1 is the zero-length string and the value of $operand2 is not the zero-length string, then the function returns false . Otherwise, returns an xs:boolean indicating whether or not the value of $operand1 contains (at the beginning, at the end, or anywhere within) a string equal to the value of $operand2 according to the collation that is used. The collation used by the invocation of this function is determined according to the rules in 7.3 Equality and Comparison of Strings .

External Functions that invoke this Function
Module URIFunction Name
  
xqdoc/xqdoc-displayprint-comment-see
 
context-item

Returns the context item i.e. the item currently being processed. Returns the empty sequence if the context is the empty sequence.

 
count

Returns the number of items in the value of $srcval . Returns 0 if $srcval is the empty sequence.

 
current-date

Returns the xs:date (with timezone) that is current at some time during the evaluation of a query or transformation in which fn:current-date() is executed. This function is · stable · . The precise instant during the query or transformation represented by the value of fn:current-date() is · implementation dependent · . The timezone returned by fn:current-dateTime() is the value of the implicit timezone property in the evaluation context.

 
current-dateTime

Returns the xs:dateTime (with timezone) that is current at some time during the evaluation of a query or transformation in which fn:current-dateTime() is executed. This function is · stable · . The precise instant during the query or transformation represented by the value of fn:current-dateTime() is · implementation dependent · . The timezone returned by fn:current-dateTime() is the value of the implicit timezone property in the evaluation context.

 
current-time

Returns the xs:time (with timezone) that is current at some time during the evaluation of a query or transformation in which fn:current-time() is executed. This function is · stable · . The precise instant during the query or transformation represented by the value of fn:current-time() is · implementation dependent · . The timezone returned by fn:current-dateTime() is the value of the implicit timezone property in the evaluation context.

 
data

fn:data takes a sequence of items and returns a sequence of atomic values. The result of fn:data is the sequence of atomic values produced by applying the following rules to each item in $srcval :

 
deep-equal

If the sequences that are the values of $parameter1 and $parameter2 have the same values (that is, they have the same number of items and items in corresponding positions in the two sequences compare equal, the function returns true ; otherwise, the function returns false . Equality of corresponding items is determined based on the eq operator if they are atomic values and based on deep equality of nodes, as defined below, if they are nodes. Returns true if both of its arguments are the empty sequence. Returns false if one, but not both, of its arguments is the empty sequence. If equality is not defined for the types of two corresponding values the function returns false . If $collationLiteral is not in the lexical space of xs:anyURI an error is raised ("Invalid collationURI"). String values are compared using a collation. The collation used is determined according to the rules in 7.3 Equality and Comparison of Strings . If the type of the items in $parameter1 and $parameter2 is not xs:string and $collationLiteral is specified, the collation is ignored.

 
default-collation

Returns the value of the default collation property from the static context. Returns the empty sequence if the default collation is undefined.

 
distinct-nodes

Returns the sequence that results from removing from $srcval all but one of a set of nodes that have the same identity as one another, based on node identity (that is, using op:node-equal() ). The order in which the distinct nodes are returned is · implementation dependent · . If $srcval is the empty sequence, returns the empty sequence. For detailed semantics see section 6.2.2 of [XQuery 1.0 and XPath 2.0 Formal Semantics] .

 
distinct-values

Returns the sequence that results from removing from $srcval all but one of a set of values that are eq to one other. All the values must be of a single type or one if its subtypes (for numeric values, the numeric promotion rules defined in 6.2 Operators on Numeric Values are used to promote all values to a single common type). The type returned is a sequence of values of the same type as $srcval . The type must have a total order. If this condition is not satisfied, an error is raised ("Type does not have total order"). Equality must also be defined for the type. If this condition is not satisfied, an error is raised ("Type does not have equality defined"). For detailed semantics see section 6.2.2 of [XQuery 1.0 and XPath 2.0 Formal Semantics] . If $collationLiteral is not in the lexical space of xs:anyURI an error is raised ("Invalid collationURI"). If $srcval is the empty sequence, the empty sequence is returned. For xs:float and xs:double values, NaN is considered to be equal to itself and 0.0 is equal to -0.0 . If an xs:dateTime , xs:date or xs:time value does not have a timezone, an implicit timezone is provided by the evaluation context. The normalized value is adjusted using this implicit timezone if necessary. The adjusted normalized value is used to compute distinctness. If multiple adjusted normalized values compare equal but the accompanying timezones are different, it is · implementation dependent · which value is returned. Equality of string values is determined according to the collation that is used. The order of the values returned is · implementation dependent · . The collation used by the invocation of this function is determined according to the rules in 7.3 Equality and Comparison of Strings . If the type of the items in $srcval is not xs:string and $collationLiteral is specified, the collation is ignored.

 
doc

Retrieves a document using a a URI supplied as an xs:string . If $uri is not in the lexical space of xs:anyURI , an error is raised ("Invalid argument to fn:doc function"). If this is a relative URI, it is resolved relative to the value of the base URI property from the static context. The URI must not contain a fragment identifier. If $srcval is the empty sequence, the result is an empty sequence. This function is · stable · . Two calls on this function return the same document node if the same URI (after resolution to an absolute URI) is supplied to both calls. Thus, the following expression (if it does not raise an error) will always be true: If two calls on this function supply different absolute URIs, the same document node may be returned if the implementation can determine that the two URIs refer to the same resource. The default processing performed by this function is as follows. The resource identified by the URI is retrieved. If the resource cannot be retrieved, an error is raised ("Error retrieving resource"). The data resulting from the retrieval action is then parsed as an XML document and a tree is constructed in accordance with the [XQuery 1.0 and XPath 2.0 Data Model] . If the top-level media type is known and is "text", the content is parsed in the same way as if the media type were text/xml ; otherwise, it is parsed in the same way as if the media type were application/xml . If the contents cannot be parsed successfully, an error is raised ("Error parsing contents of resource"). Otherwise, the result of the function is the document node at the root of the resulting tree. Various aspects of this processing are · implementation defined · . Implementations may provide external configuration options that allow any aspect of the processing to be controlled by the user. In particular: For detailed semantics, see section 6.2.3 of [XQuery 1.0 and XPath 2.0 Formal Semantics] .

 
document-uri

Returns the value of the document-uri property for $srcval as defined by the accessor function dm:document-uri in [XQuery 1.0 and XPath 2.0 Data Model] . The empty sequence is returned if the node does not have a document-uri property or if the document-uri property is a relative URI. Otherwise, returns an absolute URI expressed as an xs:string . If the document-uri property of $srcval is not the empty sequence, then the following expression always holds:

 
empty

If the value of $srcval is the empty sequence, the function returns true ; otherwise, the function returns false .

External Functions that invoke this Function
Module URIFunction Name
  
xqdoc/xqdoc-displayget-code-html
 
ends-with

Returns an xs:boolean indicating whether or not the value of $operand1 ends with a string that is equal to the value of $operand2 according to the specified collation. If $collationLiteral is not in the lexical space of xs:anyURI , an error is raised ("Invalid collationURI"). If the value of $operand1 or $operand2 is the empty sequence, the empty sequence is returned. If the value of $operand2 is the zero-length string, then the function returns true . If the value of $operand1 is the zero-length string and the value of $operand2 is not the zero-length string, then the function returns false . The collation used by the invocation of this function is determined according to the rules in 7.3 Equality and Comparison of Strings .

 
error

In this document, as well as in [XQuery 1.0: An XML Query Language] , [XPath 2.0] ,and [XQuery 1.0 and XPath 2.0 Formal Semantics] , the phrase "an error is raised" is used whenever the semantics being described encounter an error. The occurrence of that phrase implicitly causes the invocation of the fn:error function defined in this section. Whenever the raising of an error is accompanied by a specific error, the phrase "an error is raised ( name-of-error )" is used, and the value name-of-error is passed as an argument to the fn:error function invocation. Invocation of this function causes the evaluation phase of the outermost XQuery or transformation to be terminated. For a more detailed treatment of error handing see section 2.5.1 of [XQuery 1.0: An XML Query Language] and section 6.2.1 of [XQuery 1.0 and XPath 2.0 Formal Semantics] . The fn:error function may also be invoked from XQuery and XPath 2.0 applications. The fn:error function accepts any item (e.g., an atomic value or an element) as an argument. An alternate version of the function takes no arguments. The fn:error function never returns a value. Note that "none" is a special type defined in the [XQuery 1.0 and XPath 2.0 Formal Semantics] and is not available to the user. It indicates that the function never returns and ensures that it has the correct static type.

 
escape-uri

This function applies the URI escaping rules defined in section 2 of [RFC 2396] as amended by [RFC 2732] to the string supplied as $uri-part , which typically represents all or part of a URI. The effect of the function is to replace any special character in the string by an escape sequence of the form %xx%yy..., where xxyy... is the hexadecimal representation of the octets used to represent the character in UTF-8. The set of characters that are escaped depends on the setting of the boolean argument $escape-reserved. If $escape-reserved is true , all characters are escaped other than lower case letters a-z, upper case letters A-Z, digits 0-9 and the characters referred to in [RFC 2396] as "marks": specifically, "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")". The "%" character itself is escaped only if it is not followed by two hexadecimal digits (that is, 0-9, a-f and A-F). If $escape-reserved is false , the behavior differs in that characters referred to in [RFC 2396] and [RFC 2732] as reserved characters, together with the '#' character, are not escaped. These characters are ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | "," | "#", "[", "]". [RFC 2396] does not define whether escaped URIs should use lower case or upper case for hexadecimal digits. To ensure that escaped URIs can be compared using string comparison functions, this function must always generate hexadecimal values using the upper-case letters A-F. Generally, $escape-reserved should be set to true when escaping a string that is to form a single part of a URI, and to false when escaping an entire URI or URI reference.

 
exactly-one

Returns $srcval if it contains exactly one item. Otherwise, raises an error ("fn:exactly-one called with a sequence containing zero or more than one item"). The type of the result is the type of $srcval .

 
exists

If the value of $srcval is not the empty sequence, the function returns true ; otherwise, the function returns false .

 
expanded-QName

Returns an xs:QName with the namespace URI given in $paramURI and the local name in $paramLocal . If $paramURI is the empty string, it represents "no namespace".

 
false

Returns the xs:boolean value false .

External Functions that invoke this Function
Module URIFunction Name
  
xqdoc/xqdoc-displayprint-method-detail
 
floor

Returns a value of the same type as $srcval . Specifically, returns the largest (closest to positive infinity) number with no fractional part that is not greater than the value of $srcval . For float and double arguments, if the argument is positive zero (+0), then positive zero (+0) is returned. If the argument is negative zero (-0), then negative zero (-0) is returned. For detailed semantics, see section 6.2.6 of [XQuery 1.0 and XPath 2.0 Formal Semantics] .

 
get-day-from-date

Returns an xs:integer between 1 and 31, both inclusive, representing the day component in the normalized value of $srcval . If $srcval is the empty sequence, returns the empty sequence.

 
get-day-from-dateTime

Returns an xs:integer between 1 and 31, both inclusive, representing the day component in the normalized value of $srcval . If $srcval is the empty sequence, returns the empty sequence.

 
get-days-from-dayTimeDuration

Returns an xs:integer representing the days component in the canonical lexical representation of the value of $srcval . The result may be negative. If $srcval is the empty sequence, returns the empty sequence.

 
get-hours-from-dateTime

Returns an xs:integer between 0 and 23, both inclusive, representing the hours component in the normalized value of $srcval . If $srcval is the empty sequence, returns the empty sequence.

 
get-hours-from-dayTimeDuration

Returns an xs:integer representing the hours component in the canonical lexical representation of the value of $srcval . The result may be negative. If $srcval is the empty sequence, returns the empty sequence.

 
get-hours-from-time

Returns an xs:integer between 0 and 23, both inclusive, representing the value of the hours component in the normalized value of $srcval . If $srcval is the empty sequence, returns the empty sequence.

 
get-in-scope-namespaces

Returns the prefixes of the in-scope namespaces for $element . For namespaces that have a prefix, it returns the prefix as an xs:NCName . For the default namespace, which has no prefix, it returns the zero-length string.

 
get-local-name-from-QName

Returns an xs:string representing the local part of $srcval . If $srcval is the empty sequence, returns the empty sequence.

 
get-minutes-from-dateTime

Returns an xs:integer value between 0 and 59, both inclusive, representing the minute component in the normalized value of $srcval . If $srcval is the empty sequence, returns the empty sequence.

 
get-minutes-from-dayTimeDuration

Returns an xs:integer representing the minutes component in the canonical lexical representation of the value of $srcval . The result may be negative. If $srcval is the empty sequence, returns the empty sequence.

 
get-minutes-from-time

Returns an xs:integer value between 0 to 59, both inclusive, representing the value of the minutes component in the normalized value of $srcval . If $srcval is the empty sequence, returns the empty sequence.

 
get-month-from-date

Returns an xs:integer between 1 and 12, both inclusive, representing the month component in the normalized value of $srcval . If $srcval is the empty sequence, returns the empty sequence.

 
get-month-from-dateTime

Returns an xs:integer between 1 and 12, both inclusive, representing the month component in the normalized value of $srcval . If $srcval is the empty sequence, returns the empty sequence.

 
get-months-from-yearMonthDuration

Returns an xs:integer representing the months component in the canonical lexical representation of the value of $srcval . The result may be negative. If $srcval is the empty sequence, returns the empty sequence.

 
get-namespace-from-QName

Returns the namespace URI for $srcval as an xs:string . If $srcval is the empty sequence, the empty sequence is returned. If $srcval is in no namespace, the empty sequence is returned.

 
get-namespace-uri-for-prefix

Returns the namespace URI of one of the in-scope namespaces for $element , identified by its namespace prefix. If $element has an in-scope namespace whose namespace prefix is equal to $prefix , it returns the namespace URI of that namespace. If $prefix is the zero-length string, it returns the namespace URI of the default (unnamed) namespace. Otherwise, it returns the empty sequence. Prefixes are equal only if their Unicode code-points match exactly.

 
get-seconds-from-dateTime

Returns an xs:decimal value between 0 and 60.999..., both inclusive representing the seconds and fractional seconds in the normalized value of $srcval . Note that the value can be greater than 60 seconds to accomodate occasional leap seconds used to keep human time synchronized with the rotation of the planet. If $srcval is the empty sequence, returns the empty sequence.

 
get-seconds-from-dayTimeDuration

Returns an xs:decimal representing the seconds component in the canonical lexical representation of the value of $srcval . The result may be negative. If $srcval is the empty sequence, returns the empty sequence.

 
get-seconds-from-time

Returns an xs:decimal value between 0 and 60.999..., both inclusive, representing the seconds and fractional seconds in the normalized value of $srcval . Note that the value can be greater than 60 seconds to accomodate occassional leap seconds used to keep human time synchronized with the rotation of the planet. If $srcval is the empty sequence, returns the empty sequence.

 
get-timezone-from-date

Returns the timezone component in the normalized value of $srcval . The result is an xdt:dayTimeDuration that indicates deviation from UTC; its value may range from +14:00 to -14:00 hours, both inclusive. If $srcval is the empty sequence, returns the empty sequence.

 
get-timezone-from-dateTime

Returns the timezone component of $srcval . The result is an xdt:dayTimeDuration that indicates deviation from UTC; its value may range from +14:00 to -14:00 hours, both inclusive. If $srcval is the empty sequence, returns the empty sequence.

 
get-timezone-from-time

Returns an xdt:dayTimeDuration representing the timezone component of $srcval . The result is a xdt:dayTimeDuration that indicates deviation from UTC; its value may range from +14:00 to -14:00 hours, both inclusive. If $srcval is the empty sequence, returns the empty sequence.

 
get-year-from-date

Returns an xs:integer representing the year in the normalized value of $srcval . The value may be negative. If $srcval is the empty sequence, returns the empty sequence.

 
get-year-from-dateTime

Returns an xs:integer representing the year component in the normalized value of $srcval . The result may be negative. If $srcval is the empty sequence, returns the empty sequence.

 
get-years-from-yearMonthDuration

Returns an xs:integer representing the years component in the canonical lexical representation of the value of $srcval . The result may be negative. If $srcval is the empty sequence, returns the empty sequence.

 
id

Returns the sequence of element nodes with ID values matching the values of one or more of the IDREF values supplied in $srcval . Each string in $srcval is parsed as if it were of type xs:IDREFS , that is, $srcval is treated as a space-separated sequence of tokens, each acting as an IDREF. These tokens are then included in the list of candidate IDREFs. After this substitution, the sequence must consist entirely of IDREF values. If any of the tokens is not a lexically-valid IDREF (that is, if it is not lexically an xs:NCName ), it is ignored. The result of the function is a sequence, in document order, of those elements that are in the same document as the context node, and that have an ID value equal to one or more of the IDREFs in the list of candidate IDREFs. An element has an ID value of V if it has an attribute whose type is xs:ID and whose value is V, or if the element itself is of (simple) type xs:ID and has a value of V. An ID value matches a candidate IDREF if they consist of the same sequence of Unicode code-points. The default collation is not used in the comparison. If there is no context node (that is, if there is no context item, or if the context item is not a node), an error is raised ("No context node"). No error is raised in respect of an IDREF value that does not match the ID of any element in the document. If no IDREF value matches any element, the function returns the empty sequence. If the source document is well-formed but not valid, it is possible for two or more elements to have the same ID value. In this situation, the function will select the first such element. It is also possible in a well-formed but invalid document to have an attribute that has a declared type of ID, but whose value does not conform to the lexical rules for an ID. Such an element will never be selected by this function.

 
idref

Returns the nodes that have IDREF values that reference one or more of the ID values specified in $srcval . Each string in $srcval is parsed as if it were of lexically of type xs:ID , that is, $srcval is treated as a space-separated sequence of tokens, each acting as an ID. These tokens are then included in the list of candidate IDs. After this substitution, the sequence must consist entirely of ID values. If any of the tokens is not a lexically-valid ID (that is, if it is not lexically an xs:NCName ), it is ignored. A node references an ID value if the element or attribute itself is of type xs:IDREF or xs:IDREFS . If the node is of type xs:IDREF then its value must match one of the ID values in $srcval . If it is of type xs:IDREFS then one of the values in the IDREFS sequence must match one of the values in $srcval . An IDREF value matches a candidate ID if they consist of the same sequence of Unicode code-points. The default collation is not used in the comparison. This function allows reverse navigation from IDs to IDREFs. The resulting element nodes are returned in document order, without duplicates. The nodes that are returned all belong to the document containing the context node. If there is no context node (that is, if there is no context item, or if the context item is not a node), then an error is raised ("No context node").

 
implicit-timezone

Returns the value of the implicit timezone property from the evaluation context. Returns the empty sequence if the implicit timezone is undefined.

 
index-of

Informally, the function returns a sequence of positive integers giving the positions within the sequence $seqParam of items that are equal to $srchParam . If $collationLiteral is not in the lexical space of xs:anyURI an error is raised ("Invalid collationURI"). The collation used by the invocation of this function is determined according to the rules in 7.3 Equality and Comparison of Strings . The items in the sequence $seqParam are compared with $srchParam under the rules for the eq operator, using the selected collation when comparing strings. If the type of the items in $seqParam is not xs:string and $collationLiteral is specified, the collation is ignored. If an item compares equal, then the position of that item in the sequence $srchParam is included in the result. If the items are not comparable, then an error is raised ("Items not comparable"). If the value of $seqParam is the empty sequence, or if no item in $seqParam matches $srchParam , then the empty sequence is returned. The first item in a sequence is at position 1, not position 0. The result sequence is in ascending numeric order.

External Functions that invoke this Function
Module URIFunction Name
  
xqdoc/xqdoc-displaybuild-link
 
input

Returns the input sequence. If no input sequence has been assigned, then an error is raised ("No input sequence"). The means by which an input sequence is assigned depends on the environment. This function is · stable · .

 
insert-before

Returns a new sequence constructed from the value of $target with the value of $inserts inserted at the position specified by the value of $position . (The value of $target is not affected by the sequence construction.) If N is less than one (1), the first position, the effective value of N is one (1). If N is greater than the number of items in $target , then the effective value of N is equal to the number of items in $target plus 1. The value returned by the function consists of all items of $target whose index is less than or equal to N , followed by all items of $inserts , followed by the remaining elements of $target , in that sequence. If $target is the empty sequence, a copy of $inserts is returned. If $inserts is the empty sequence, a copy of $target is returned.

 
item-at

Returns the item in $seqParam that is located at the index that is the value of $posParam . The return type is the type of the item returned. If $seqParam is the empty sequence, returns the empty sequence. If the value of $posParam is greater than the number of items in the sequence, or is less than or equal to zero (0), then an error is raised ("Invalid position"). This function is used in the definition of the formal semantics of filter expressions; that is, expressions of the form expression-1[expression-2] . See [XQuery 1.0 and XPath 2.0 Formal Semantics]

 
lang

Returns true or false depending on whether the language of the context node, as defined using the xml:lang attribute, is the same as, or a sublanguage of, the language specified by $testlang . If there is no context node (that is, if there is no context item, or if the context item is not a node), false is returned. The relevant xml:lang attribute is determined by the value of the XPath expression: (ancestor-or-self::*/@xml:lang)[last()] If this expression returns an empty sequence, the function returns false . Otherwise, the function returns true if and only if the string-value of the relevant xml:lang attribute is equal to $testlang ignoring case, or if the string-value of the relevant testlang attribute contains some hyphen (-) such that the part of the string-value preceding that hyphen is equal to $testlang , ignoring case.

 
last

Returns an xs:integer indicating the number of items in the sequence of items currently being processed. Returns the empty sequence if the context is the empty sequence.

 
local-name

Returns the local part of the name of $srcval as an xs:string that will either be the zero-length string or will have the lexical form of an xs:NCName . If the argument is omitted, it defaults to the context node. If there is no context node (that is, if there is no context item, or if the context item is not a node), the zero-length string is returned. If the argument is supplied and is the empty sequence, the function returns the zero-length string. If the target node has no name (that is, if it is a document node, a comment, or a text node), the function returns the zero-length string. Otherwise, the value returned will be the local part of the expanded-QName of the target node (as determined by the name accessor in the data model). This will be an xs:string whose lexical form is an xs:NCName .

 
lower-case

If the value of $srcval is the empty sequence, returns the empty sequence. Otherwise, returns the value of $srcval after translating every upper-case letter to its lower-case correspondent. Every upper-case letter that does not have a lower-case correspondent, and every character that is not an upper-case letter, is included in the returned value in its original form. An "upper-case letter" is a character whose Unicode General Category class includes "Lu". The corresponding lower-case letter is determined using [Unicode Case Mappings] .

 
matches

The effect of calling the first version of this function (omitting the argument $flags ) is the same as the effect of calling the second version with the $flags argument set to a zero-length string. If $input is the empty sequence, the result is the empty sequence. The function returns true if $input matches the regular expression supplied as $pattern ; otherwise, it returns false. Unless the metacharacters ^ and $ are used as anchors, the string is considered to match the pattern if any substring matches the pattern. But if anchors are used, the anchors must match the start/end of the string (in string mode), or the start/end of a line (in multiline mode). An error is raised ("Invalid regular expression") if the value of $pattern is invalid according to the rules described in section 7.5.1 Regular Expression Syntax . An error is raised ("Invalid regular expression flags") if the value of $flags is invalid according to the rules described in section 7.5.1 Regular Expression Syntax .

 
max

fn:max returns a value of the same type as the items in $srcval that is the item in the value in $srcval whose value is greater than or equal to the value of every other item in the value of $srcval . If there are two or more such items, then the specific item whose value is returned is · implementation dependent · . If $srcval is the empty sequence, the empty sequence is returned. If $collationLiteral is not in the lexical space of xs:anyURI , an error is raised ("Invalid collationURI"). $srcval must contain only items of a single type or one if its subtypes for which the gt operator is defined. For numeric values, the numeric promotion rules defined in 6.2 Operators on Numeric Values are used to promote all values to a single common type. Values of type xdt:untypedAtomic are cast to the type of the other items in $srcval . If all values in $srcval are of type xdt:untypedAtomic they are converted to xs:string . In addition, the values in the sequence must have a total order. If date/time values do not have a timezone, the implicit timezone provided by the evaluation context is added and the adjusted normalized value is used in the calculation. Duration values must either all be xdt:yearMonthDuration values or must all be xdt:dayTimeDuration values. If any of these conditions is not met, then an error is raised ("Invalid argument to fn:max() function"). If $srcval contains xs:float or xs:double values, NaN values are discarded. For xs:dateTime , xs:date or xs:time values with the same (adjusted) normalized value and different timezones, the value returned is · implementation dependent · . The value returned by fn:max($srcval) is equivalent to the value returned by the following XQuery expression. If the items in the value of $srcval are strings, then the determination of the greatest item is made according to the collation that is used. The collation used by the invocation of this function is determined according to the rules in 7.3 Equality and Comparison of Strings . If the type of the items in $srcval is not xs:string and $collationLiteral is specified, the collation is ignored. The value returned by fn:max($srcval, $collationLiteral) is equivalent to the value returned by the following XQuery expression. For detailed semantics, see section 6.2.8 of [XQuery 1.0 and XPath 2.0 Formal Semantics] .

 
min

fn:min returns a value of the same type as the items in $srcval that is the item in the value in $srcval whose value is less than or equal to the value of every other item in the value of $srcval . If there are two or more such items, then the specific item whose value is returned is · implementation dependent · . If $srcval is the empty sequence, the empty sequence is returned. If $collationLiteral is not in the lexical space of xs:anyURI an error is raised ("Invalid collationURI"). $srcval must contain only items of a single type or one if its subtypes for which the gt operator is defined. For numeric values, the numeric promotion rules defined in 6.2 Operators on Numeric Values are used to promote all values to a single common type. Values of type xdt:untypedAtomic are cast to the type of the other items in $srcval . If all values in $srcval are of type xdt:untypedAtomic they are converted to xs:string . In addition, the values in the sequence must have a total order. If date/time values do not have a timezone, the implicit timezone provided by the evaluation context is added and the adjusted normalized value is used in the calculation. Duration values must either all be yearMonthDuration values or must all be dayTimeDuration values. If any of these conditions is not met, then an error is raised ("Invalid argument to fn:min() function"). If $srcval contains xs:float or xs:double values, NaN values are discarded. For xs:dateTime , xs:date or xs:time values with the same (adjusted) normalized value and different timezones, the value returned is · implementation dependent · . The value returned by fn:min($srcval) is equivalent to the value returned by the following XQuery expression. If the items in the value of $srcval are strings, then the determination of the least item is made according to the collation that is used. The collation used by the invocation of this function is determined according to the rules in 7.3 Equality and Comparison of Strings . If the type of the items in $srcval is not xs:string and $collationLiteral is specified, the collation is ignored. The value returned by fn:min($srcval, $collationLiteral) is equivalent to the value returned by the following XQuery expression. For detailed semantics, see section 6.2.8 of [XQuery 1.0 and XPath 2.0 Formal Semantics] .

 
name

Returns the name of a node, as an xs:string that is either the zero-length string, or has the lexical form of an xs:QName . If the argument is omitted, it defaults to the context node. If there is no context node (that is, if there is no context item, or if the context item is not a node), the zero-length string is returned. If the argument is supplied and is the empty sequence, the function returns the zero-length string. If the target node has no name (that is, if it is a document node, a comment, a text node, or a namespace node having no name), the function returns the zero-length string. Otherwise, the value returned is an xs:string whose lexical form is an xs:QName . If $srcval is a processing instruction or a namespace node, or if it is an element or attribute node whose expanded-QName (as determined by the dm:node-name accessor in the [XQuery 1.0 and XPath 2.0 Data Model] ) is in no namespace, then the function returns the local part of the expanded-QName. If $srcval is an element or attribute whose expanded-QName is in a namespace, then a prefix is determined using the same rules as those for determining the prefix property when the element or attribute node is mapped to an element or attribute information item in the InfoSet. These rules are given in [XQuery 1.0 and XPath 2.0 Data Model] . This prefix is then combined with the local part of the node's expanded-QName to form a string which will take one of the forms "prefix:local-part" (if the prefix is a non-zero length string) or "local-part" (if the prefix is a zero-length string).

 
namespace-uri

Returns the namespace URI of the QName of $srcval as a, xs:string . If the argument is omitted, it defaults to the context node. If there is no context node (that is, if there is no context item, or if the context item is not a node), the zero-length string is returned. If $srcval is the empty sequence, the zero-length string is returned. If $srcval is neither an element nor an attribute node, or if it is an element or attribute node that has no QName or whose expanded-QName (as determined by the dm:name accessor in the [XQuery 1.0 and XPath 2.0 Data Model] ) is in no namespace, then the function returns the zero-length string.

 
node-kind

This function returns a xs:string representing the node's kind: either "document", "element", "attribute", "text", "namespace", "processing-instruction", or "comment".

 
node-name

This function returns an expanded-QName for node kinds that can have names. For other node kinds, it returns the empty sequence. Expanded-QName is defined in [XQuery 1.0 and XPath 2.0 Data Model] , and consists of a pair of values: a namespace URI and a local name.

 
normalize-space

Returns the value of $srcval with whitespace normalized by stripping leading and trailing whitespace and replacing sequences of more than one whitespace character by a single space, #x20 . If the value of $srcval is the empty sequence, returns the empty sequence. If no argument is supplied, $srcval defaults to the string value (calculated using fn:string() ) of the context item ( . ).

External Functions that invoke this Function
Module URIFunction Name
  
xqdoc/xqdoc-displayget-function-names
print-comment-param
print-comment-see
print-method-detail
print-method-summary
print-signature
 
normalize-unicode

If the value of $srcval is the empty sequence, returns the empty sequence. Otherwise, returns the value of $srcval normalized according to the normalization criteria for a normalization form identified by the value of $normalizationForm . The effective value of the $normalizationForm is computed by removing leading and trailing blanks, if present, and converting to upper case. If the $normalizationForm is absent, as in the first format above, it shall be assumed to be "NFC" Conforming implementations · must · support normalization form "NFC" and · may · support normalization forms "NFD", "NFKC", "NFKD", "W3C" or other normalization forms. If the effective value of the $normalizationForm is other than one of the values supported by the implementation, then an error is raised ("Unsupported normalization form").

 
not

$srcval is first reduced to an effective boolean value by applying the fn:boolean() function. Returns true if the effective boolean value is false , and false if the effective boolean value is true .

External Functions that invoke this Function
Module URIFunction Name
  
xqdoc/xqdoc-displayprint-comment
print-comment-see
 
number

Returns the value indicated by $srcval or, if $srcval is not specified, the context node, converted to an xs:double . If there is no context node (that is, if there is no context item, or if the context item is not a node), NaN is returned. If the conversion to xs:double fails because the lexical representation is not a valid lexical representation of a numeric simple type as defined in [XML Schema Part 2: Datatypes] , returns the xs:double value NaN .

 
one-or-more

Returns $srcval if it contains one or more items. Otherwise, raises an error ("fn:one-or-more called with a sequence containing zero items"). The type of the result is the type of $srcval .

 
position

Returns an xs:integer indicating the position of the context item within the sequence of items currently being processed. Returns the empty sequence if the context is the empty sequence.

 
remove

Returns a new sequence constructed from the value of $target with the item at the position specified by the value of $position removed. If N is less than 1 or greater than the number of items in $target , no action is taken. Otherwise, the value returned by the function consists of all items of $target whose index is less than N , followed by all items of $target whose index is greater than N . If $target is the empty sequence, the empty sequence is returned. For detailed semantics, see section 6.2.7 of [XQuery 1.0 and XPath 2.0 Formal Semantics] .

 
replace

The effect of calling the first version of this function (omitting the argument $flags ) is the same as the effect of calling the second version with the $flags argument set to a zero-length string. The $flags argument is interpreted in the same manner as for the fn:matches() function. If $input is the empty sequence, the result is the empty sequence. The function returns the xs:string that is obtained by replacing all non-overlapping substrings of $input that match the given $pattern with an occurrence of the $replacement string. If two overlapping substrings of $input both match the $pattern , then only the first one (that is, the one whose first character comes first in the $input string) is replaced. Within the $replacement string, the variables $1 to $9 may be used to refer to the substring captured by each of the first nine parenthesized sub-expressions in the regular expression. A literal $ symbol must be written as \$ . For each match of the pattern, these variables are assigned the value of the content of the relevant captured sub-expression, and the modified replacement string is then substituted for the characters in $input that matched the pattern. If a variable $n is present in the replacement string, but there is no n th captured substring (which may happen because there were fewer than n parenthesized sub-expressions, or because the n th parenthesized sub-expression was not matched) then the variable is replaced by a zero-length string. If two alternatives within the pattern both match at the same position in the $input , then the match that is chosen is the one matched by the first alternative. For example: An error is raised ("Invalid regular expression") if the value of $pattern is invalid according to the rules described in section 7.5.1 Regular Expression Syntax . An error is raised ("Invalid regular expression flags") if the value of $flags is invalid according to the rules described in section 7.5.1 Regular Expression Syntax . An error is raised ("Regular expression matches zero-length string") if the pattern matches a zero-length string. It is not an error, however, if a captured substring is zero-length. An error is raised ("Invalid replacement string") if the value of $replacement contains a " $ " character that is not immediately followed by a digit 1-9 and not immediately preceded by a "/". An error is raised ("Invalid replacement string") if the value of $replacement contains a " \ " character that is not part of a " \\ " pair, unless it is immediately followed by a " $ " character.

External Functions that invoke this Function
Module URIFunction Name
  
xqdoc/xqdoc-displaydecode-uri
 
resolve-QName

Returns an xs:QName value (that is, an expanded QName) by taking an xs:string that has the lexical form of an xs:QName (a string in the form "prefix:local-name" or "local-name") and resolving it using the in-scope namespaces for a given element. More specifically, the function searches the namespace nodes of $element for a node whose name matches the prefix of $qname , or the zero-length string if it has no prefix, and constructs an expanded QName whose local name is taken from the supplied $qname , and whose namespace URI is taken from the string value of the namespace node. If the $qname has a prefix and if there is no namespace node for $element that matches this prefix, then an error is raised ("no namespace found for prefix"). If the $qname has no prefix, and there is no unnamed namespace node for $element , then the resulting expanded QName has no namespace part.

 
resolve-uri

The second form of this function expects $base to be an absolute URI and $relative to be a relative URI. It resolves the relative URI $relative against the base-uri $base and returns the resulting absolute URI. If $relative is an absolute URI, it is returned unchanged. If $base is not an absolute URI, a error is raised ("Relative URI base argument to resolve-uri"). If $relative or $base is not in the lexical space of xs:anyURI an error is raised ("Invalid argument to resolve-uri"). The first form of this function resolves the relative URI $relative against the value of the base-uri property from the static context. If $relative is an absolute URI, it is returned unchanged. If the base-uri property is not initialized in the static context an error is raised ("Base uri undefined in the static context"). If the $relativeURI is the zero-length string, returns the value of the base-uri property from the static context in the first form and $base in the second form.

 
root

Returns the root of the tree to which $srcval belongs. This will usually, but not necessarily, be a document node. If $srcval is a document node, it is returned. If the function is called without an argument, the context item is used as the default argument. If there is no context node (that is, if there is no context item, or if the context item is not a node), an error is raised ("Context item is not a node").

 
round

Returns a value of the same type as $srcval . Specifically, returns the number with no fractional part that is closest to the argument. If there are two such numbers, then the one that is closest to positive infinity is returned. More formally, fn:round(x) produces the same result as fn:floor(x+0.5) . For xs:float and xs:double arguments, if the argument is positive zero (+0), then positive zero (+0) is returned. If the argument is negative zero (-0), then negative zero (-0) is returned. If the argument is less than zero (0), but greater than or equal to -0.5, then negative zero (-0) is returned. For detailed semantics, see section 6.2.6 of [XQuery 1.0 and XPath 2.0 Formal Semantics] .

 
round-half-to-even

The first signature of this function produces the same result as the second signature with $precision=0 . Returns a value of the same type as $srcval . For arguments of type xs:float and xs:double , if the argument is positive zero (+0), then positive zero (+0) is returned. If the argument is negative zero (-0), then negative zero (-0) is returned. The value returned is the nearest (that is, numerically closest) numeric to $srcval that is a multiple of ten to the power of minus $precision . If two such values are equally near (i.e. if the fractional part in $srcval is exactly .500...), returns the one whose least significant digit is even. If $srcval is of type xs:float or xs:double , rounding occurs on the value of the mantissa computed with exponent = 0. For detailed semantics, see section 6.2.6 of [XQuery 1.0 and XPath 2.0 Formal Semantics] .

 
sequence-node-identical

Returns the empty sequence if one or both of its arguments is the empty sequence. If the sequences that are the values of $parameter1 and $parameter2 are identical, that is, they contain the same number of nodes and the nodes in corresponding positions in the two sequences are identical, then the function returns true ; otherwise, the function returns false .

 
starts-with

Returns an xs:boolean indicating whether or not the value of $operand1 starts with a string that is equal to the value of $operand2 according to the collation that is used. If $collationLiteral is not in the lexical space of xs:anyURI , an error is raised ("Invalid collationURI"). If the value of $operand1 or $operand2 is the empty sequence, the empty sequence is returned. If the value of $operand2 is the zero-length string, then the function returns true . If the value of $operand1 is the zero-length string and the value of $operand2 is not the zero-length string, then the function returns false . The collation used by the invocation of this function is determined according to the rules in 7.3 Equality and Comparison of Strings .

External Functions that invoke this Function
Module URIFunction Name
  
xqdoc/xqdoc-displayprint-comment-see
 
string

Returns the value of $srcval represented as a xs:string . If no argument is supplied, $srcval defaults to the context item ( . ). If $srcval is the empty sequence, the zero-length string is returned. If $srcval is a node, the function returns the string-value of the node, as obtained using the string-value accessor defined in the [XQuery 1.0 and XPath 2.0 Data Model] . If $srcval is an atomic value, then the function returns the same string as is returned by the expression cast as xs:string ($srcval) , except in the cases listed below:

External Functions that invoke this Function
Module URIFunction Name
  
xqdoc/xqdoc-displayprint-modules
 
string-join

Returns a (possibly empty) xs:string created by concatenating the members of the $operand1 sequence using $operand2 as a separator. If the value of $operand2 is the zero-length string, then the members of $operand1 are concatenated without a separator as in fn:concat() . If the value of $operand1 is the empty sequence, the zero-length string is returned.

 
string-length

Returns an xs:integer equal to the length in characters of the value of $srcval . If the value of $srcval is the empty sequence, the empty sequence is returned. If no argument is supplied, $srcval defaults to the string value (calculated using fn:string() ) of the context item ( . ).

External Functions that invoke this Function
Module URIFunction Name
  
xqdoc/xqdoc-displayprint-comment-param
print-comment-see
 
string-pad

If the value of $padString is the empty sequence, returns the empty sequence. Otherwise, returns an xs:string consisting of $padCount copies of $padString concatenated together without any separators. Returns the zero-length string if $padCount is zero (0). If the value of $padCount is less than zero (0), an error is raised ("Invalid string-pad count").

 
string-to-codepoints

Returns the sequence of code points that constitute an xs:string . If $srcval is a zero-length string, the empty sequence is returned.

 
subsequence

If $sourceSeq is the empty sequence, returns the empty sequence. Returns the contiguous sequence of items in the value of $sourceSeq beginning at the position indicated by the value of $startingLoc and continuing for the number of items indicated by the value of $length . More specifically, returns the items in $sourceString whose position $p obeys: fn:round($startingLoc) <= $p < fn:round($startingLoc) + fn:round($length) In the above computation, the rules for op:numeric-less-than() and op:numeric-greater-than() apply. If $startingLoc is zero or negative, the subsequence includes items from the beginning of the $sourceSeq . If $length is not specified, the subsequence includes items to the end of $sourceSeq . If $length is greater than the number of items in the value of $sourceSeq following $startingLoc , the subsequence includes items to the end of $sourceSeq . The first item of a sequence is located at position 1, not position 0. For detailed semantics, see section 6.2.7 of [XQuery 1.0 and XPath 2.0 Formal Semantics] .

 
substring

If the value of $sourceString is the empty sequence, the empty sequence is returned. Otherwise, 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 . More specifically, returns the characters in $sourceString whose position $p obeys: fn:round($startingLoc) <= $p < fn:round($startingLoc) + fn:round($length) In the above computation, the rules for op:numeric-less-than() and op:numeric-greater-than() apply. If $startingLoc is zero or negative, the substring includes characters from the beginning of the $sourceString . If $length is not specified, the substring includes characters to the end of $sourceString . If $length is greater than the number of characters in the value of $sourceString following $startingLoc , the substring includes characters to the end of $sourceString . The first character of a string is located at position 1, not position 0.

 
substring-after

Returns the substring of the value of $operand1 that follows in the value of $operand1 the first occurrence of a string that is equal to the value of $operand2 according to the collation that is used. If $collationLiteral is not in the lexical space of xs:anyURI an error is raised ("Invalid collationURI"). If the value of $operand1 or $operand2 is the empty sequence, returns the empty sequence. If the value of $operand2 is the zero-length string, then the function returns the value of $operand1 . If the value of $operand1 does not contain a string that is equal to the value of $operand2 , then the function returns the zero-length string. The collation used by the invocation of this function is determined according to the rules in 7.3 Equality and Comparison of Strings .

External Functions that invoke this Function
Module URIFunction Name
  
xqdoc/xqdoc-displayprint-comment-param
print-signature
 
substring-before

Returns the substring of the value of $operand1 that precedes in the value of $operand1 the first occurrence of a string that is equal to the value of $operand2 according to the collation that is used. If $collationLiteral is not in the lexical space of xs:anyURI an error is raised ("Invalid collationURI"). If the value of $operand1 or $operand2 is the empty sequence, returns the empty sequence. If the value of $operand2 is the zero-length string, then the function returns the value of $operand1 . If the value of $operand1 does not contain a string that is equal to the value of $operand2 , then the function returns the zero-length string. The collation used by the invocation of this function is determined according to the rules in 7.3 Equality and Comparison of Strings .

External Functions that invoke this Function
Module URIFunction Name
  
xqdoc/xqdoc-displayprint-comment-param
print-method-summary
 
subtract-dateTimes-yielding-dayTimeDuration

Returns the xdt:dayTimeDuration that corresponds to the difference between the normalized value of $srcval1 and the normalized value of $srcval2 . If either argument is the empty sequence, returns the empty sequence. If the normalized value of $srcval1 precedes in time the normalized value of $srcval2 , then the returned value is a negative duration.

 
subtract-dateTimes-yielding-yearMonthDuration

Returns the xdt:yearMonthDuration that corresponds to the difference between the normalized value of $srcval1 and the normalized value of $srcval2 . If either argument is the empty sequence, returns the empty sequence. If the normalized value of $srcval1 precedes in time the normalized value of $srcval2 , the returned value is a negative duration. In general, the difference between two xs:dateTime values will be a duration that contains years and months as well as days, hours, etc. In fact, it can be looked at as an xdt:yearMonthDuration plus an xdt:dayTimeDuration . This function returns the result rounded to contain only years and months. The calculation is as follows: first the duration is calculated as the value of an xdt:dayTimeDuration in seconds. Then, starting from $srcval2 , the maximum number of months in the duration are calculated. If there is a remaining number of days, they are discarded.

 
sum

Returns a value of the same type as the items in $srcval which is the sum of the values. If $srcval is the empty sequence, then the value 0.0E0 of type xs:double is returned. $srcval must contain items of a single type or one of its subtypes. For numeric values, the numeric promotion rules defined in 6.2 Operators on Numeric Values are used to promote all values to a single common type. Values of type xdt:untypedAtomic are cast to the type of the other items in $srcval . If all values in $srcval are of type xdt:untypedAtomic they are converted to xs:double . In addition, the type must support addition. Duration values must either all be xdt:yearMonthDuration values or must all be xdt:dayTimeDuration values. If the above conditions are not met, an error is raised ("Invalid argument to fn:sum() function"). If $srcval contains xs:float or xs:double values, NaN values are discarded. For detailed semantics, see section 6.2.8 of [XQuery 1.0 and XPath 2.0 Formal Semantics] .

 
tokenize

The effect of calling the first version of this function (omitting the argument $flags ) is the same as the effect of calling the second version with the $flags argument set to a zero-length string. This function breaks the $input string into a sequence of strings, treating any substring that matches $pattern as a separator. The separators themselves are not returned. The $flags argument is interpreted in the same way as for the fn:matches() function. If $input is the empty sequence, the result is the empty sequence. If the supplied $pattern matches a zero-length string, the fn:tokenize() function breaks the string into its component characters. The n th character in the $input string becomes the n th string in the result sequence; each string in the result sequence has a string length of one. If a separator occurs at the start of the $input string, the result sequence will start with a zero-length string. Zero-length strings will also occur in the result sequence if a separator occurs at the end of the $input string, or if two adjacent substrings match the supplied $pattern . If two alternatives within the supplied $pattern both match at the same position in the $input string, then the match that is chosen is the first. For example: An error is raised ("Invalid regular expression") if the value of $pattern is invalid according to the rules described in section 7.5.1 Regular Expression Syntax . An error is raised ("Invalid regular expression flags") if the value of $flags is invalid according to the rules described in section 7.5.1 Regular Expression Syntax .

External Functions that invoke this Function
Module URIFunction Name
  
xqdoc/xqdoc-displayprint-comment-see
print-preserve-newlines
print-signature
 
trace

This function is intended to be used in debugging queries by providing a trace of their execution. The input $value is returned, unchanged, as the result of the function. In addition, the inputs $value and $label are directed to a trace data set. The location and format of the trace data set are · implementation defined · . The ordering of output from invocations of the fn:trace() function is · implementation defined · .

 
translate

If the value of $srcval , $mapString or $transString is the empty sequence, returns the empty sequence. Otherwise, returns the value of $srcval modified so that every character in the value of $srcval that occurs at some position N in the value of $mapString has been replaced by the character that occurs at position N in the value of $transString . Every character in the value of $srcval that does not appear in the value of $mapString is unchanged. Every character in the value of $srcval that appears at some position M in the value of $mapString , where the value of $transString is less than M characters in length, is omitted from the returned value. If the value of $srcval , $mapString or $transString is the empty sequence, returns the empty sequence.

 
true

Returns the xs:boolean value true .

External Functions that invoke this Function
Module URIFunction Name
  
xqdoc/xqdoc-displaybuild-link
print-method-summary
 
unordered

This function takes a sequence or more typically, an expression, that evaluates to a sequence, and indicates that the result sequence may be returned in any order.

 
upper-case

If the value of $srcval is the empty sequence, returns the empty sequence. Otherwise, returns the value of $srcval after translating every lower-case letter to its upper-case correspondent. Every lower-case letter that does not have an upper-case correspondent, and every character that is not a lower-case letter, is included in the returned value in its original form. A "lower-case letter" is a character whose Unicode General Category class includes "Ll". The corresponding upper-case letter is determined using [Unicode Case Mappings] .

 
zero-or-one

Returns $srcval if it contains zero or one items. Otherwise, raises an error ("fn:zero-or-one called with a sequence containing more than one item"). The type of the result is the type of $srcval .

 
 
Created by xqDoc version N/A on 2005-07-21T14:29:56.175-04:00