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