← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/xpath_doc into lp:zorba

 

William Candillon has proposed merging lp:~zorba-coders/zorba/xpath_doc into lp:zorba.

Commit message:
Update the XPath module documentation.

Requested reviews:
  William Candillon (wcandillon)
  Sorin Marian Nasoi (sorin.marian.nasoi)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/xpath_doc/+merge/126681

Update the XPath module documentation.
-- 
The attached diff has been truncated due to its size.
https://code.launchpad.net/~zorba-coders/zorba/xpath_doc/+merge/126681
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'modules/w3c/xpath_functions.xq'
--- modules/w3c/xpath_functions.xq	2012-09-17 00:36:37 +0000
+++ modules/w3c/xpath_functions.xq	2012-09-27 13:19:22 +0000
@@ -21,1038 +21,17659 @@
  :
  : @author www.w3c.org
  : @see http://www.w3.org/TR/xpath-functions-30/
- : @project www.w3.org/2005
+ : @project W3C/XPath Functions
  :
  :)
 module namespace fn = "http://www.w3.org/2005/xpath-functions";;
 
 (:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-QName";>fn:QName</a>
- :)
-declare function fn:QName($paramURI as xs:string?, $paramQName as xs:string) as xs:QName external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-abs";>fn:abs</a>
- :)
-declare function fn:abs($arg as numeric?) as numeric? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-adjust-date-to-timezone";>fn:adjust-date-to-timezone</a>
- :)
-declare function fn:adjust-date-to-timezone($arg as xs:date?) as xs:date? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-adjust-date-to-timezone";>fn:adjust-date-to-timezone</a>
- :)
-declare function fn:adjust-date-to-timezone( $arg as xs:date?, $timezone as xs:dayTimeDuration?) as xs:date? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-adjust-dateTime-to-timezone";>fn:adjust-dateTime-to-timezone</a>
- :)
-declare function fn:adjust-dateTime-to-timezone($arg as xs:dateTime?) as xs:dateTime external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-adjust-dateTime-to-timezone";>fn:adjust-dateTime-to-timezone</a>
- :)
-declare function fn:adjust-dateTime-to-timezone( $arg as xs:dateTime?, $timezone as xs:dayTimeDuration?) as xs:dateTime external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-adjust-time-to-timezone";>fn:adjust-time-to-timezone</a>
- :)
-declare function fn:adjust-time-to-timezone($arg as xs:time?) as xs:time? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-adjust-time-to-timezone";>fn:adjust-time-to-timezone</a>
- :)
-declare function fn:adjust-time-to-timezone( $arg as xs:time?, $timezone as xs:dayTimeDuration?) as xs:time? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-analyze-string";>fn:analyze-string</a>
- :)
-declare function fn:analyze-string( $input as xs:string?, $pattern as xs:string) as element(fn:analyze-string-result) external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-analyze-string";>fn:analyze-string</a>
- :)
-declare function fn:analyze-string( $input as xs:string?, $pattern as xs:string, $flags as xs:string) as element(fn:analyze-string-result) external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-available-environment-variables";>fn:available-environment-variables</a>
- :)
-declare function fn:available-environment-variables() as xs:string* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-avg";>fn:avg</a>
- :)
-declare function fn:avg($arg as xs:anyAtomicType*) as xs:anyAtomicType? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-boolean";>fn:boolean</a>
- :)
-declare function fn:boolean($arg as item()*) as xs:boolean external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-ceiling";>fn:ceiling</a>
- :)
-declare function fn:ceiling($arg as numeric?) as numeric? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-codepoint-equal";>fn:codepoint-equal</a>
- :)
-declare function fn:codepoint-equal( $comparand1 as xs:string?, $comparand2 as xs:string?) as xs:boolean? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-codepoints-to-string";>fn:codepoints-to-string</a>
- :)
-declare function fn:codepoints-to-string($arg as xs:integer*) as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-collection";>fn:collection</a>
- :)
-declare function fn:collection() as node()* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-collection";>fn:collection</a>
- :)
-declare function fn:collection($arg as xs:string?) as node()* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-compare";>fn:compare</a>
- :)
-declare function fn:compare($comparand1 as xs:string?, $comparand2 as xs:string?) as xs:integer? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-compare";>fn:compare</a>
- :)
-declare function fn:compare( $comparand1 as xs:string?, $comparand2 as xs:string?, $collation as xs:string) as xs:integer? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-concat";>fn:concat</a>
- :)
-declare function fn:concat( $arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType? ) as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-contains";>fn:contains</a>
- :)
-declare function fn:contains($arg1 as xs:string?, $arg2 as xs:string?) as xs:boolean external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-contains";>fn:contains</a>
- :)
-declare function fn:contains( $arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:boolean external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-count";>fn:count</a>
- :)
-declare function fn:count($arg as item()*) as xs:integer external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-dateTime";>fn:dateTime</a>
- :)
-declare function fn:dateTime($arg1 as xs:date?, $arg2 as xs:time?) as xs:dateTime? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-day-from-date";>fn:day-from-date</a>
- :)
-declare function fn:day-from-date($arg as xs:date?) as xs:integer? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-days-from-duration";>fn:days-from-duration</a>
- :)
-declare function fn:days-from-duration($arg as xs:duration?) as xs:integer? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-deep-equal";>fn:deep-equal</a>
- :)
-declare function fn:deep-equal($parameter1 as item()*, $parameter2 as item()*) as xs:boolean external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-deep-equal";>fn:deep-equal</a>
- :)
-declare function fn:deep-equal( $parameter1 as item()*, $parameter2 as item()*, $collation as xs:string) as xs:boolean external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-distinct-values";>fn:distinct-values</a>
- :)
-declare function fn:distinct-values($arg as xs:anyAtomicType*) as xs:anyAtomicType* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-distinct-values";>fn:distinct-values</a>
- :)
-declare function fn:distinct-values( $arg as xs:anyAtomicType*, $collation as xs:string) as xs:anyAtomicType* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-doc";>fn:doc</a>
- :)
-declare function fn:doc($uri as xs:string?) as document-node()? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-doc-available";>fn:doc-available</a>
- :)
-declare function fn:doc-available($uri as xs:string?) as xs:boolean external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-element-with-id";>fn:element-with-id</a>
- :)
-declare function fn:element-with-id($arg as xs:string*) as element()* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-element-with-id";>fn:element-with-id</a>
- :)
-declare function fn:element-with-id($arg as xs:string*, $node as node()) as element()* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-empty";>fn:empty</a>
- :)
-declare function fn:empty($arg as item()*) as xs:boolean external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-ends-with";>fn:ends-with</a>
- :)
-declare function fn:ends-with($arg1 as xs:string?, $arg2 as xs:string?) as xs:boolean external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-ends-with";>fn:ends-with</a>
- :)
-declare function fn:ends-with( $arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:boolean external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-environment-variable";>fn:environment-variable</a>
- :)
-declare function fn:environment-variable($name as xs:string) as xs:string? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-error";>fn:error</a>
- :)
-declare function fn:error() as none external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-error";>fn:error</a>
- :)
-declare function fn:error($code as xs:QName) as none external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-error";>fn:error</a>
- :)
-declare function fn:error($code as xs:QName?, $description as xs:string) as none external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-error";>fn:error</a>
- :)
-declare function fn:error( $code as xs:QName?, $description as xs:string, $error-object as item()*) as none external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-exactly-one";>fn:exactly-one</a>
- :)
-declare function fn:exactly-one($arg as item()*) as item() external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-exists";>fn:exists</a>
- :)
-declare function fn:exists($arg as item()*) as xs:boolean external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-false";>fn:false</a>
- :)
-declare function fn:false() as xs:boolean external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-filter";>fn:filter</a>
- :)
-declare function fn:filter($f as function(item()) as xs:boolean, $seq as item()*) as item()* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-floor";>fn:floor</a>
- :)
-declare function fn:floor($arg as numeric?) as numeric? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-fold-left";>fn:fold-left</a>
- :)
-declare function fn:fold-left( $f as function(item()*, item()) as item()*, $zero as item()*, $seq as item()*) as item()* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-fold-right";>fn:fold-right</a>
- :)
-declare function fn:fold-right( $f as function(item(), item()*) as item()*, $zero as item()*, $seq as item()*) as item()* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-format-date";>fn:format-date</a>
- :)
-declare function fn:format-date( $value as xs:date?, $picture as xs:string, $language as xs:string?, $calendar as xs:string?, $place as xs:string?) as xs:string? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-format-date";>fn:format-date</a>
- :)
-declare function fn:format-date($value as xs:date?, $picture as xs:string) as xs:string? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-format-dateTime";>fn:format-dateTime</a>
- :)
-declare function fn:format-dateTime( $value as xs:dateTime?, $picture as xs:string, $language as xs:string?, $calendar as xs:string?, $place as xs:string?) as xs:string? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-format-dateTime";>fn:format-dateTime</a>
- :)
-declare function fn:format-dateTime($value as xs:dateTime?, $picture as xs:string) as xs:string? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-format-integer";>fn:format-integer</a>
- :)
-declare function fn:format-integer($value as xs:integer?, $picture as xs:string) as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-format-integer";>fn:format-integer</a>
- :)
-declare function fn:format-integer( $value as xs:integer?, $picture as xs:string, $language as xs:string) as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-format-number";>fn:format-number</a>
- :)
-declare function fn:format-number($value as numeric?, $picture as xs:string) as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-format-number";>fn:format-number</a>
- :)
-declare function fn:format-number( $value as numeric?, $picture as xs:string, $decimal-format-name as xs:string) as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-format-time";>fn:format-time</a>
- :)
-declare function fn:format-time( $value as xs:time?, $picture as xs:string, $language as xs:string?, $calendar as xs:string?, $place as xs:string?) as xs:string? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-format-time";>fn:format-time</a>
- :)
-declare function fn:format-time($value as xs:time?, $picture as xs:string) as xs:string? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-function-arity";>fn:function-arity</a>
- :)
-declare function fn:function-arity($func as function(*)) as xs:integer external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-generate-id";>fn:generate-id</a>
- :)
-declare function fn:generate-id() as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-generate-id";>fn:generate-id</a>
- :)
-declare function fn:generate-id($arg as node()?) as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-head";>fn:head</a>
- :)
-declare function fn:head($arg as item()*) as item()? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-hours-from-duration";>fn:hours-from-duration</a>
- :)
-declare function fn:hours-from-duration($arg as xs:duration?) as xs:integer? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-hours-from-time";>fn:hours-from-time</a>
- :)
-declare function fn:hours-from-time($arg as xs:time?) as xs:integer? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-id";>fn:id</a>
- :)
-declare function fn:id($arg as xs:string*) as element()* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-id";>fn:id</a>
- :)
-declare function fn:id($arg as xs:string*, $node as node()) as element()* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-idref";>fn:idref</a>
- :)
-declare function fn:idref($arg as xs:string*) as node()* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-idref";>fn:idref</a>
- :)
-declare function fn:idref($arg as xs:string*, $node as node()) as node()* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-in-scope-prefixes";>fn:in-scope-prefixes</a>
- :)
-declare function fn:in-scope-prefixes($element as element()) as xs:string* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-index-of";>fn:index-of</a>
- :)
-declare function fn:index-of( $seq as xs:anyAtomicType*, $search as xs:anyAtomicType) as xs:integer* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-index-of";>fn:index-of</a>
- :)
-declare function fn:index-of( $seq as xs:anyAtomicType*, $search as xs:anyAtomicType, $collation as xs:string) as xs:integer* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-insert-before";>fn:insert-before</a>
- :)
-declare function fn:insert-before( $target as item()*, $position as xs:integer, $inserts as item()*) as item()* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-local-name-from-QName";>fn:local-name-from-QName</a>
- :)
-declare function fn:local-name-from-QName($arg as xs:QName?) as xs:NCName? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-lower-case";>fn:lower-case</a>
- :)
-declare function fn:lower-case($arg as xs:string?) as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-map";>fn:map</a>
- :)
-declare function fn:map($f as function(item()) as item()*, $seq as item()*) as item()* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-map-pairs";>fn:map-pairs</a>
- :)
-declare function fn:map-pairs( $f as function(item(), item()) as item()*, $seq1 as item()*, $seq2 as item()*) as item()* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-matches";>fn:matches</a>
- :)
-declare function fn:matches($input as xs:string?, $pattern as xs:string) as xs:boolean external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-matches";>fn:matches</a>
- :)
-declare function fn:matches( $input as xs:string?, $pattern as xs:string, $flags as xs:string) as xs:boolean external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-max";>fn:max</a>
- :)
-declare function fn:max($arg as xs:anyAtomicType*) as xs:anyAtomicType? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-max";>fn:max</a>
- :)
-declare function fn:max($arg as xs:anyAtomicType*, $collation as xs:string) as xs:anyAtomicType? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-min";>fn:min</a>
- :)
-declare function fn:min($arg as xs:anyAtomicType*) as xs:anyAtomicType? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-min";>fn:min</a>
- :)
-declare function fn:min($arg as xs:anyAtomicType*, $collation as xs:string) as xs:anyAtomicType? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-minutes-from-dateTime";>fn:minutes-from-dateTime</a>
- :)
-declare function fn:minutes-from-dateTime($arg as xs:dateTime?) as xs:integer? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-minutes-from-duration";>fn:minutes-from-duration</a>
- :)
-declare function fn:minutes-from-duration($arg as xs:duration?) as xs:integer? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-minutes-from-time";>fn:minutes-from-time</a>
- :)
-declare function fn:minutes-from-time($arg as xs:time?) as xs:integer? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-month-from-date";>fn:month-from-date</a>
- :)
-declare function fn:month-from-date($arg as xs:date?) as xs:integer? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-months-from-duration";>fn:months-from-duration</a>
- :)
-declare function fn:months-from-duration($arg as xs:duration?) as xs:integer? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-namespace-uri-for-prefix";>fn:namespace-uri-for-prefix</a>
- :)
-declare function fn:namespace-uri-for-prefix( $prefix as xs:string?, $element as element()) as xs:anyURI? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-namespace-uri-from-QName";>fn:namespace-uri-from-QName</a>
- :)
-declare function fn:namespace-uri-from-QName($arg as xs:QName?) as xs:anyURI? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-normalize-space";>fn:normalize-space</a>
- :)
-declare function fn:normalize-space() as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-normalize-space";>fn:normalize-space</a>
- :)
-declare function fn:normalize-space($arg as xs:string?) as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-normalize-unicode";>fn:normalize-unicode</a>
- :)
-declare function fn:normalize-unicode($arg as xs:string?) as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-normalize-unicode";>fn:normalize-unicode</a>
- :)
-declare function fn:normalize-unicode( $arg as xs:string?, $normalizationForm as xs:string) as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-not";>fn:not</a>
- :)
-declare function fn:not($arg as item()*) as xs:boolean external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-one-or-more";>fn:one-or-more</a>
- :)
-declare function fn:one-or-more($arg as item()*) as item()+ external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-parse-xml";>fn:parse-xml</a>
- :)
-declare function fn:parse-xml($arg as xs:string?) as document-node(element(*, xs:untyped)) external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-parse-xml";>fn:parse-xml</a>
- :)
-declare function fn:parse-xml( $arg as xs:string?, $baseURI as xs:string) as document-node(element(*, xs:untyped)) external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-parse-xml-fragment";>fn:parse-xml-fragment</a>
- :)
-declare function fn:parse-xml-fragment( $arg as xs:string?) as document-node(element(*, xs:untyped)) external;
-
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-prefix-from-QName";>fn:prefix-from-QName</a>
- :)
-declare function fn:prefix-from-QName($arg as xs:QName?) as xs:NCName? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-remove";>fn:remove</a>
- :)
-declare function fn:remove($target as item()*, $position as xs:integer) as item()* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-replace";>fn:replace</a>
- :)
-declare function fn:replace( $input as xs:string?, $pattern as xs:string, $replacement as xs:string) as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-replace";>fn:replace</a>
- :)
-declare function fn:replace( $input as xs:string?, $pattern as xs:string, $replacement as xs:string, $flags as xs:string) as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-resolve-QName";>fn:resolve-QName</a>
- :)
-declare function fn:resolve-QName($qname as xs:string?, $element as element()) as xs:QName? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-reverse";>fn:reverse</a>
- :)
-declare function fn:reverse($arg as item()*) as item()* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-round";>fn:round</a>
- :)
-declare function fn:round($arg as numeric?) as numeric? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-round";>fn:round</a>
- :)
-declare function fn:round($arg as numeric?, $precision as xs:integer) as numeric? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-round-half-to-even";>fn:round-half-to-even</a>
- :)
-declare function fn:round-half-to-even($arg as numeric?) as numeric? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-round-half-to-even";>fn:round-half-to-even</a>
- :)
-declare function fn:round-half-to-even($arg as numeric?, $precision as xs:integer) as numeric? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-seconds-from-dateTime";>fn:seconds-from-dateTime</a>
- :)
-declare function fn:seconds-from-dateTime($arg as xs:dateTime?) as xs:decimal? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-seconds-from-duration";>fn:seconds-from-duration</a>
- :)
-declare function fn:seconds-from-duration($arg as xs:duration?) as xs:decimal? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-seconds-from-time";>fn:seconds-from-time</a>
- :)
-declare function fn:seconds-from-time($arg as xs:time?) as xs:decimal? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-serialize";>fn:serialize</a>
- :)
-declare function fn:serialize($arg as item()*) as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-serialize";>fn:serialize</a>
- :)
-declare function fn:serialize( $arg as item()*, $params as element(output:serialization-parameters)?) as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-starts-with";>fn:starts-with</a>
- :)
-declare function fn:starts-with($arg1 as xs:string?, $arg2 as xs:string?) as xs:boolean external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-starts-with";>fn:starts-with</a>
- :)
-declare function fn:starts-with( $arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:boolean external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-string-join";>fn:string-join</a>
- :)
-declare function fn:string-join($arg1 as xs:string*) as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-string-join";>fn:string-join</a>
- :)
-declare function fn:string-join($arg1 as xs:string*, $arg2 as xs:string) as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-string-length";>fn:string-length</a>
- :)
-declare function fn:string-length() as xs:integer external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-string-length";>fn:string-length</a>
- :)
-declare function fn:string-length($arg as xs:string?) as xs:integer external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-string-to-codepoints";>fn:string-to-codepoints</a>
- :)
-declare function fn:string-to-codepoints($arg as xs:string?) as xs:integer* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-subsequence";>fn:subsequence</a>
- :)
-declare function fn:subsequence($sourceSeq as item()*, $startingLoc as xs:double) as item()* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-subsequence";>fn:subsequence</a>
- :)
-declare function fn:subsequence( $sourceSeq as item()*, $startingLoc as xs:double, $length as xs:double) as item()* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-substring";>fn:substring</a>
- :)
-declare function fn:substring($sourceString as xs:string?, $start as xs:double) as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-substring";>fn:substring</a>
- :)
-declare function fn:substring( $sourceString as xs:string?, $start as xs:double, $length as xs:double) as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-substring-after";>fn:substring-after</a>
- :)
-declare function fn:substring-after($arg1 as xs:string?, $arg2 as xs:string?) as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-substring-after";>fn:substring-after</a>
- :)
-declare function fn:substring-after( $arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-substring-before";>fn:substring-before</a>
- :)
-declare function fn:substring-before($arg1 as xs:string?, $arg2 as xs:string?) as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-substring-before";>fn:substring-before</a>
- :)
-declare function fn:substring-before( $arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-sum";>fn:sum</a>
- :)
-declare function fn:sum($arg as xs:anyAtomicType*) as xs:anyAtomicType external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-sum";>fn:sum</a>
- :)
-declare function fn:sum( $arg as xs:anyAtomicType*, $zero as xs:anyAtomicType?) as xs:anyAtomicType? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-tail";>fn:tail</a>
- :)
-declare function fn:tail($arg as item()*) as item()* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-timezone-from-date";>fn:timezone-from-date</a>
- :)
-declare function fn:timezone-from-date($arg as xs:date?) as xs:dayTimeDuration? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-timezone-from-dateTime";>fn:timezone-from-dateTime</a>
- :)
-declare function fn:timezone-from-dateTime($arg as xs:dateTime?) as xs:dayTimeDuration? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-timezone-from-time";>fn:timezone-from-time</a>
- :)
-declare function fn:timezone-from-time($arg as xs:time?) as xs:dayTimeDuration? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-tokenize";>fn:tokenize</a>
- :)
-declare function fn:tokenize($input as xs:string?, $pattern as xs:string) as xs:string* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-tokenize";>fn:tokenize</a>
- :)
-declare function fn:tokenize( $input as xs:string?, $pattern as xs:string, $flags as xs:string) as xs:string* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-trace";>fn:trace</a>
- :)
-declare function fn:trace($value as item()*, $label as xs:string) as item()* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-translate";>fn:translate</a>
- :)
-declare function fn:translate( $arg as xs:string?, $mapString as xs:string, $transString as xs:string) as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-true";>fn:true</a>
- :)
-declare function fn:true() as xs:boolean external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-unordered";>fn:unordered</a>
- :)
-declare function fn:unordered($sourceSeq as item()*) as item()* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-unparsed-text";>fn:unparsed-text</a>
- :)
-declare function fn:unparsed-text($href as xs:string?) as xs:string? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-unparsed-text";>fn:unparsed-text</a>
- :)
-declare function fn:unparsed-text($href as xs:string?, $encoding as xs:string) as xs:string? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-unparsed-text-available";>fn:unparsed-text-available</a>
- :)
-declare function fn:unparsed-text-available($href as xs:string?) as xs:boolean external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-unparsed-text-available";>fn:unparsed-text-available</a>
- :)
-declare function fn:unparsed-text-available( $href as xs:string?, $encoding as xs:string) as xs:boolean external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-unparsed-text-lines";>fn:unparsed-text-lines</a>
- :)
-declare function fn:unparsed-text-lines($href as xs:string?) as xs:string* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-unparsed-text-lines";>fn:unparsed-text-lines</a>
- :)
-declare function fn:unparsed-text-lines( $href as xs:string?, $encoding as xs:string) as xs:string* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-upper-case";>fn:upper-case</a>
- :)
-declare function fn:upper-case($arg as xs:string?) as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-uri-collection";>fn:uri-collection</a>
- :)
-declare function fn:uri-collection() as xs:anyURI* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-uri-collection";>fn:uri-collection</a>
- :)
-declare function fn:uri-collection($arg as xs:string?) as xs:anyURI* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-year-from-date";>fn:year-from-date</a>
- :)
-declare function fn:year-from-date($arg as xs:date?) as xs:integer? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-years-from-duration";>fn:years-from-duration</a>
- :)
-declare function fn:years-from-duration($arg as xs:duration?) as xs:integer? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-zero-or-one";>fn:zero-or-one</a>
- :)
-declare function fn:zero-or-one($arg as item()*) as item()? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-codepoints-to-string";>fn:codepoints-to-string</a>
- :)
-declare function fn:codepoints-to-string($arg as xs:integer*) as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-string-to-codepoints";>fn:string-to-codepoints</a>
- :)
-declare function fn:string-to-codepoints($arg as xs:string?) as xs:integer* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-base-uri";>fn:base-uri</a>
- :)
-declare function fn:base-uri() as xs:anyURI? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-base-uri";>fn:base-uri</a>
- :)
-declare function fn:base-uri($arg as node()?) as xs:anyURI? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-current-date";>fn:current-date</a>
- :)
-declare function fn:current-date() as xs:date external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-current-dateTime";>fn:current-dateTime</a>
- :)
-declare function fn:current-dateTime() as xs:dateTimeStamp external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-current-time";>fn:current-time</a>
- :)
-declare function fn:current-time() as xs:time external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-data";>fn:data</a>
- :)
-declare function fn:data() as xs:anyAtomicType* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-data";>fn:data</a>
- :)
-declare function fn:data($arg as item()*) as xs:anyAtomicType* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-default-collation";>fn:default-collation</a>
- :)
-declare function fn:default-collation() as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-document-uri";>fn:document-uri</a>
- :)
-declare function fn:document-uri() as xs:anyURI? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-document-uri";>fn:document-uri</a>
- :)
-declare function fn:document-uri($arg as node()?) as xs:anyURI? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-encode-for-uri";>fn:encode-for-uri</a>
- :)
-declare function fn:encode-for-uri($uri-part as xs:string?) as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-escape-html-uri";>fn:escape-html-uri</a>
- :)
-declare function fn:escape-html-uri($uri as xs:string?) as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-has-children";>fn:has-children</a>
- :)
-declare function fn:has-children() as xs:boolean external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-has-children";>fn:has-children</a>
- :)
-declare function fn:has-children($node as node()?) as xs:boolean external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-implicit-timezone";>fn:implicit-timezone</a>
- :)
-declare function fn:implicit-timezone() as xs:dayTimeDuration external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-innermost";>fn:innermost</a>
- :)
-declare function fn:innermost($nodes as node()*) as node()* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-iri-to-uri";>fn:iri-to-uri</a>
- :)
-declare function fn:iri-to-uri($iri as xs:string?) as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-lang";>fn:lang</a>
- :)
-declare function fn:lang($testlang as xs:string?) as xs:boolean external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-lang";>fn:lang</a>
- :)
-declare function fn:lang($testlang as xs:string?, $node as node()) as xs:boolean external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-last";>fn:last</a>
- :)
-declare function fn:last() as xs:integer external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-local-name";>fn:local-name</a>
- :)
-declare function fn:local-name() as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-local-name";>fn:local-name</a>
- :)
-declare function fn:local-name($arg as node()?) as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-name";>fn:name</a>
- :)
-declare function fn:name() as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-name";>fn:name</a>
- :)
-declare function fn:name($arg as node()?) as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-namespace-uri";>fn:namespace-uri</a>
- :)
-declare function fn:namespace-uri() as xs:anyURI external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-namespace-uri";>fn:namespace-uri</a>
- :)       
-declare function fn:namespace-uri($arg as node()?) as xs:anyURI external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-nilled";>fn:nilled</a>
- :)
-declare function fn:nilled() as xs:boolean external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-nilled";>fn:nilled</a>
- :)
-declare function fn:nilled($arg as node()?) as xs:boolean? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-node-name";>fn:node-name</a>
- :)
-declare function fn:node-name() as xs:QName? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-node-name";>fn:node-name</a>
- :)
-declare function fn:node-name($arg as node()?) as xs:QName? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-number";>fn:number</a>
- :)
-declare function fn:number() as xs:double external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-number";>fn:number</a>
- :)
-declare function fn:number($arg as xs:anyAtomicType?) as xs:double external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-outermost";>fn:outermost</a>
- :)
-declare function fn:outermost($nodes as node()*) as node()* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-position";>fn:position</a>
- :)
-declare function fn:position() as xs:integer external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-resolve-uri";>fn:resolve-uri</a>
- :)
-declare function fn:resolve-uri($relative as xs:string?) as xs:anyURI? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-resolve-uri";>fn:resolve-uri</a>
- :)
-declare function fn:resolve-uri($relative as xs:string?, $base as xs:string) as xs:anyURI? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-root";>fn:root</a>
- :)
-declare function fn:root() as node() external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-root";>fn:root</a>
- :)
-declare function fn:root($arg as node()?) as node()? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-static-base-uri";>fn:static-base-uri</a>
- :)
-declare function fn:static-base-uri() as xs:anyURI? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-string";>fn:string</a>
- :)
-declare function fn:string() as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-string";>fn:string</a>
- :)
-declare function fn:string($arg as item()?) as xs:string external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-available-environment-variables";>fn:available-environment-variables</a>
- :)
-declare function fn:available-environment-variables() as xs:string* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-environment-variable";>fn:environment-variable</a>
- :)
-declare function fn:environment-variable($arg as xs:string) as xs:string? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-unparsed-text";>fn:unparsed-text</a>
- :)
-declare function fn:unparsed-text($href as xs:string?) as xs:string? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-unparsed-text";>fn:unparsed-text</a>
- :)
-declare function fn:unparsed-text($href as xs:string?, $encoding as xs:string) as xs:string? external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-unparsed-text-available";>fn:unparsed-text-available</a>
- :)
-declare function fn:unparsed-text-available($href as xs:string?) as xs:boolean external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-unparsed-text-lines";>fn:unparsed-text-lines</a>
- :)
-declare function fn:unparsed-text-lines(	$href	 as xs:string?, $encoding	 as xs:string) as xs:string* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-unparsed-text-available";>fn:unparsed-text-available</a>
- :)
-declare function fn:unparsed-text-available(	$href	 as xs:string?, $encoding	 as xs:string) as xs:boolean external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-uri-collection";>fn:uri-collection</a>
- :)
-declare function fn:uri-collection() as xs:anyURI* external;
-
-(:~
- : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-uri-collection";>fn:uri-collection</a>
- :)
-declare function fn:uri-collection($arg as xs:string?) as xs:anyURI* external;
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Constructs an <code>xs:QName</code> value given a namespace URI
+ : and a lexical QName.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:QName</code>(<code class="arg">$paramURI</code><code class="as"> as </code><code class="type">xs:string?</code>, <code class="arg">$paramQName</code><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:QName</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The namespace URI in the returned QName is taken from
+ : <code>$paramURI</code>. If <code>$paramURI</code> is the
+ : zero-length string or the empty sequence, it represents "no
+ : namespace".</p>
+ : <p>The prefix (or absence of a prefix) in <code>$paramQName</code>
+ : is retained in the returned <code>xs:QName</code> value.</p>
+ : <p>The local name in the result is taken from the local part of
+ : <code>$paramQName</code>.</p>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>An error is raised [<span href="#ERRFOCA0002" title="err:FOCA0002">err:FOCA0002</span>] if <code>$paramQName</code> does
+ : not have the correct lexical form for an instance of
+ : <code>xs:QName</code>.</p>
+ : <p>An error is raised [<span href="#ERRFOCA0002" title="err:FOCA0002">err:FOCA0002</span>] if <code>$paramURI</code> is the
+ : zero-length string or the empty sequence, and the value of
+ : <code>$paramQName</code> contains a colon (<code>:</code>).</p>
+ : <p>An error <strong>may</strong> be raised [<span href="#ERRFOCA0002" title="err:FOCA0002">err:FOCA0002</span>] if <code>$paramURI</code> is
+ : not a valid URI (XML Namespaces 1.0) or IRI (XML Namespaces
+ : 1.1).</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p><code>fn:QName("http://www.example.com/example";,
+ : "person")</code> returns an <code>xs:QName</code> with namespace
+ : URI = "http://www.example.com/example";, local name = "person" and
+ : prefix = "".</p>
+ : <p><code>fn:QName("http://www.example.com/example";,
+ : "ht:person")</code> returns an <code>xs:QName</code> with namespace
+ : URI = "http://www.example.com/example";, local name = "person" and
+ : prefix = "ht".</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-QName
+ :)
+declare function fn:QName($paramURI as xs:string?,  $paramQName as xs:string) as  xs:QName external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns the absolute value of <code>$arg</code>.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:abs</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">numeric?</code>)<code class="as"> as </code><code class="return-type">numeric?</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>General rules: see <span href="#numeric-value-functions"><b>4.4
+ : Functions on numeric values</b></span>.</p>
+ : <p>If <code>$arg</code> is negative the function returns
+ : <code>-$arg</code>, otherwise it returns <code>$arg</code>.</p>
+ : <p>If the type of <code>$arg</code> is one of the four numeric
+ : types <code>xs:float</code>, <code>xs:double</code>,
+ : <code>xs:decimal</code> or <code>xs:integer</code> the type of the
+ : result is the same as the type of <code>$arg</code>. If the type of
+ : <code>$arg</code> is a type derived from one of the numeric types,
+ : the result is an instance of the base numeric type.</p>
+ : <p>For <code>xs:float</code> and <code>xs:double</code> arguments,
+ : if the argument is positive zero or negative zero, then positive
+ : zero is returned. If the argument is positive or negative infinity,
+ : positive infinity is returned.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:abs(10.5)</code> returns
+ : <code>10.5</code>.</p>
+ : <p>The expression <code>fn:abs(-10.5)</code> returns
+ : <code>10.5</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-abs
+ :)
+declare function fn:abs($arg as numeric?) as  numeric? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Adjusts an <code>xs:date</code> value to a specific timezone, or
+ : to no timezone at all; the result is the date in the target
+ : timezone that contains the starting instant of the supplied
+ : date.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:adjust-date-to-timezone</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:date?</code>)<code class="as"> as </code><code class="return-type">xs:date?</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="2"><code class="function">fn:adjust-date-to-timezone</code>(</td>
+ : <td valign="baseline"><code class="arg">$arg</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:date?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$timezone</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:dayTimeDuration?</code>)<code class="as"> as </code><code class="return-type">xs:date?</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>The one-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.
+ : It depends on implicit-timezone.</p>
+ : <p>The two-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If <code>$timezone</code> is not specified, then the effective
+ : value of <code>$timezone</code> is the value of the implicit
+ : timezone in the dynamic context.</p>
+ : <p>If <code>$arg</code> is the empty sequence, then the function
+ : returns the empty sequence.</p>
+ : <p>If <code>$arg</code> does not have a timezone component and
+ : <code>$timezone</code> is the empty sequence, then the result is
+ : the value of <code>$arg</code>.</p>
+ : <p>If <code>$arg</code> does not have a timezone component and
+ : <code>$timezone</code> is not the empty sequence, then the result
+ : is <code>$arg</code> with <code>$timezone</code> as the timezone
+ : component.</p>
+ : <p>If <code>$arg</code> has a timezone component and
+ : <code>$timezone</code> is the empty sequence, then the result is
+ : the local value of <code>$arg</code> without its timezone
+ : component.</p>
+ : <p>If <code>$arg</code> has a timezone component and
+ : <code>$timezone</code> is not the empty sequence, then the function
+ : returns the value of the expression:</p>
+ : <ul>
+ : <li>
+ : <p>Let <code>$dt</code> be the value of <span href="#func-dateTime"><code>fn:dateTime($arg,
+ : xs:time('00:00:00'))</code></span>.</p>
+ : </li>
+ : <li>
+ : <p>Let <code>$adt</code> be the value of <span href="#func-adjust-dateTime-to-timezone"><code>fn:adjust-dateTime-to-timezone($dt,
+ : $timezone)</code></span></p>
+ : </li>
+ : <li>
+ : <p>The function returns the value of <code>xs:date($adt)</code></p>
+ : </li>
+ : </ul>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>An error is raised [<span href="#ERRFODT0003" title="err:FODT0003">err:FODT0003</span>] if <code>$timezone</code> is less
+ : than <code>-PT14H</code> or greater than <code>PT14H</code> or is
+ : not an integral number of minutes.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>Assume the dynamic context provides an implicit timezone of
+ : <code>-05:00 (-PT5H0M)</code>.</p>
+ : <p>let <code>$tz-10</code> :=
+ : <code>xs:dayTimeDuration("-PT10H")</code></p>
+ : <p>The expression
+ : <code>fn:adjust-date-to-timezone(xs:date("2002-03-07"))</code>
+ : returns <code>xs:date("2002-03-07-05:00")</code>.</p>
+ : <p>The expression
+ : <code>fn:adjust-date-to-timezone(xs:date("2002-03-07-07:00"))</code>
+ : returns <code>xs:date("2002-03-07-05:00")</code>.
+ : <em>(<code>$arg</code> is converted to
+ : <code>xs:dateTime("2002-03-07T00:00:00-07:00")</code>. This is
+ : adjusted to the implicit timezone, giving
+ : <code>"2002-03-07T02:00:00-05:00"</code>. ).</em></p>
+ : <p>The expression
+ : <code>fn:adjust-date-to-timezone(xs:date("2002-03-07"),
+ : $tz-10)</code> returns
+ : <code>xs:date("2002-03-07-10:00")</code>.</p>
+ : <p>The expression
+ : <code>fn:adjust-date-to-timezone(xs:date("2002-03-07-07:00"),
+ : $tz-10)</code> returns <code>xs:date("2002-03-06-10:00")</code>.
+ : <em>(<code>$arg</code> is converted to the <code>xs:dateTime
+ : "2002-03-07T00:00:00-07:00"</code>. This is adjusted to the given
+ : timezone, giving <code>"2002-03-06T21:00:00-10:00"</code>.
+ : ).</em></p>
+ : <p>The expression
+ : <code>fn:adjust-date-to-timezone(xs:date("2002-03-07"), ())</code>
+ : returns <code>xs:date("2002-03-07")</code>.</p>
+ : <p>The expression
+ : <code>fn:adjust-date-to-timezone(xs:date("2002-03-07-07:00"),
+ : ())</code> returns <code>xs:date("2002-03-07")</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-adjust-date-to-timezone
+ :)
+declare function fn:adjust-date-to-timezone($arg as xs:date?) as  xs:date? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Adjusts an <code>xs:date</code> value to a specific timezone, or
+ : to no timezone at all; the result is the date in the target
+ : timezone that contains the starting instant of the supplied
+ : date.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:adjust-date-to-timezone</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:date?</code>)<code class="as"> as </code><code class="return-type">xs:date?</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="2"><code class="function">fn:adjust-date-to-timezone</code>(</td>
+ : <td valign="baseline"><code class="arg">$arg</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:date?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$timezone</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:dayTimeDuration?</code>)<code class="as"> as </code><code class="return-type">xs:date?</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>The one-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.
+ : It depends on implicit-timezone.</p>
+ : <p>The two-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If <code>$timezone</code> is not specified, then the effective
+ : value of <code>$timezone</code> is the value of the implicit
+ : timezone in the dynamic context.</p>
+ : <p>If <code>$arg</code> is the empty sequence, then the function
+ : returns the empty sequence.</p>
+ : <p>If <code>$arg</code> does not have a timezone component and
+ : <code>$timezone</code> is the empty sequence, then the result is
+ : the value of <code>$arg</code>.</p>
+ : <p>If <code>$arg</code> does not have a timezone component and
+ : <code>$timezone</code> is not the empty sequence, then the result
+ : is <code>$arg</code> with <code>$timezone</code> as the timezone
+ : component.</p>
+ : <p>If <code>$arg</code> has a timezone component and
+ : <code>$timezone</code> is the empty sequence, then the result is
+ : the local value of <code>$arg</code> without its timezone
+ : component.</p>
+ : <p>If <code>$arg</code> has a timezone component and
+ : <code>$timezone</code> is not the empty sequence, then the function
+ : returns the value of the expression:</p>
+ : <ul>
+ : <li>
+ : <p>Let <code>$dt</code> be the value of <span href="#func-dateTime"><code>fn:dateTime($arg,
+ : xs:time('00:00:00'))</code></span>.</p>
+ : </li>
+ : <li>
+ : <p>Let <code>$adt</code> be the value of <span href="#func-adjust-dateTime-to-timezone"><code>fn:adjust-dateTime-to-timezone($dt,
+ : $timezone)</code></span></p>
+ : </li>
+ : <li>
+ : <p>The function returns the value of <code>xs:date($adt)</code></p>
+ : </li>
+ : </ul>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>An error is raised [<span href="#ERRFODT0003" title="err:FODT0003">err:FODT0003</span>] if <code>$timezone</code> is less
+ : than <code>-PT14H</code> or greater than <code>PT14H</code> or is
+ : not an integral number of minutes.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>Assume the dynamic context provides an implicit timezone of
+ : <code>-05:00 (-PT5H0M)</code>.</p>
+ : <p>let <code>$tz-10</code> :=
+ : <code>xs:dayTimeDuration("-PT10H")</code></p>
+ : <p>The expression
+ : <code>fn:adjust-date-to-timezone(xs:date("2002-03-07"))</code>
+ : returns <code>xs:date("2002-03-07-05:00")</code>.</p>
+ : <p>The expression
+ : <code>fn:adjust-date-to-timezone(xs:date("2002-03-07-07:00"))</code>
+ : returns <code>xs:date("2002-03-07-05:00")</code>.
+ : <em>(<code>$arg</code> is converted to
+ : <code>xs:dateTime("2002-03-07T00:00:00-07:00")</code>. This is
+ : adjusted to the implicit timezone, giving
+ : <code>"2002-03-07T02:00:00-05:00"</code>. ).</em></p>
+ : <p>The expression
+ : <code>fn:adjust-date-to-timezone(xs:date("2002-03-07"),
+ : $tz-10)</code> returns
+ : <code>xs:date("2002-03-07-10:00")</code>.</p>
+ : <p>The expression
+ : <code>fn:adjust-date-to-timezone(xs:date("2002-03-07-07:00"),
+ : $tz-10)</code> returns <code>xs:date("2002-03-06-10:00")</code>.
+ : <em>(<code>$arg</code> is converted to the <code>xs:dateTime
+ : "2002-03-07T00:00:00-07:00"</code>. This is adjusted to the given
+ : timezone, giving <code>"2002-03-06T21:00:00-10:00"</code>.
+ : ).</em></p>
+ : <p>The expression
+ : <code>fn:adjust-date-to-timezone(xs:date("2002-03-07"), ())</code>
+ : returns <code>xs:date("2002-03-07")</code>.</p>
+ : <p>The expression
+ : <code>fn:adjust-date-to-timezone(xs:date("2002-03-07-07:00"),
+ : ())</code> returns <code>xs:date("2002-03-07")</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-adjust-date-to-timezone
+ :)
+declare function fn:adjust-date-to-timezone( $arg as xs:date?,  $timezone as xs:dayTimeDuration?) as  xs:date? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Adjusts an <code>xs:dateTime</code> value to a specific
+ : timezone, or to no timezone at all.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:adjust-dateTime-to-timezone</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:dateTime?</code>)<code class="as"> as </code><code class="return-type">xs:dateTime</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="2"><code class="function">fn:adjust-dateTime-to-timezone</code>(</td>
+ : <td valign="baseline"><code class="arg">$arg</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:dateTime?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$timezone</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:dayTimeDuration?</code>)<code class="as"> as </code><code class="return-type">xs:dateTime</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>The one-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.
+ : It depends on implicit-timezone.</p>
+ : <p>The two-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If <code>$timezone</code> is not specified, then the effective
+ : value of <code>$timezone</code> is the value of the implicit
+ : timezone in the dynamic context.</p>
+ : <p>If <code>$arg</code> is the empty sequence, then the function
+ : returns the empty sequence.</p>
+ : <p>If <code>$arg</code> does not have a timezone component and
+ : <code>$timezone</code> is the empty sequence, then the result is
+ : <code>$arg</code>.</p>
+ : <p>If <code>$arg</code> does not have a timezone component and
+ : <code>$timezone</code> is not the empty sequence, then the result
+ : is <code>$arg</code> with <code>$timezone</code> as the timezone
+ : component.</p>
+ : <p>If <code>$arg</code> has a timezone component and
+ : <code>$timezone</code> is the empty sequence, then the result is
+ : the local value of <code>$arg</code> without its timezone
+ : component.</p>
+ : <p>If <code>$arg</code> has a timezone component and
+ : <code>$timezone</code> is not the empty sequence, then the result
+ : is the <code>xs:dateTime</code> value that is equal to
+ : <code>$arg</code> and that has a timezone component equal to
+ : <code>$timezone</code>.</p>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>An error is raised [<span href="#ERRFODT0003" title="err:FODT0003">err:FODT0003</span>] if <code>$timezone</code> is less
+ : than <code>-PT14H</code> or greater than <code>PT14H</code> or is
+ : not an integral number of minutes.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>Assume the dynamic context provides an implicit timezone of
+ : <code>-05:00 (-PT5H0M)</code>.</p>
+ : <p>let <code>$tz-10</code> :=
+ : <code>xs:dayTimeDuration("-PT10H")</code></p>
+ : <p>The expression
+ : <code>fn:adjust-dateTime-to-timezone(xs:dateTime('2002-03-07T10:00:00'))</code>
+ : returns <code>xs:dateTime('2002-03-07T10:00:00-05:00')</code>.</p>
+ : <p>The expression
+ : <code>fn:adjust-dateTime-to-timezone(xs:dateTime('2002-03-07T10:00:00-07:00'))</code>
+ : returns <code>xs:dateTime('2002-03-07T12:00:00-05:00')</code>.</p>
+ : <p>The expression
+ : <code>fn:adjust-dateTime-to-timezone(xs:dateTime('2002-03-07T10:00:00'),
+ : $tz-10)</code> returns
+ : <code>xs:dateTime('2002-03-07T10:00:00-10:00')</code>.</p>
+ : <p>The expression
+ : <code>fn:adjust-dateTime-to-timezone(xs:dateTime('2002-03-07T10:00:00-07:00'),
+ : $tz-10)</code> returns
+ : <code>xs:dateTime('2002-03-07T07:00:00-10:00')</code>.</p>
+ : <p>The expression
+ : <code>fn:adjust-dateTime-to-timezone(xs:dateTime('2002-03-07T10:00:00-07:00'),
+ : xs:dayTimeDuration("PT10H"))</code> returns
+ : <code>xs:dateTime('2002-03-08T03:00:00+10:00')</code>.</p>
+ : <p>The expression
+ : <code>fn:adjust-dateTime-to-timezone(xs:dateTime('2002-03-07T00:00:00+01:00'),
+ : xs:dayTimeDuration("-PT8H"))</code> returns
+ : <code>xs:dateTime('2002-03-06T15:00:00-08:00')</code>.</p>
+ : <p>The expression
+ : <code>fn:adjust-dateTime-to-timezone(xs:dateTime('2002-03-07T10:00:00'),
+ : ())</code> returns
+ : <code>xs:dateTime('2002-03-07T10:00:00')</code>.</p>
+ : <p>The expression
+ : <code>fn:adjust-dateTime-to-timezone(xs:dateTime('2002-03-07T10:00:00-07:00'),
+ : ())</code> returns
+ : <code>xs:dateTime('2002-03-07T10:00:00')</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-adjust-dateTime-to-timezone
+ :)
+declare function fn:adjust-dateTime-to-timezone($arg as xs:dateTime?) as  xs:dateTime external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Adjusts an <code>xs:dateTime</code> value to a specific
+ : timezone, or to no timezone at all.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:adjust-dateTime-to-timezone</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:dateTime?</code>)<code class="as"> as </code><code class="return-type">xs:dateTime</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="2"><code class="function">fn:adjust-dateTime-to-timezone</code>(</td>
+ : <td valign="baseline"><code class="arg">$arg</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:dateTime?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$timezone</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:dayTimeDuration?</code>)<code class="as"> as </code><code class="return-type">xs:dateTime</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>The one-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.
+ : It depends on implicit-timezone.</p>
+ : <p>The two-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If <code>$timezone</code> is not specified, then the effective
+ : value of <code>$timezone</code> is the value of the implicit
+ : timezone in the dynamic context.</p>
+ : <p>If <code>$arg</code> is the empty sequence, then the function
+ : returns the empty sequence.</p>
+ : <p>If <code>$arg</code> does not have a timezone component and
+ : <code>$timezone</code> is the empty sequence, then the result is
+ : <code>$arg</code>.</p>
+ : <p>If <code>$arg</code> does not have a timezone component and
+ : <code>$timezone</code> is not the empty sequence, then the result
+ : is <code>$arg</code> with <code>$timezone</code> as the timezone
+ : component.</p>
+ : <p>If <code>$arg</code> has a timezone component and
+ : <code>$timezone</code> is the empty sequence, then the result is
+ : the local value of <code>$arg</code> without its timezone
+ : component.</p>
+ : <p>If <code>$arg</code> has a timezone component and
+ : <code>$timezone</code> is not the empty sequence, then the result
+ : is the <code>xs:dateTime</code> value that is equal to
+ : <code>$arg</code> and that has a timezone component equal to
+ : <code>$timezone</code>.</p>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>An error is raised [<span href="#ERRFODT0003" title="err:FODT0003">err:FODT0003</span>] if <code>$timezone</code> is less
+ : than <code>-PT14H</code> or greater than <code>PT14H</code> or is
+ : not an integral number of minutes.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>Assume the dynamic context provides an implicit timezone of
+ : <code>-05:00 (-PT5H0M)</code>.</p>
+ : <p>let <code>$tz-10</code> :=
+ : <code>xs:dayTimeDuration("-PT10H")</code></p>
+ : <p>The expression
+ : <code>fn:adjust-dateTime-to-timezone(xs:dateTime('2002-03-07T10:00:00'))</code>
+ : returns <code>xs:dateTime('2002-03-07T10:00:00-05:00')</code>.</p>
+ : <p>The expression
+ : <code>fn:adjust-dateTime-to-timezone(xs:dateTime('2002-03-07T10:00:00-07:00'))</code>
+ : returns <code>xs:dateTime('2002-03-07T12:00:00-05:00')</code>.</p>
+ : <p>The expression
+ : <code>fn:adjust-dateTime-to-timezone(xs:dateTime('2002-03-07T10:00:00'),
+ : $tz-10)</code> returns
+ : <code>xs:dateTime('2002-03-07T10:00:00-10:00')</code>.</p>
+ : <p>The expression
+ : <code>fn:adjust-dateTime-to-timezone(xs:dateTime('2002-03-07T10:00:00-07:00'),
+ : $tz-10)</code> returns
+ : <code>xs:dateTime('2002-03-07T07:00:00-10:00')</code>.</p>
+ : <p>The expression
+ : <code>fn:adjust-dateTime-to-timezone(xs:dateTime('2002-03-07T10:00:00-07:00'),
+ : xs:dayTimeDuration("PT10H"))</code> returns
+ : <code>xs:dateTime('2002-03-08T03:00:00+10:00')</code>.</p>
+ : <p>The expression
+ : <code>fn:adjust-dateTime-to-timezone(xs:dateTime('2002-03-07T00:00:00+01:00'),
+ : xs:dayTimeDuration("-PT8H"))</code> returns
+ : <code>xs:dateTime('2002-03-06T15:00:00-08:00')</code>.</p>
+ : <p>The expression
+ : <code>fn:adjust-dateTime-to-timezone(xs:dateTime('2002-03-07T10:00:00'),
+ : ())</code> returns
+ : <code>xs:dateTime('2002-03-07T10:00:00')</code>.</p>
+ : <p>The expression
+ : <code>fn:adjust-dateTime-to-timezone(xs:dateTime('2002-03-07T10:00:00-07:00'),
+ : ())</code> returns
+ : <code>xs:dateTime('2002-03-07T10:00:00')</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-adjust-dateTime-to-timezone
+ :)
+declare function fn:adjust-dateTime-to-timezone( $arg as xs:dateTime?,  $timezone as xs:dayTimeDuration?) as  xs:dateTime external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Adjusts an <code>xs:time</code> value to a specific timezone, or
+ : to no timezone at all.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:adjust-time-to-timezone</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:time?</code>)<code class="as"> as </code><code class="return-type">xs:time?</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="2"><code class="function">fn:adjust-time-to-timezone</code>(</td>
+ : <td valign="baseline"><code class="arg">$arg</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:time?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$timezone</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:dayTimeDuration?</code>)<code class="as"> as </code><code class="return-type">xs:time?</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>The one-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.
+ : It depends on implicit-timezone.</p>
+ : <p>The two-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If <code>$timezone</code> is not specified, then the effective
+ : value of <code>$timezone</code> is the value of the implicit
+ : timezone in the dynamic context.</p>
+ : <p>If <code>$arg</code> is the empty sequence, then the function
+ : returns the empty sequence.</p>
+ : <p>If <code>$arg</code> does not have a timezone component and
+ : <code>$timezone</code> is the empty sequence, then the result is
+ : <code>$arg</code>.</p>
+ : <p>If <code>$arg</code> does not have a timezone component and
+ : <code>$timezone</code> is not the empty sequence, then the result
+ : is <code>$arg</code> with <code>$timezone</code> as the timezone
+ : component.</p>
+ : <p>If <code>$arg</code> has a timezone component and
+ : <code>$timezone</code> is the empty sequence, then the result is
+ : the localized value of <code>$arg</code> without its timezone
+ : component.</p>
+ : <p>If <code>$arg</code> has a timezone component and
+ : <code>$timezone</code> is not the empty sequence, then:</p>
+ : <ul>
+ : <li>
+ : <p>Let <code>$dt</code> be the <code>xs:dateTime</code> value
+ : <span href="#func-dateTime"><code>fn:dateTime(xs:date('1972-12-31'),
+ : $arg)</code></span>.</p>
+ : </li>
+ : <li>
+ : <p>Let <code>$adt</code> be the value of <span href="#func-adjust-dateTime-to-timezone"><code>fn:adjust-dateTime-to-timezone($dt,
+ : $timezone)</code></span></p>
+ : </li>
+ : <li>
+ : <p>The function returns the <code>xs:time</code> value
+ : <code>xs:time($adt)</code>.</p>
+ : </li>
+ : </ul>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>An error is raised [<span href="#ERRFODT0003" title="err:FODT0003">err:FODT0003</span>] if <code>$timezone</code> is less
+ : than <code>-PT14H</code> or greater than <code>PT14H</code> or if
+ : does not contain an integral number of minutes.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>Assume the dynamic context provides an implicit timezone of
+ : <code>-05:00 (-PT5H0M)</code>.</p>
+ : <p>let <code>$tz-10</code> :=
+ : <code>xs:dayTimeDuration("-PT10H")</code></p>
+ : <p>The expression
+ : <code>fn:adjust-time-to-timezone(xs:time("10:00:00"))</code>
+ : returns <code>xs:time("10:00:00-05:00")</code>.</p>
+ : <p>The expression
+ : <code>fn:adjust-time-to-timezone(xs:time("10:00:00-07:00"))</code>
+ : returns <code>xs:time("12:00:00-05:00")</code>.</p>
+ : <p>The expression
+ : <code>fn:adjust-time-to-timezone(xs:time("10:00:00"),
+ : $tz-10)</code> returns <code>xs:time("10:00:00-10:00")</code>.</p>
+ : <p>The expression
+ : <code>fn:adjust-time-to-timezone(xs:time("10:00:00-07:00"),
+ : $tz-10)</code> returns <code>xs:time("07:00:00-10:00")</code>.</p>
+ : <p>The expression
+ : <code>fn:adjust-time-to-timezone(xs:time("10:00:00"), ())</code>
+ : returns <code>xs:time("10:00:00")</code>.</p>
+ : <p>The expression
+ : <code>fn:adjust-time-to-timezone(xs:time("10:00:00-07:00"),
+ : ())</code> returns <code>xs:time("10:00:00")</code>.</p>
+ : <p>The expression
+ : <code>fn:adjust-time-to-timezone(xs:time("10:00:00-07:00"),
+ : xs:dayTimeDuration("PT10H"))</code> returns
+ : <code>xs:time("03:00:00+10:00")</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-adjust-time-to-timezone
+ :)
+declare function fn:adjust-time-to-timezone($arg as xs:time?) as  xs:time? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Adjusts an <code>xs:time</code> value to a specific timezone, or
+ : to no timezone at all.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:adjust-time-to-timezone</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:time?</code>)<code class="as"> as </code><code class="return-type">xs:time?</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="2"><code class="function">fn:adjust-time-to-timezone</code>(</td>
+ : <td valign="baseline"><code class="arg">$arg</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:time?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$timezone</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:dayTimeDuration?</code>)<code class="as"> as </code><code class="return-type">xs:time?</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>The one-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.
+ : It depends on implicit-timezone.</p>
+ : <p>The two-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If <code>$timezone</code> is not specified, then the effective
+ : value of <code>$timezone</code> is the value of the implicit
+ : timezone in the dynamic context.</p>
+ : <p>If <code>$arg</code> is the empty sequence, then the function
+ : returns the empty sequence.</p>
+ : <p>If <code>$arg</code> does not have a timezone component and
+ : <code>$timezone</code> is the empty sequence, then the result is
+ : <code>$arg</code>.</p>
+ : <p>If <code>$arg</code> does not have a timezone component and
+ : <code>$timezone</code> is not the empty sequence, then the result
+ : is <code>$arg</code> with <code>$timezone</code> as the timezone
+ : component.</p>
+ : <p>If <code>$arg</code> has a timezone component and
+ : <code>$timezone</code> is the empty sequence, then the result is
+ : the localized value of <code>$arg</code> without its timezone
+ : component.</p>
+ : <p>If <code>$arg</code> has a timezone component and
+ : <code>$timezone</code> is not the empty sequence, then:</p>
+ : <ul>
+ : <li>
+ : <p>Let <code>$dt</code> be the <code>xs:dateTime</code> value
+ : <span href="#func-dateTime"><code>fn:dateTime(xs:date('1972-12-31'),
+ : $arg)</code></span>.</p>
+ : </li>
+ : <li>
+ : <p>Let <code>$adt</code> be the value of <span href="#func-adjust-dateTime-to-timezone"><code>fn:adjust-dateTime-to-timezone($dt,
+ : $timezone)</code></span></p>
+ : </li>
+ : <li>
+ : <p>The function returns the <code>xs:time</code> value
+ : <code>xs:time($adt)</code>.</p>
+ : </li>
+ : </ul>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>An error is raised [<span href="#ERRFODT0003" title="err:FODT0003">err:FODT0003</span>] if <code>$timezone</code> is less
+ : than <code>-PT14H</code> or greater than <code>PT14H</code> or if
+ : does not contain an integral number of minutes.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>Assume the dynamic context provides an implicit timezone of
+ : <code>-05:00 (-PT5H0M)</code>.</p>
+ : <p>let <code>$tz-10</code> :=
+ : <code>xs:dayTimeDuration("-PT10H")</code></p>
+ : <p>The expression
+ : <code>fn:adjust-time-to-timezone(xs:time("10:00:00"))</code>
+ : returns <code>xs:time("10:00:00-05:00")</code>.</p>
+ : <p>The expression
+ : <code>fn:adjust-time-to-timezone(xs:time("10:00:00-07:00"))</code>
+ : returns <code>xs:time("12:00:00-05:00")</code>.</p>
+ : <p>The expression
+ : <code>fn:adjust-time-to-timezone(xs:time("10:00:00"),
+ : $tz-10)</code> returns <code>xs:time("10:00:00-10:00")</code>.</p>
+ : <p>The expression
+ : <code>fn:adjust-time-to-timezone(xs:time("10:00:00-07:00"),
+ : $tz-10)</code> returns <code>xs:time("07:00:00-10:00")</code>.</p>
+ : <p>The expression
+ : <code>fn:adjust-time-to-timezone(xs:time("10:00:00"), ())</code>
+ : returns <code>xs:time("10:00:00")</code>.</p>
+ : <p>The expression
+ : <code>fn:adjust-time-to-timezone(xs:time("10:00:00-07:00"),
+ : ())</code> returns <code>xs:time("10:00:00")</code>.</p>
+ : <p>The expression
+ : <code>fn:adjust-time-to-timezone(xs:time("10:00:00-07:00"),
+ : xs:dayTimeDuration("PT10H"))</code> returns
+ : <code>xs:time("03:00:00+10:00")</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-adjust-time-to-timezone
+ :)
+declare function fn:adjust-time-to-timezone( $arg as xs:time?,  $timezone as xs:dayTimeDuration?) as  xs:time? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Analyzes a string using a regular expression, returning an XML
+ : structure that identifies which parts of the input string matched
+ : or failed to match the regular expression, and in the case of
+ : matched substrings, which substrings matched each capturing group
+ : in the regular expression.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="2"><code class="function">fn:analyze-string</code>(</td>
+ : <td valign="baseline"><code class="arg">$input</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$pattern</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">element(fn:analyze-string-result)</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="3"><code class="function">fn:analyze-string</code>(</td>
+ : <td valign="baseline"><code class="arg">$input</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$pattern</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$flags</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">element(fn:analyze-string-result)</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="nondeterministic" class="termref" href="#dt-nondeterministic"><span class="arrow">·</span>nondeterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The effect of calling the first version of this function
+ : (omitting the argument <code>$flags</code>) is the same as the
+ : effect of calling the second version with the <code>$flags</code>
+ : argument set to a zero-length string. Flags are defined in <span href="#flags"><b>5.6.1.1 Flags</b></span>.</p>
+ : <p>The <code>$flags</code> argument is interpreted in the same way
+ : as for the <span href="#func-matches"><code>fn:matches</code></span>
+ : function.</p>
+ : <p>If <code>$input</code> is the empty sequence the function
+ : behaves as if <code>$input</code> were the zero-length string. In
+ : this situation the result will be an element node with no
+ : children.</p>
+ : <p>The function returns an element node whose local name is
+ : <code>analyze-string-result</code>. This element and all its
+ : descendant elements have the namespace URI
+ : <code>http://www.w3.org/2005/xpath-functions</code>. The namespace
+ : prefix is <span title="implementation dependent" class="termref" href="#implementation-dependent"><span class="arrow">·</span>implementation dependent<span class="arrow">·</span></span>. The children of this element are a sequence
+ : of <code>fn:match</code> and <code>fn:non-match</code> elements.
+ : This sequence is formed by breaking the <code>$input</code> string
+ : into a sequence of strings, returning any substring that matches
+ : <code>$pattern</code> as the content of a <code>match</code>
+ : element, and any intervening substring as the content of a
+ : <code>non-match</code> element.</p>
+ : <p>More specifically, the function starts at the beginning of the
+ : input string and attempts to find the first substring that matches
+ : the regular expression. If there are several matches, the first
+ : match is defined to be the one whose starting position comes first
+ : in the string. If several alternatives within the regular
+ : expression both match at the same position in the input string,
+ : then the match that is chosen is the first alternative that
+ : matches. For example, if the input string is <code>The quick brown
+ : fox jumps</code> and the regular expression is
+ : <code>jump|jumps</code>, then the match that is chosen is
+ : <code>jump</code>.</p>
+ : <p>Having found the first match, the instruction proceeds to find
+ : the second and subsequent matches by repeating the search, starting
+ : at the first <span title="character" class="termref" href="#character"><span class="arrow">·</span>character<span class="arrow">·</span></span> that was not included in the previous
+ : match.</p>
+ : <p>The input string is thus partitioned into a sequence of
+ : substrings, some of which match the regular expression, others
+ : which do not match it. Each substring will contain at least one
+ : character. This sequence is represented in the result by the
+ : sequence of <code>fn:match</code> and <code>fn:non-match</code>
+ : children of the returned element node; the string value of the
+ : <code>fn:match</code> or <code>fn:non-match</code> element will be
+ : the corresponding substring of <code>$input</code>, and the string
+ : value of the returned element node will therefore be the same as
+ : <code>$input</code>.</p>
+ : <p>The content of an <code>fn:non-match</code> element is always a
+ : single text node.</p>
+ : <p>The content of a <code>fn:match</code> element, however, is in
+ : general a sequence of text nodes and <code>fn:group</code> element
+ : children. An <code>fn:group</code> element with a <code>nr</code>
+ : attribute having the integer value <var>N</var> identifies the
+ : substring captured by the <var>Nth</var> parenthesized
+ : sub-expression in the regular expression. For each capturing
+ : subexpression there will be at most one corresponding
+ : <code>fn:group</code> element in each <code>fn:match</code> element
+ : in the result.</p>
+ : <p>If the function is called twice with the same arguments, it is
+ : <span title="implementation dependent" class="termref" href="#implementation-dependent"><span class="arrow">·</span>implementation dependent<span class="arrow">·</span></span> whether the two calls return the same element
+ : node or distinct (but deep equal) element nodes. In this respect it
+ : is <span title="" class="termref" href="#"><span class="arrow">·</span>nondeterministic<span class="arrow">·</span></span>.</p>
+ : <p>The base URI of the element nodes in the result is <span title="implementation dependent" class="termref" href="#implementation-dependent"><span class="arrow">·</span>implementation dependent<span class="arrow">·</span></span></p>
+ : <p>A schema is defined for the structure of the returned element,
+ : containing the definitions below. The returned element and its
+ : descendants will have type annotations obtained by validating the
+ : returned element against this schema, unless the function is used
+ : in an environment where type annotations are not supported (for
+ : example, a Basic XSLT Processor), in which case the elements will
+ : all be annotated as <code>xs:untyped</code> and the attributes as
+ : <code>xs:untypedAtomic</code>.</p>
+ : <div class="exampleInner">
+ : <pre>
+ : &lt;?xml version="1.0" encoding="UTF-8"?&gt;
+ : &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
+ :     targetNamespace="http://www.w3.org/2005/xpath-functions";
+ :     xmlns:fn="http://www.w3.org/2005/xpath-functions";
+ :     elementFormDefault="qualified"&gt; 
+ : 
+ :     &lt;xs:element name="analyze-string-result" type="fn:analyze-string-result-type"/&gt;
+ :     &lt;xs:element name="match" type="fn:match-type"/&gt;
+ :     &lt;xs:element name="non-match" type="xs:string"/&gt;
+ :     &lt;xs:element name="group" type="fn:group-type"/&gt;
+ :     
+ :     &lt;xs:complexType name="analyze-string-result-type" mixed="true"&gt;
+ :         &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
+ :             &lt;xs:element ref="fn:match"/&gt;
+ :             &lt;xs:element ref="fn:non-match"/&gt;
+ :         &lt;/xs:choice&gt;
+ :     &lt;/xs:complexType&gt;
+ :         
+ :     &lt;xs:complexType name="match-type" mixed="true"&gt;
+ :         &lt;xs:sequence&gt;
+ :             &lt;xs:element ref="fn:group" minOccurs="0" maxOccurs="unbounded"/&gt;
+ :         &lt;/xs:sequence&gt;
+ :     &lt;/xs:complexType&gt;
+ :     
+ :     &lt;xs:complexType name="group-type" mixed="true"&gt;
+ :         &lt;xs:sequence&gt;
+ :             &lt;xs:element ref="fn:group" minOccurs="0" maxOccurs="unbounded"/&gt;
+ :         &lt;/xs:sequence&gt;
+ :         &lt;xs:attribute name="nr" type="xs:positiveInteger"/&gt;
+ :     &lt;/xs:complexType&gt;    
+ :  
+ : &lt;/xs:schema&gt;
+ : </pre></div>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>An error is raised [<span href="#ERRFORX0002" title="err:FORX0002">err:FORX0002</span>] if the value of
+ : <code>$pattern</code> is invalid according to the rules described
+ : in section <span href="#regex-syntax"><b>5.6.1 Regular expression
+ : syntax</b></span>.</p>
+ : <p>An error is raised [<span href="#ERRFORX0001" title="err:FORX0001">err:FORX0001</span>] if the value of
+ : <code>$flags</code> is invalid according to the rules described in
+ : section <span href="#regex-syntax"><b>5.6.1 Regular expression
+ : syntax</b></span>.</p>
+ : <p>An error is raised [<span href="#ERRFORX0003" title="err:FORX0003">err:FORX0003</span>] if the supplied
+ : <code>$pattern</code> matches a zero-length string, that is, if
+ : <span href="#func-matches"><code>fn:matches("", $pattern,
+ : $flags)</code></span> returns <code>true</code>.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>In the following examples, the result document is shown in
+ : serialized form, with whitespace between the element nodes. This
+ : whitespace is not actually present in the result.</p>
+ : <p>The expression <code>fn:analyze-string("The cat sat on the
+ : mat.", "\w+")</code> returns <code>&lt;analyze-string-result
+ : xmlns="http://www.w3.org/2005/xpath-functions"&gt;
+ : &lt;match&gt;The&lt;/match&gt; &lt;non-match&gt; &lt;/non-match&gt;
+ : &lt;match&gt;cat&lt;/match&gt; &lt;non-match&gt; &lt;/non-match&gt;
+ : &lt;match&gt;sat&lt;/match&gt; &lt;non-match&gt; &lt;/non-match&gt;
+ : &lt;match&gt;on&lt;/match&gt; &lt;non-match&gt; &lt;/non-match&gt;
+ : &lt;match&gt;the&lt;/match&gt; &lt;non-match&gt; &lt;/non-match&gt;
+ : &lt;match&gt;mat&lt;/match&gt; &lt;non-match&gt;.&lt;/non-match&gt;
+ : &lt;/analyze-string-result&gt;</code>.</p>
+ : <p>The expression <code>fn:analyze-string("2008-12-03",
+ : "^(\d+)\-(\d+)\-(\d+)$")</code> returns
+ : <code>&lt;analyze-string-result
+ : xmlns="http://www.w3.org/2005/xpath-functions"&gt;
+ : &lt;match&gt;&lt;group nr="1"&gt;2008&lt;/group&gt;-&lt;group
+ : nr="2"&gt;12&lt;/group&gt;-&lt;group
+ : nr="3"&gt;03&lt;/group&gt;&lt;/match&gt;
+ : &lt;/analyze-string-result&gt;</code>.</p>
+ : <p>The expression <code>fn:analyze-string("A1,C15,,D24, X50,",
+ : "([A-Z])([0-9]+)")</code> returns <code>&lt;analyze-string-result
+ : xmlns="http://www.w3.org/2005/xpath-functions"&gt;
+ : &lt;match&gt;&lt;group nr="1"&gt;A&lt;/group&gt;&lt;group
+ : nr="2"&gt;1&lt;/group&gt;&lt;/match&gt;
+ : &lt;non-match&gt;,&lt;/non-match&gt; &lt;match&gt;&lt;group
+ : nr="1"&gt;C&lt;/group&gt;&lt;group
+ : nr="2"&gt;15&lt;/group&gt;&lt;/match&gt;
+ : &lt;non-match&gt;,,&lt;/non-match&gt; &lt;match&gt;&lt;group
+ : nr="1"&gt;D&lt;/group&gt;&lt;group
+ : nr="2"&gt;24&lt;/group&gt;&lt;/match&gt; &lt;non-match&gt;,
+ : &lt;/non-match&gt; &lt;match&gt;&lt;group
+ : nr="1"&gt;X&lt;/group&gt;&lt;group
+ : nr="2"&gt;50&lt;/group&gt;&lt;/match&gt;
+ : &lt;non-match&gt;,&lt;/non-match&gt;
+ : &lt;/analyze-string-result&gt;</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-analyze-string
+ :)
+declare function fn:analyze-string( $input as xs:string?,  $pattern as xs:string) as  element(fn:analyze-string-result) external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Analyzes a string using a regular expression, returning an XML
+ : structure that identifies which parts of the input string matched
+ : or failed to match the regular expression, and in the case of
+ : matched substrings, which substrings matched each capturing group
+ : in the regular expression.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="2"><code class="function">fn:analyze-string</code>(</td>
+ : <td valign="baseline"><code class="arg">$input</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$pattern</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">element(fn:analyze-string-result)</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="3"><code class="function">fn:analyze-string</code>(</td>
+ : <td valign="baseline"><code class="arg">$input</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$pattern</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$flags</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">element(fn:analyze-string-result)</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="nondeterministic" class="termref" href="#dt-nondeterministic"><span class="arrow">·</span>nondeterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The effect of calling the first version of this function
+ : (omitting the argument <code>$flags</code>) is the same as the
+ : effect of calling the second version with the <code>$flags</code>
+ : argument set to a zero-length string. Flags are defined in <span href="#flags"><b>5.6.1.1 Flags</b></span>.</p>
+ : <p>The <code>$flags</code> argument is interpreted in the same way
+ : as for the <span href="#func-matches"><code>fn:matches</code></span>
+ : function.</p>
+ : <p>If <code>$input</code> is the empty sequence the function
+ : behaves as if <code>$input</code> were the zero-length string. In
+ : this situation the result will be an element node with no
+ : children.</p>
+ : <p>The function returns an element node whose local name is
+ : <code>analyze-string-result</code>. This element and all its
+ : descendant elements have the namespace URI
+ : <code>http://www.w3.org/2005/xpath-functions</code>. The namespace
+ : prefix is <span title="implementation dependent" class="termref" href="#implementation-dependent"><span class="arrow">·</span>implementation dependent<span class="arrow">·</span></span>. The children of this element are a sequence
+ : of <code>fn:match</code> and <code>fn:non-match</code> elements.
+ : This sequence is formed by breaking the <code>$input</code> string
+ : into a sequence of strings, returning any substring that matches
+ : <code>$pattern</code> as the content of a <code>match</code>
+ : element, and any intervening substring as the content of a
+ : <code>non-match</code> element.</p>
+ : <p>More specifically, the function starts at the beginning of the
+ : input string and attempts to find the first substring that matches
+ : the regular expression. If there are several matches, the first
+ : match is defined to be the one whose starting position comes first
+ : in the string. If several alternatives within the regular
+ : expression both match at the same position in the input string,
+ : then the match that is chosen is the first alternative that
+ : matches. For example, if the input string is <code>The quick brown
+ : fox jumps</code> and the regular expression is
+ : <code>jump|jumps</code>, then the match that is chosen is
+ : <code>jump</code>.</p>
+ : <p>Having found the first match, the instruction proceeds to find
+ : the second and subsequent matches by repeating the search, starting
+ : at the first <span title="character" class="termref" href="#character"><span class="arrow">·</span>character<span class="arrow">·</span></span> that was not included in the previous
+ : match.</p>
+ : <p>The input string is thus partitioned into a sequence of
+ : substrings, some of which match the regular expression, others
+ : which do not match it. Each substring will contain at least one
+ : character. This sequence is represented in the result by the
+ : sequence of <code>fn:match</code> and <code>fn:non-match</code>
+ : children of the returned element node; the string value of the
+ : <code>fn:match</code> or <code>fn:non-match</code> element will be
+ : the corresponding substring of <code>$input</code>, and the string
+ : value of the returned element node will therefore be the same as
+ : <code>$input</code>.</p>
+ : <p>The content of an <code>fn:non-match</code> element is always a
+ : single text node.</p>
+ : <p>The content of a <code>fn:match</code> element, however, is in
+ : general a sequence of text nodes and <code>fn:group</code> element
+ : children. An <code>fn:group</code> element with a <code>nr</code>
+ : attribute having the integer value <var>N</var> identifies the
+ : substring captured by the <var>Nth</var> parenthesized
+ : sub-expression in the regular expression. For each capturing
+ : subexpression there will be at most one corresponding
+ : <code>fn:group</code> element in each <code>fn:match</code> element
+ : in the result.</p>
+ : <p>If the function is called twice with the same arguments, it is
+ : <span title="implementation dependent" class="termref" href="#implementation-dependent"><span class="arrow">·</span>implementation dependent<span class="arrow">·</span></span> whether the two calls return the same element
+ : node or distinct (but deep equal) element nodes. In this respect it
+ : is <span title="" class="termref" href="#"><span class="arrow">·</span>nondeterministic<span class="arrow">·</span></span>.</p>
+ : <p>The base URI of the element nodes in the result is <span title="implementation dependent" class="termref" href="#implementation-dependent"><span class="arrow">·</span>implementation dependent<span class="arrow">·</span></span></p>
+ : <p>A schema is defined for the structure of the returned element,
+ : containing the definitions below. The returned element and its
+ : descendants will have type annotations obtained by validating the
+ : returned element against this schema, unless the function is used
+ : in an environment where type annotations are not supported (for
+ : example, a Basic XSLT Processor), in which case the elements will
+ : all be annotated as <code>xs:untyped</code> and the attributes as
+ : <code>xs:untypedAtomic</code>.</p>
+ : <div class="exampleInner">
+ : <pre>
+ : &lt;?xml version="1.0" encoding="UTF-8"?&gt;
+ : &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
+ :     targetNamespace="http://www.w3.org/2005/xpath-functions";
+ :     xmlns:fn="http://www.w3.org/2005/xpath-functions";
+ :     elementFormDefault="qualified"&gt; 
+ : 
+ :     &lt;xs:element name="analyze-string-result" type="fn:analyze-string-result-type"/&gt;
+ :     &lt;xs:element name="match" type="fn:match-type"/&gt;
+ :     &lt;xs:element name="non-match" type="xs:string"/&gt;
+ :     &lt;xs:element name="group" type="fn:group-type"/&gt;
+ :     
+ :     &lt;xs:complexType name="analyze-string-result-type" mixed="true"&gt;
+ :         &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
+ :             &lt;xs:element ref="fn:match"/&gt;
+ :             &lt;xs:element ref="fn:non-match"/&gt;
+ :         &lt;/xs:choice&gt;
+ :     &lt;/xs:complexType&gt;
+ :         
+ :     &lt;xs:complexType name="match-type" mixed="true"&gt;
+ :         &lt;xs:sequence&gt;
+ :             &lt;xs:element ref="fn:group" minOccurs="0" maxOccurs="unbounded"/&gt;
+ :         &lt;/xs:sequence&gt;
+ :     &lt;/xs:complexType&gt;
+ :     
+ :     &lt;xs:complexType name="group-type" mixed="true"&gt;
+ :         &lt;xs:sequence&gt;
+ :             &lt;xs:element ref="fn:group" minOccurs="0" maxOccurs="unbounded"/&gt;
+ :         &lt;/xs:sequence&gt;
+ :         &lt;xs:attribute name="nr" type="xs:positiveInteger"/&gt;
+ :     &lt;/xs:complexType&gt;    
+ :  
+ : &lt;/xs:schema&gt;
+ : </pre></div>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>An error is raised [<span href="#ERRFORX0002" title="err:FORX0002">err:FORX0002</span>] if the value of
+ : <code>$pattern</code> is invalid according to the rules described
+ : in section <span href="#regex-syntax"><b>5.6.1 Regular expression
+ : syntax</b></span>.</p>
+ : <p>An error is raised [<span href="#ERRFORX0001" title="err:FORX0001">err:FORX0001</span>] if the value of
+ : <code>$flags</code> is invalid according to the rules described in
+ : section <span href="#regex-syntax"><b>5.6.1 Regular expression
+ : syntax</b></span>.</p>
+ : <p>An error is raised [<span href="#ERRFORX0003" title="err:FORX0003">err:FORX0003</span>] if the supplied
+ : <code>$pattern</code> matches a zero-length string, that is, if
+ : <span href="#func-matches"><code>fn:matches("", $pattern,
+ : $flags)</code></span> returns <code>true</code>.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>In the following examples, the result document is shown in
+ : serialized form, with whitespace between the element nodes. This
+ : whitespace is not actually present in the result.</p>
+ : <p>The expression <code>fn:analyze-string("The cat sat on the
+ : mat.", "\w+")</code> returns <code>&lt;analyze-string-result
+ : xmlns="http://www.w3.org/2005/xpath-functions"&gt;
+ : &lt;match&gt;The&lt;/match&gt; &lt;non-match&gt; &lt;/non-match&gt;
+ : &lt;match&gt;cat&lt;/match&gt; &lt;non-match&gt; &lt;/non-match&gt;
+ : &lt;match&gt;sat&lt;/match&gt; &lt;non-match&gt; &lt;/non-match&gt;
+ : &lt;match&gt;on&lt;/match&gt; &lt;non-match&gt; &lt;/non-match&gt;
+ : &lt;match&gt;the&lt;/match&gt; &lt;non-match&gt; &lt;/non-match&gt;
+ : &lt;match&gt;mat&lt;/match&gt; &lt;non-match&gt;.&lt;/non-match&gt;
+ : &lt;/analyze-string-result&gt;</code>.</p>
+ : <p>The expression <code>fn:analyze-string("2008-12-03",
+ : "^(\d+)\-(\d+)\-(\d+)$")</code> returns
+ : <code>&lt;analyze-string-result
+ : xmlns="http://www.w3.org/2005/xpath-functions"&gt;
+ : &lt;match&gt;&lt;group nr="1"&gt;2008&lt;/group&gt;-&lt;group
+ : nr="2"&gt;12&lt;/group&gt;-&lt;group
+ : nr="3"&gt;03&lt;/group&gt;&lt;/match&gt;
+ : &lt;/analyze-string-result&gt;</code>.</p>
+ : <p>The expression <code>fn:analyze-string("A1,C15,,D24, X50,",
+ : "([A-Z])([0-9]+)")</code> returns <code>&lt;analyze-string-result
+ : xmlns="http://www.w3.org/2005/xpath-functions"&gt;
+ : &lt;match&gt;&lt;group nr="1"&gt;A&lt;/group&gt;&lt;group
+ : nr="2"&gt;1&lt;/group&gt;&lt;/match&gt;
+ : &lt;non-match&gt;,&lt;/non-match&gt; &lt;match&gt;&lt;group
+ : nr="1"&gt;C&lt;/group&gt;&lt;group
+ : nr="2"&gt;15&lt;/group&gt;&lt;/match&gt;
+ : &lt;non-match&gt;,,&lt;/non-match&gt; &lt;match&gt;&lt;group
+ : nr="1"&gt;D&lt;/group&gt;&lt;group
+ : nr="2"&gt;24&lt;/group&gt;&lt;/match&gt; &lt;non-match&gt;,
+ : &lt;/non-match&gt; &lt;match&gt;&lt;group
+ : nr="1"&gt;X&lt;/group&gt;&lt;group
+ : nr="2"&gt;50&lt;/group&gt;&lt;/match&gt;
+ : &lt;non-match&gt;,&lt;/non-match&gt;
+ : &lt;/analyze-string-result&gt;</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-analyze-string
+ :)
+declare function fn:analyze-string( $input as xs:string?,  $pattern as xs:string,  $flags as xs:string) as  element(fn:analyze-string-result) external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns a list of environment variable names that are suitable
+ : for passing to <span href="#func-environment-variable"><code>fn:environment-variable</code></span>,
+ : as a (possibly empty) sequence of strings.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:available-environment-variables</code>()<code class="as"> as </code><code class="return-type">xs:string*</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.
+ : It depends on environment-variables.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The function returns a sequence of strings, being the names of
+ : the environment variables in the dynamic context in some <span title="implementation dependent" class="termref" href="#implementation-dependent"><span class="arrow">·</span>implementation-dependent<span class="arrow">·</span></span> order.</p>
+ : <p>The function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>: that
+ : is, the set of available environment variables does not vary during
+ : evaluation.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>The function returns a list of strings, containing no
+ : duplicates.</p>
+ : <p>It is intended that the strings in this list should be suitable
+ : for passing to <span href="#func-environment-variable"><code>fn:environment-variable</code></span>.</p>
+ : <p>See also the note on security under the definition of the
+ : <span href="#func-environment-variable"><code>fn:environment-variable</code></span>
+ : function. If access to environment variables has been disabled,
+ : <code>fn:available-environment-variables</code> always returns the
+ : empty sequence.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-available-environment-variables
+ :)
+declare function fn:available-environment-variables() as  xs:string* external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns the average of the values in the input sequence
+ : <code>$arg</code>, that is, the sum of the values divided by the
+ : number of values.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:avg</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:anyAtomicType*</code>)<code class="as"> as </code><code class="return-type">xs:anyAtomicType?</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If <code>$arg</code> is the empty sequence, the empty sequence
+ : is returned.</p>
+ : <p>If <code>$arg</code> contains values of type
+ : <code>xs:untypedAtomic</code> they are cast to
+ : <code>xs:double</code>.</p>
+ : <p>Duration values must either all be
+ : <code>xs:yearMonthDuration</code> values or must all be
+ : <code>xs:dayTimeDuration</code> values. For numeric values, the
+ : numeric promotion rules defined in <span href="#op.numeric"><b>4.2
+ : Arithmetic operators on numeric values</b></span> are used to promote
+ : all values to a single common type. After these operations,
+ : <code>$arg</code> must contain items of a single type, which must
+ : be one of the four numeric types, <code>xs:yearMonthDuration</code>
+ : or <code>xs:dayTimeDuration</code> or one if its subtypes.</p>
+ : <p>The function returns the average of the values as
+ : <code>sum($arg) div count($arg)</code>; but the implementation may
+ : use an otherwise equivalent algorithm that avoids arithmetic
+ : overflow.</p>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>A type error is raised [<span href="#ERRFORG0006" title="err:FORG0006">err:FORG0006</span>] if the input sequence contains
+ : items of incompatible types, as described above.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>let <code>$d1</code> :=
+ : <code>xs:yearMonthDuration("P20Y")</code></p>
+ : <p>let <code>$d2</code> :=
+ : <code>xs:yearMonthDuration("P10M")</code></p>
+ : <p>let <code>$seq3</code> := <code>(3, 4, 5)</code></p>
+ : <p>The expression <code>fn:avg($seq3)</code> returns
+ : <code>4.0</code>. <em>(The result is of type
+ : <code>xs:decimal</code>.).</em></p>
+ : <p>The expression <code>fn:avg(($d1, $d2))</code> returns
+ : <code>xs:yearMonthDuration("P10Y5M")</code>.</p>
+ : <p><code>fn:avg(($d1, $seq3))</code> raises a type error [<span href="#ERRFORG0006" title="err:FORG0006">err:FORG0006</span>].</p>
+ : <p>The expression <code>fn:avg(())</code> returns
+ : <code>()</code>.</p>
+ : <p>The expression <code>fn:avg((xs:float('INF'),
+ : xs:float('-INF')))</code> returns <code>xs:float('NaN')</code>.</p>
+ : <p>The expression <code>fn:avg(($seq3, xs:float('NaN')))</code>
+ : returns <code>xs:float('NaN')</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-avg
+ :)
+declare function fn:avg($arg as xs:anyAtomicType*) as  xs:anyAtomicType? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Computes the effective boolean value of the sequence
+ : <code>$arg</code>.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:boolean</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">item()*</code>)<code class="as"> as </code><code class="return-type">xs:boolean</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The function computes the effective boolean value of a sequence,
+ : defined according to the following rules. See also <span href="http://www.w3.org/TR/xpath-30/#id-ebv";>Section 2.4.3 Effective
+ : Boolean Value</span> <sup><small>XP30</small></sup>.</p>
+ : <ul>
+ : <li>
+ : <p>If <code>$arg</code> is the empty sequence,
+ : <code>fn:boolean</code> returns <code>false</code>.</p>
+ : </li>
+ : <li>
+ : <p>If <code>$arg</code> is a sequence whose first item is a node,
+ : <code>fn:boolean</code> returns <code>true</code>.</p>
+ : </li>
+ : <li>
+ : <p>If <code>$arg</code> is a singleton value of type
+ : <code>xs:boolean</code> or a derived from <code>xs:boolean</code>,
+ : <code>fn:boolean</code> returns <code>$arg</code>.</p>
+ : </li>
+ : <li>
+ : <p>If <code>$arg</code> is a singleton value of type
+ : <code>xs:string</code> or a type derived from
+ : <code>xs:string</code>, <code>xs:anyURI</code> or a type derived
+ : from <code>xs:anyURI</code> or <code>xs:untypedAtomic</code>,
+ : <code>fn:boolean</code> returns <code>false</code> if the operand
+ : value has zero length; otherwise it returns <code>true</code>.</p>
+ : </li>
+ : <li>
+ : <p>If <code>$arg</code> is a singleton value of any numeric type or
+ : a type derived from a numeric type, <code>fn:boolean</code> returns
+ : <code>false</code> if the operand value is <code>NaN</code> or is
+ : numerically equal to zero; otherwise it returns
+ : <code>true</code>.</p>
+ : </li>
+ : <li>
+ : <p>In all other cases, <code>fn:boolean</code> raises a type error
+ : [<span href="#ERRFORG0006" title="err:FORG0006">err:FORG0006</span>].</p>
+ : </li>
+ : </ul>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>The result of this function is not necessarily the same as
+ : <code>$arg cast as xs:boolean</code>. For example,
+ : <code>fn:boolean("false")</code> returns the value
+ : <code>true</code> whereas <code>"false" cast as xs:boolean</code>
+ : (which can also be written <code>xs:boolean("false")</code>)
+ : returns <code>false</code>.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>let <code>$abc</code> := <code>("a", "b", "")</code></p>
+ : <p><code>fn:boolean($abc)</code> raises a type error [<span href="#ERRFORG0006" title="err:FORG0006">err:FORG0006</span>].</p>
+ : <p>The expression <code>fn:boolean($abc[1])</code> returns
+ : <code>true()</code>.</p>
+ : <p>The expression <code>fn:boolean($abc[0])</code> returns
+ : <code>false()</code>.</p>
+ : <p>The expression <code>fn:boolean($abc[3])</code> returns
+ : <code>false()</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-boolean
+ :)
+declare function fn:boolean($arg as item()*) as  xs:boolean external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Rounds <code>$arg</code> upwards to a whole number.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:ceiling</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">numeric?</code>)<code class="as"> as </code><code class="return-type">numeric?</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>General rules: see <span href="#numeric-value-functions"><b>4.4
+ : Functions on numeric values</b></span>.</p>
+ : <p>The function returns the smallest (closest to negative infinity)
+ : number with no fractional part that is not less than the value of
+ : <code>$arg</code>.</p>
+ : <p>If the type of <code>$arg</code> is one of the four numeric
+ : types <code>xs:float</code>, <code>xs:double</code>,
+ : <code>xs:decimal</code> or <code>xs:integer</code> the type of the
+ : result is the same as the type of <code>$arg</code>. If the type of
+ : <code>$arg</code> is a type derived from one of the numeric types,
+ : the result is an instance of the base numeric type.</p>
+ : <p>For <code>xs:float</code> and <code>xs:double</code> arguments,
+ : if the argument is positive zero, then positive zero is returned.
+ : If the argument is negative zero, then negative zero is returned.
+ : If the argument is less than zero and greater than -1, negative
+ : zero is returned.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:ceiling(10.5)</code> returns
+ : <code>11</code>.</p>
+ : <p>The expression <code>fn:ceiling(-10.5)</code> returns
+ : <code>-10</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-ceiling
+ :)
+declare function fn:ceiling($arg as numeric?) as  numeric? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns true if two strings are equal, considered
+ : codepoint-by-codepoint.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="2"><code class="function">fn:codepoint-equal</code>(</td>
+ : <td valign="baseline"><code class="arg">$comparand1</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$comparand2</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>)<code class="as"> as </code><code class="return-type">xs:boolean?</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If either argument is the empty sequence, the function returns
+ : the empty sequence.</p>
+ : <p>Otherwise, the function returns <code>true</code> or
+ : <code>false</code> depending on whether the value of
+ : <code>$comparand1</code> is equal to the value of
+ : <code>$comparand2</code>, according to the Unicode codepoint
+ : collation
+ : (<code>http://www.w3.org/2005/xpath-functions/collation/codepoint</code>).</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>This function allows <code>xs:anyURI</code> values to be
+ : compared without having to specify the Unicode codepoint
+ : collation.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:codepoint-equal("abcd", "abcd")</code>
+ : returns <code>true()</code>.</p>
+ : <p>The expression <code>fn:codepoint-equal("abcd", "abcd ")</code>
+ : returns <code>false()</code>.</p>
+ : <p>The expression <code>fn:codepoint-equal("", "")</code> returns
+ : <code>true()</code>.</p>
+ : <p>The expression <code>fn:codepoint-equal("", ())</code> returns
+ : <code>()</code>.</p>
+ : <p>The expression <code>fn:codepoint-equal((), ())</code> returns
+ : <code>()</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-codepoint-equal
+ :)
+declare function fn:codepoint-equal( $comparand1 as xs:string?,  $comparand2 as xs:string?) as  xs:boolean? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Creates an <code>xs:string</code> from a sequence of <span title="codepoint" class="termref" href="#codepoint"><span class="arrow">·</span>codepoints<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:codepoints-to-string</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:integer*</code>)<code class="as"> as </code><code class="return-type">xs:string</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The function returns the string made up from the <span title="character" class="termref" href="#character"><span class="arrow">·</span>characters<span class="arrow">·</span></span> whose
+ : Unicode <span title="codepoint" class="termref" href="#codepoint"><span class="arrow">·</span>codepoints<span class="arrow">·</span></span> are supplied in <code>$arg</code>. This will
+ : be the zero-length string if <code>$arg</code> is the empty
+ : sequence.</p>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>An error is raised [<span href="#ERRFOCH0001" title="err:FOCH0001">err:FOCH0001</span>] if any of the codepoints in
+ : <code>$arg</code> is not a permitted XML character.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:codepoints-to-string((66, 65, 67,
+ : 72))</code> returns <code>"BACH"</code>.</p>
+ : <p>The expression <code>fn:codepoints-to-string((2309, 2358, 2378,
+ : 2325))</code> returns <code>"अशॊक"</code>.</p>
+ : <p>The expression <code>fn:codepoints-to-string(())</code> returns
+ : <code>""</code>.</p>
+ : <p>The expression <code>fn:codepoints-to-string(0)</code> raises
+ : error <code>FOCH0001</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-codepoints-to-string
+ :)
+declare function fn:codepoints-to-string($arg as xs:integer*) as  xs:string external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns a sequence of nodes representing a collection of
+ : documents indentified by a collection URI; or a default collection
+ : if no URI is supplied.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:collection</code>()<code class="as"> as </code><code class="return-type">node()*</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:collection</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:string?</code>)<code class="as"> as </code><code class="return-type">node()*</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.
+ : It depends on available-collections.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>This function takes an <code>xs:string</code> as argument and
+ : returns a sequence of nodes obtained by interpreting
+ : <code>$arg</code> as an <code>xs:anyURI</code> and resolving it
+ : according to the mapping specified in <b>Available collections</b>
+ : described in <span href="http://www.w3.org/TR/xpath-30/#id-xp-evaluation-context-components";>
+ : Section C.2 Dynamic Context Components</span>
+ : <sup><small>XP30</small></sup>.</p>
+ : <p>If <b>Available collections</b> provides a mapping from this
+ : string to a sequence of nodes, the function returns that sequence.
+ : If <b>Available collections</b> maps the string to an empty
+ : sequence, then the function returns an empty sequence.</p>
+ : <p>If <code>$arg</code> is not specified, the function returns the
+ : sequence of the nodes in the default collection in the dynamic
+ : context. See <span href="http://www.w3.org/TR/xpath-30/#id-xp-evaluation-context-components";>
+ : Section C.2 Dynamic Context Components</span>
+ : <sup><small>XP30</small></sup>.</p>
+ : <p>If the value of <code>$arg</code> is a relative
+ : <code>xs:anyURI</code>, it is resolved against the value of the
+ : base-URI property from the static context.</p>
+ : <p>If <code>$arg</code> is the empty sequence, the function behaves
+ : as if it had been called without an argument. See above.</p>
+ : <p>By default, this function is <span title="" class="termref" href="#"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>. This means that repeated calls on the
+ : function with the same argument will return the same result.
+ : However, for performance reasons, implementations may provide a
+ : user option to evaluate the function without a guarantee of
+ : determinism. The manner in which any such option is provided is
+ : <span title="implementation-defined" class="termref" href="#implementation-defined"><span class="arrow">·</span>implementation-defined<span class="arrow">·</span></span>. If the user has not selected such an option,
+ : a call to this function must either return a deterministic result
+ : or must raise an error [<span href="#ERRFODC0003" title="err:FODC0003">err:FODC0003</span>].</p>
+ : <p>There is no requirement that the returned nodes should be in
+ : document order, nor is there a requirement that the result should
+ : contain no duplicates.</p>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>An error is raised [<span href="#ERRFODC0002" title="err:FODC0002">err:FODC0002</span>] if no URI is supplied and the
+ : value of the default collection is <span href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent";>absent</span><sup><small>DM30</small></sup>.</p>
+ : <p>An error is raised [<span href="#ERRFODC0002" title="err:FODC0002">err:FODC0002</span>] if <b>available collections</b>
+ : provides no mapping for the absolutized URI.</p>
+ : <p>An error is raised [<span href="#ERRFODC0004" title="err:FODC0004">err:FODC0004</span>] if <code>$arg</code> is not a
+ : valid <code>xs:anyURI</code>.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>This function provides a facility for users to work with a
+ : collection of documents which may be contained in a directory or
+ : rows of a Relational table or other implementation-specific
+ : construct. An implementation may also use external variables to
+ : identify external resources, but <code>fn:collection</code>
+ : provides functionality not provided by external variables.
+ : Specifying resources using URIs is useful because URIs are dynamic,
+ : can be parameterized, and do not rely on an external
+ : environment.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-collection
+ :)
+declare function fn:collection() as  node()* external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns a sequence of nodes representing a collection of
+ : documents indentified by a collection URI; or a default collection
+ : if no URI is supplied.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:collection</code>()<code class="as"> as </code><code class="return-type">node()*</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:collection</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:string?</code>)<code class="as"> as </code><code class="return-type">node()*</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.
+ : It depends on available-collections.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>This function takes an <code>xs:string</code> as argument and
+ : returns a sequence of nodes obtained by interpreting
+ : <code>$arg</code> as an <code>xs:anyURI</code> and resolving it
+ : according to the mapping specified in <b>Available collections</b>
+ : described in <span href="http://www.w3.org/TR/xpath-30/#id-xp-evaluation-context-components";>
+ : Section C.2 Dynamic Context Components</span>
+ : <sup><small>XP30</small></sup>.</p>
+ : <p>If <b>Available collections</b> provides a mapping from this
+ : string to a sequence of nodes, the function returns that sequence.
+ : If <b>Available collections</b> maps the string to an empty
+ : sequence, then the function returns an empty sequence.</p>
+ : <p>If <code>$arg</code> is not specified, the function returns the
+ : sequence of the nodes in the default collection in the dynamic
+ : context. See <span href="http://www.w3.org/TR/xpath-30/#id-xp-evaluation-context-components";>
+ : Section C.2 Dynamic Context Components</span>
+ : <sup><small>XP30</small></sup>.</p>
+ : <p>If the value of <code>$arg</code> is a relative
+ : <code>xs:anyURI</code>, it is resolved against the value of the
+ : base-URI property from the static context.</p>
+ : <p>If <code>$arg</code> is the empty sequence, the function behaves
+ : as if it had been called without an argument. See above.</p>
+ : <p>By default, this function is <span title="" class="termref" href="#"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>. This means that repeated calls on the
+ : function with the same argument will return the same result.
+ : However, for performance reasons, implementations may provide a
+ : user option to evaluate the function without a guarantee of
+ : determinism. The manner in which any such option is provided is
+ : <span title="implementation-defined" class="termref" href="#implementation-defined"><span class="arrow">·</span>implementation-defined<span class="arrow">·</span></span>. If the user has not selected such an option,
+ : a call to this function must either return a deterministic result
+ : or must raise an error [<span href="#ERRFODC0003" title="err:FODC0003">err:FODC0003</span>].</p>
+ : <p>There is no requirement that the returned nodes should be in
+ : document order, nor is there a requirement that the result should
+ : contain no duplicates.</p>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>An error is raised [<span href="#ERRFODC0002" title="err:FODC0002">err:FODC0002</span>] if no URI is supplied and the
+ : value of the default collection is <span href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent";>absent</span><sup><small>DM30</small></sup>.</p>
+ : <p>An error is raised [<span href="#ERRFODC0002" title="err:FODC0002">err:FODC0002</span>] if <b>available collections</b>
+ : provides no mapping for the absolutized URI.</p>
+ : <p>An error is raised [<span href="#ERRFODC0004" title="err:FODC0004">err:FODC0004</span>] if <code>$arg</code> is not a
+ : valid <code>xs:anyURI</code>.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>This function provides a facility for users to work with a
+ : collection of documents which may be contained in a directory or
+ : rows of a Relational table or other implementation-specific
+ : construct. An implementation may also use external variables to
+ : identify external resources, but <code>fn:collection</code>
+ : provides functionality not provided by external variables.
+ : Specifying resources using URIs is useful because URIs are dynamic,
+ : can be parameterized, and do not rely on an external
+ : environment.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-collection
+ :)
+declare function fn:collection($arg as xs:string?) as  node()* external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns -1, 0, or 1, depending on whether
+ : <code>$comparand1</code> collates before, equal to, or after
+ : <code>$comparand2</code> according to the rules of a selected
+ : collation.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:compare</code>(<code class="arg">$comparand1</code><code class="as"> as </code><code class="type">xs:string?</code>, <code class="arg">$comparand2</code><code class="as"> as </code><code class="type">xs:string?</code>)<code class="as"> as </code><code class="return-type">xs:integer?</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="3"><code class="function">fn:compare</code>(</td>
+ : <td valign="baseline"><code class="arg">$comparand1</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$comparand2</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$collation</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:integer?</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.
+ : It depends on collations.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>Returns -1, 0, or 1, depending on whether the value of the
+ : <code>$comparand1</code> is respectively less than, equal to, or
+ : greater than the value of <code>$comparand2</code>, according to
+ : the rules of the collation that is used.</p>
+ : <p>The collation used by this function is determined according to
+ : the rules in <span href="#choosing-a-collation"><b>5.3.3 Choosing a
+ : collation</b></span>.</p>
+ : <p>If either <code>$comparand1</code> or <code>$comparand2</code>
+ : is the empty sequence, the function returns the empty sequence.</p>
+ : <p>This function, called with the first signature, defines the
+ : semantics of the "eq", "ne", "gt", "lt", "le" and "ge" operators on
+ : <code>xs:string</code> values.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:compare('abc', 'abc')</code> returns
+ : <code>0</code>.</p>
+ : <p>The expression <code>fn:compare('Strasse', 'Straße')</code>
+ : returns <code>0</code>. <em>(Assuming the default collation
+ : includes provisions that equate "ss" and the (German) character "ß"
+ : ("sharp-s"). Otherwise, the returned value depends on the semantics
+ : of the default collation.).</em></p>
+ : <p>The expression <code>fn:compare('Strasse', 'Straße',
+ : 'http://example.com/deutsch')</code> returns <code>0</code>.
+ : <em>(Assuming the collation identified by the URI
+ : <code>http://example.com/deutsch</code> includes provisions that
+ : equate "ss" and the (German) character "ß" ("sharp-s"). Otherwise,
+ : the returned value depends on the semantics of that
+ : collation.).</em></p>
+ : <p>The expression <code>fn:compare('Strassen', 'Straße')</code>
+ : returns <code>1</code>. <em>(Assuming the default collation
+ : includes provisions that treat differences between "ss" and the
+ : (German) character "ß" ("sharp-s") with less strength than the
+ : differences between the base characters, such as the final "n".
+ : ).</em></p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-compare
+ :)
+declare function fn:compare($comparand1 as xs:string?,  $comparand2 as xs:string?) as  xs:integer? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns -1, 0, or 1, depending on whether
+ : <code>$comparand1</code> collates before, equal to, or after
+ : <code>$comparand2</code> according to the rules of a selected
+ : collation.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:compare</code>(<code class="arg">$comparand1</code><code class="as"> as </code><code class="type">xs:string?</code>, <code class="arg">$comparand2</code><code class="as"> as </code><code class="type">xs:string?</code>)<code class="as"> as </code><code class="return-type">xs:integer?</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="3"><code class="function">fn:compare</code>(</td>
+ : <td valign="baseline"><code class="arg">$comparand1</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$comparand2</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$collation</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:integer?</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.
+ : It depends on collations.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>Returns -1, 0, or 1, depending on whether the value of the
+ : <code>$comparand1</code> is respectively less than, equal to, or
+ : greater than the value of <code>$comparand2</code>, according to
+ : the rules of the collation that is used.</p>
+ : <p>The collation used by this function is determined according to
+ : the rules in <span href="#choosing-a-collation"><b>5.3.3 Choosing a
+ : collation</b></span>.</p>
+ : <p>If either <code>$comparand1</code> or <code>$comparand2</code>
+ : is the empty sequence, the function returns the empty sequence.</p>
+ : <p>This function, called with the first signature, defines the
+ : semantics of the "eq", "ne", "gt", "lt", "le" and "ge" operators on
+ : <code>xs:string</code> values.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:compare('abc', 'abc')</code> returns
+ : <code>0</code>.</p>
+ : <p>The expression <code>fn:compare('Strasse', 'Straße')</code>
+ : returns <code>0</code>. <em>(Assuming the default collation
+ : includes provisions that equate "ss" and the (German) character "ß"
+ : ("sharp-s"). Otherwise, the returned value depends on the semantics
+ : of the default collation.).</em></p>
+ : <p>The expression <code>fn:compare('Strasse', 'Straße',
+ : 'http://example.com/deutsch')</code> returns <code>0</code>.
+ : <em>(Assuming the collation identified by the URI
+ : <code>http://example.com/deutsch</code> includes provisions that
+ : equate "ss" and the (German) character "ß" ("sharp-s"). Otherwise,
+ : the returned value depends on the semantics of that
+ : collation.).</em></p>
+ : <p>The expression <code>fn:compare('Strassen', 'Straße')</code>
+ : returns <code>1</code>. <em>(Assuming the default collation
+ : includes provisions that treat differences between "ss" and the
+ : (German) character "ß" ("sharp-s") with less strength than the
+ : differences between the base characters, such as the final "n".
+ : ).</em></p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-compare
+ :)
+declare function fn:compare( $comparand1 as xs:string?,  $comparand2 as xs:string?,  $collation as xs:string) as  xs:integer? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns the concatenation of the string values of the
+ : arguments.</p>
+ : </dd>
+ : <dt class="label">Operator Mapping</dt>
+ : <dd>
+ : <p>The two-argument form of this function defines the semantics of
+ : the "||" operator.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="3"><code class="function">fn:concat</code>(</td>
+ : <td valign="baseline"><code class="arg">$arg1</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:anyAtomicType?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$arg2</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:anyAtomicType?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><span class="varargs">...</span></td>
+ : <td valign="baseline">)<code class="as"> as </code><code class="return-type">xs:string</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>This function accepts two or more <code>xs:anyAtomicType</code>
+ : arguments and casts each one to <code>xs:string</code>. The
+ : function returns the <code>xs:string</code> that is the
+ : concatenation of the values of its arguments after conversion. If
+ : any argument is the empty sequence, that argument is treated as the
+ : zero-length string.</p>
+ : <p>The <code>fn:concat</code> function is specified to allow two or
+ : more arguments, which are concatenated together. This is the only
+ : function specified in this document that allows a variable number
+ : of arguments. This capability is retained for compatibility with
+ : <span href="#xpath">[XML Path Language (XPath) Version 1.0]</span>.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>As mentioned in <span href="#string-types"><b>5.1 String
+ : types</b></span> Unicode normalization is not automatically applied to
+ : the result of <code>fn:concat</code>. If a normalized result is
+ : required, <span href="#func-normalize-unicode"><code>fn:normalize-unicode</code></span> can
+ : be applied to the <code>xs:string</code> returned by
+ : <code>fn:concat</code>. The following XQuery:</p>
+ : <div class="exampleInner">
+ : <pre>
+ : let $v1 := "I plan to go to Mu"
+ : let $v2 := "?nchen in September"
+ : return concat($v1, $v2)
+ : </pre></div>
+ : <p>where the "?" represents either the actual Unicode character
+ : COMBINING DIARESIS (Unicode codepoint U+0308) or "&amp;#x0308;",
+ : will return:</p>
+ : <p>"I plan to go to Mu?nchen in September"</p>
+ : <p>where the "?" represents either the actual Unicode character
+ : COMBINING DIARESIS (Unicode codepoint U+0308) or "&amp;#x0308;". It
+ : is worth noting that the returned value is not normalized in NFC;
+ : however, it is normalized in NFD. .</p>
+ : <p>However, the following XQuery:</p>
+ : <div class="exampleInner">
+ : <pre>
+ : let $v1 := "I plan to go to Mu"
+ : let $v2 := "?nchen in September"
+ : return normalize-unicode(concat($v1, $v2))
+ : </pre></div>
+ : <p>where the "?" represents either the actual Unicode character
+ : COMBINING DIARESIS (Unicode codepoint U+0308) or "&amp;#x0308;",
+ : will return:</p>
+ : <p>"I plan to go to München in September"</p>
+ : <p>This returned result is normalized in NFC.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:concat('un', 'grateful')</code> returns
+ : <code>"ungrateful"</code>.</p>
+ : <p>The expression <code>fn:concat('Thy ', (), 'old ', "groans", "",
+ : ' ring', ' yet', ' in', ' my', ' ancient',' ears.')</code> returns
+ : <code>"Thy old groans ring yet in my ancient ears."</code>.</p>
+ : <p>The expression <code>fn:concat('Ciao!',())</code> returns
+ : <code>"Ciao!"</code>.</p>
+ : <p>The expression <code>fn:concat('Ingratitude, ', 'thou ',
+ : 'marble-hearted', ' fiend!')</code> returns <code>"Ingratitude,
+ : thou marble-hearted fiend!"</code>.</p>
+ : <p>The expression <code>fn:concat(01, 02, 03, 04, true())</code>
+ : returns <code>"1234true"</code>.</p>
+ : <p>The expression <code>10 || '/' || 6</code> returns
+ : <code>"10/6"</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-concat
+ :)
+declare function fn:concat( $arg1 as xs:anyAtomicType?,  $arg2 as xs:anyAtomicType?) as  xs:string external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns true if the string <code>$arg1</code> contains
+ : <code>$arg2</code> as a substring, taking collations into
+ : account.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:contains</code>(<code class="arg">$arg1</code><code class="as"> as </code><code class="type">xs:string?</code>, <code class="arg">$arg2</code><code class="as"> as </code><code class="type">xs:string?</code>)<code class="as"> as </code><code class="return-type">xs:boolean</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="3"><code class="function">fn:contains</code>(</td>
+ : <td valign="baseline"><code class="arg">$arg1</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$arg2</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$collation</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:boolean</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.
+ : It depends on collations.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If the value of <code>$arg1</code> or <code>$arg2</code> is the
+ : empty sequence, or contains only ignorable collation units, it is
+ : interpreted as the zero-length string.</p>
+ : <p>If the value of <code>$arg2</code> is the zero-length string,
+ : then the function returns <code>true</code>.</p>
+ : <p>If the value of <code>$arg1</code> is the zero-length string,
+ : the function returns <code>false</code>.</p>
+ : <p>The collation used by this function is determined according to
+ : the rules in <span href="#choosing-a-collation"><b>5.3.3 Choosing a
+ : collation</b></span>.</p>
+ : <p>The function returns an <code>xs:boolean</code> indicating
+ : whether or not the value of <code>$arg1</code> contains (at the
+ : beginning, at the end, or anywhere within) at least one sequence of
+ : collation units that provides a <b>minimal match</b> to the
+ : collation units in the value of <code>$arg2</code>, according to
+ : the collation that is used.</p>
+ : <div class="note">
+ : <p class="prefix"><b>Note:</b></p>
+ : <p><b>Minimal match</b> is defined in <span href="#Unicode-Collations">[Unicode Collation Algorithm]</span>.</p>
+ : </div>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>An error <strong>may</strong> be raised [<span href="#ERRFOCH0004" title="err:FOCH0004">err:FOCH0004</span>] if the specified collation
+ : does not support collation units.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The collation used in these examples,
+ : <code>http://example.com/CollationA</code> is a collation in which
+ : both "-" and "*" are ignorable collation units.</p>
+ : <p>"Ignorable collation unit" is equivalent to "ignorable collation
+ : element" in <span href="#Unicode-Collations">[Unicode Collation
+ : Algorithm]</span>.</p>
+ : <p>The expression <code>fn:contains ( "tattoo", "t")</code> returns
+ : <code>true()</code>.</p>
+ : <p>The expression <code>fn:contains ( "tattoo", "ttt")</code>
+ : returns <code>false()</code>.</p>
+ : <p>The expression <code>fn:contains ( "", ())</code> returns
+ : <code>true()</code>. <em>(The first rule is applied, followed by
+ : the second rule.).</em></p>
+ : <p>The expression <code>fn:contains ( "abcdefghi", "-d-e-f-",
+ : "http://example.com/CollationA";)</code> returns
+ : <code>true()</code>.</p>
+ : <p>The expression <code>fn:contains ( "a*b*c*d*e*f*g*h*i*",
+ : "d-ef-", "http://example.com/CollationA";)</code> returns
+ : <code>true()</code>.</p>
+ : <p>The expression <code>fn:contains ( "abcd***e---f*--*ghi", "def",
+ : "http://example.com/CollationA";)</code> returns
+ : <code>true()</code>.</p>
+ : <p>The expression <code>fn:contains ( (), "--***-*---",
+ : "http://example.com/CollationA";)</code> returns
+ : <code>true()</code>. <em>(The second argument contains only
+ : ignorable collation units and is equivalent to the zero-length
+ : string.).</em></p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-contains
+ :)
+declare function fn:contains($arg1 as xs:string?,  $arg2 as xs:string?) as  xs:boolean external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns true if the string <code>$arg1</code> contains
+ : <code>$arg2</code> as a substring, taking collations into
+ : account.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:contains</code>(<code class="arg">$arg1</code><code class="as"> as </code><code class="type">xs:string?</code>, <code class="arg">$arg2</code><code class="as"> as </code><code class="type">xs:string?</code>)<code class="as"> as </code><code class="return-type">xs:boolean</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="3"><code class="function">fn:contains</code>(</td>
+ : <td valign="baseline"><code class="arg">$arg1</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$arg2</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$collation</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:boolean</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.
+ : It depends on collations.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If the value of <code>$arg1</code> or <code>$arg2</code> is the
+ : empty sequence, or contains only ignorable collation units, it is
+ : interpreted as the zero-length string.</p>
+ : <p>If the value of <code>$arg2</code> is the zero-length string,
+ : then the function returns <code>true</code>.</p>
+ : <p>If the value of <code>$arg1</code> is the zero-length string,
+ : the function returns <code>false</code>.</p>
+ : <p>The collation used by this function is determined according to
+ : the rules in <span href="#choosing-a-collation"><b>5.3.3 Choosing a
+ : collation</b></span>.</p>
+ : <p>The function returns an <code>xs:boolean</code> indicating
+ : whether or not the value of <code>$arg1</code> contains (at the
+ : beginning, at the end, or anywhere within) at least one sequence of
+ : collation units that provides a <b>minimal match</b> to the
+ : collation units in the value of <code>$arg2</code>, according to
+ : the collation that is used.</p>
+ : <div class="note">
+ : <p class="prefix"><b>Note:</b></p>
+ : <p><b>Minimal match</b> is defined in <span href="#Unicode-Collations">[Unicode Collation Algorithm]</span>.</p>
+ : </div>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>An error <strong>may</strong> be raised [<span href="#ERRFOCH0004" title="err:FOCH0004">err:FOCH0004</span>] if the specified collation
+ : does not support collation units.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The collation used in these examples,
+ : <code>http://example.com/CollationA</code> is a collation in which
+ : both "-" and "*" are ignorable collation units.</p>
+ : <p>"Ignorable collation unit" is equivalent to "ignorable collation
+ : element" in <span href="#Unicode-Collations">[Unicode Collation
+ : Algorithm]</span>.</p>
+ : <p>The expression <code>fn:contains ( "tattoo", "t")</code> returns
+ : <code>true()</code>.</p>
+ : <p>The expression <code>fn:contains ( "tattoo", "ttt")</code>
+ : returns <code>false()</code>.</p>
+ : <p>The expression <code>fn:contains ( "", ())</code> returns
+ : <code>true()</code>. <em>(The first rule is applied, followed by
+ : the second rule.).</em></p>
+ : <p>The expression <code>fn:contains ( "abcdefghi", "-d-e-f-",
+ : "http://example.com/CollationA";)</code> returns
+ : <code>true()</code>.</p>
+ : <p>The expression <code>fn:contains ( "a*b*c*d*e*f*g*h*i*",
+ : "d-ef-", "http://example.com/CollationA";)</code> returns
+ : <code>true()</code>.</p>
+ : <p>The expression <code>fn:contains ( "abcd***e---f*--*ghi", "def",
+ : "http://example.com/CollationA";)</code> returns
+ : <code>true()</code>.</p>
+ : <p>The expression <code>fn:contains ( (), "--***-*---",
+ : "http://example.com/CollationA";)</code> returns
+ : <code>true()</code>. <em>(The second argument contains only
+ : ignorable collation units and is equivalent to the zero-length
+ : string.).</em></p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-contains
+ :)
+declare function fn:contains( $arg1 as xs:string?,  $arg2 as xs:string?,  $collation as xs:string) as  xs:boolean external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns the number of items in a sequence.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:count</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">item()*</code>)<code class="as"> as </code><code class="return-type">xs:integer</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The function returns the number of items in the value of
+ : <code>$arg</code>.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>Returns 0 if <code>$arg</code> is the empty sequence.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>let <code>$seq1</code> := <code>($item1, $item2)</code></p>
+ : <p>let <code>$seq2</code> := <code>(98.5, 98.3, 98.9)</code></p>
+ : <p>let <code>$seq3</code> := <code>()</code></p>
+ : <p>The expression <code>fn:count($seq1)</code> returns
+ : <code>2</code>.</p>
+ : <p>The expression <code>fn:count($seq3)</code> returns
+ : <code>0</code>.</p>
+ : <p>The expression <code>fn:count($seq2)</code> returns
+ : <code>3</code>.</p>
+ : <p>The expression <code>fn:count($seq2[. &gt; 100])</code> returns
+ : <code>0</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-count
+ :)
+declare function fn:count($arg as item()*) as  xs:integer external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns an <code>xs:dateTime</code> value created by combining
+ : an <code>xs:date</code> and an <code>xs:time</code>.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:dateTime</code>(<code class="arg">$arg1</code><code class="as"> as </code><code class="type">xs:date?</code>, <code class="arg">$arg2</code><code class="as"> as </code><code class="type">xs:time?</code>)<code class="as"> as </code><code class="return-type">xs:dateTime?</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If either <code>$arg1</code> or <code>$arg2</code> is the empty
+ : sequence the function returns the empty sequence.</p>
+ : <p>Otherwise, the function returns an <code>xs:dateTime</code>
+ : whose date component is equal to <code>$arg1</code> and whose time
+ : component is equal to <code>$arg2</code>.</p>
+ : <p>The timezone of the result is computed as follows:</p>
+ : <ul>
+ : <li>
+ : <p>If neither argument has a timezone, the result has no
+ : timezone.</p>
+ : </li>
+ : <li>
+ : <p>If exactly one of the arguments has a timezone, or if both
+ : arguments have the same timezone, the result has this timezone.</p>
+ : </li>
+ : </ul>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>An error is raised [<span href="#ERRFORG0008" title="err:FORG0008">err:FORG0008</span>] if the two arguments both have
+ : timezones and the timezones are different.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:dateTime(xs:date("1999-12-31"),
+ : xs:time("12:00:00"))</code> returns
+ : <code>xs:dateTime("1999-12-31T12:00:00")</code>.</p>
+ : <p>The expression <code>fn:dateTime(xs:date("1999-12-31"),
+ : xs:time("24:00:00"))</code> returns
+ : <code>xs:dateTime("1999-12-31T00:00:00")</code>. <em>(This is
+ : because <code>"24:00:00"</code> is an alternate lexical form for
+ : <code>"00:00:00"</code>).</em></p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-dateTime
+ :)
+declare function fn:dateTime($arg1 as xs:date?,  $arg2 as xs:time?) as  xs:dateTime? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns the day component of an <code>xs:date</code>.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:day-from-date</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:date?</code>)<code class="as"> as </code><code class="return-type">xs:integer?</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If <code>$arg</code> is the empty sequence, the function returns
+ : the empty sequence.</p>
+ : <p>Otherwise, the function returns an <code>xs:integer</code>
+ : between 1 and 31, both inclusive, representing the day component in
+ : the localized value of <code>$arg</code>.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression
+ : <code>fn:day-from-date(xs:date("1999-05-31-05:00"))</code> returns
+ : <code>31</code>.</p>
+ : <p>The expression
+ : <code>fn:day-from-date(xs:date("2000-01-01+05:00"))</code> returns
+ : <code>1</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-day-from-date
+ :)
+declare function fn:day-from-date($arg as xs:date?) as  xs:integer? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns the number of days in a duration.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:days-from-duration</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:duration?</code>)<code class="as"> as </code><code class="return-type">xs:integer?</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If <code>$arg</code> is the empty sequence, the function returns
+ : the empty sequence.</p>
+ : <p>Otherwise, the function returns an <code>xs:integer</code>
+ : representing the days component in the value of <code>$arg</code>.
+ : The result is obtained by casting <code>$arg</code> to an
+ : <code>xs:dayTimeDuration</code> (see <span href="#casting-to-durations"><b>18.1.3 Casting to duration
+ : types</b></span>) and then computing the days component as described
+ : in <span href="#canonical-dayTimeDuration"><b>8.1.2.3 Canonical
+ : representation</b></span>.</p>
+ : <p>If <code>$arg</code> is a negative duration then the result will
+ : be negative..</p>
+ : <p>If <code>$arg</code> is an <code>xs:yearMonthDuration</code> the
+ : function returns 0.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression
+ : <code>fn:days-from-duration(xs:dayTimeDuration("P3DT10H"))</code>
+ : returns <code>3</code>.</p>
+ : <p>The expression
+ : <code>fn:days-from-duration(xs:dayTimeDuration("P3DT55H"))</code>
+ : returns <code>5</code>.</p>
+ : <p>The expression
+ : <code>fn:days-from-duration(xs:yearMonthDuration("P3Y5M"))</code>
+ : returns <code>0</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-days-from-duration
+ :)
+declare function fn:days-from-duration($arg as xs:duration?) as  xs:integer? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>This function assesses whether two sequences are deep-equal to
+ : each other. To be deep-equal, they must contain items that are
+ : pairwise deep-equal; and for two items to be deep-equal, they must
+ : either be atomic values that compare equal, or nodes of the same
+ : kind, with the same name, whose children are deep-equal.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:deep-equal</code>(<code class="arg">$parameter1</code><code class="as"> as </code><code class="type">item()*</code>, <code class="arg">$parameter2</code><code class="as"> as </code><code class="type">item()*</code>)<code class="as"> as </code><code class="return-type">xs:boolean</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="3"><code class="function">fn:deep-equal</code>(</td>
+ : <td valign="baseline"><code class="arg">$parameter1</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">item()*</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$parameter2</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">item()*</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$collation</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:boolean</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.
+ : It depends on collations.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The <code>$collation</code> argument identifies a collation
+ : which is used at all levels of recursion when strings are compared
+ : (but not when names are compared), according to the rules in
+ : <span href="#choosing-a-collation"><b>5.3.3 Choosing a
+ : collation</b></span>.</p>
+ : <p>If the two sequences are both empty, the function returns
+ : <code>true</code>.</p>
+ : <p>If the two sequences are of different lengths, the function
+ : returns <code>false</code>.</p>
+ : <p>If the two sequences are of the same length, the function
+ : returns <code>true</code> if and only if every item in the sequence
+ : <code>$parameter1</code> is deep-equal to the item at the same
+ : position in the sequence <code>$parameter2</code>. The rules for
+ : deciding whether two items are deep-equal follow.</p>
+ : <p>Call the two items <code>$i1</code> and <code>$i2</code>
+ : respectively.</p>
+ : <p>If <code>$i1</code> and <code>$i2</code> are both atomic values,
+ : they are deep-equal if and only if <code>($i1 eq $i2)</code> is
+ : <code>true</code>, or if both values are <code>NaN</code>. If the
+ : <code>eq</code> operator is not defined for <code>$i1</code> and
+ : <code>$i2</code>, the function returns <code>false</code>.</p>
+ : <p>If one of the pair <code>$i1</code> or <code>$i2</code> is an
+ : atomic value and the other is not, the function returns
+ : <code>false</code>.</p>
+ : <p>If <code>$i1</code> and <code>$i2</code> are both nodes, they
+ : are compared as described below:</p>
+ : <ol class="enumar">
+ : <li>
+ : <p>If the two nodes are of different kinds, the result is
+ : <code>false</code>.</p>
+ : </li>
+ : <li>
+ : <p>If the two nodes are both document nodes then they are
+ : deep-equal if and only if the sequence <code>$i1/(*|text())</code>
+ : is deep-equal to the sequence <code>$i2/(*|text())</code>.</p>
+ : </li>
+ : <li>
+ : <p>If the two nodes are both element nodes then they are deep-equal
+ : if and only if all of the following conditions are satisfied:</p>
+ : <ol class="enumla">
+ : <li>
+ : <p>The two nodes have the same name, that is <code>(node-name($i1)
+ : eq node-name($i2))</code>.</p>
+ : </li>
+ : <li>
+ : <p>The two nodes are both annotated as having simple content or
+ : both nodes are annotated as having complex content.</p>
+ : </li>
+ : <li>
+ : <p>The two nodes have the same number of attributes, and for every
+ : attribute <code>$a1</code> in <code>$i1/@*</code> there exists an
+ : attribute <code>$a2</code> in <code>$i2/@*</code> such that
+ : <code>$a1</code> and <code>$a2</code> are deep-equal.</p>
+ : </li>
+ : <li>
+ : <p>One of the following conditions holds:</p>
+ : <ul>
+ : <li>
+ : <p>Both element nodes have a type annotation that is simple
+ : content, and the typed value of <code>$i1</code> is deep-equal to
+ : the typed value of <code>$i2</code>.</p>
+ : </li>
+ : <li>
+ : <p>Both element nodes have a type annotation that is complex
+ : content with elementOnly content, and each child element of
+ : <code>$i1</code> is deep-equal to the corresponding child element
+ : of <code>$i2</code>.</p>
+ : </li>
+ : <li>
+ : <p>Both element nodes have a type annotation that is complex
+ : content with mixed content, and the sequence
+ : <code>$i1/(*|text())</code> is deep-equal to the sequence
+ : <code>$i2/(*|text())</code>.</p>
+ : </li>
+ : <li>
+ : <p>Both element nodes have a type annotation that is complex
+ : content with empty content.</p>
+ : </li>
+ : </ul>
+ : </li>
+ : </ol>
+ : </li>
+ : <li>
+ : <p>If the two nodes are both attribute nodes then they are
+ : deep-equal if and only if both the following conditions are
+ : satisfied:</p>
+ : <ol class="enumla">
+ : <li>
+ : <p>The two nodes have the same name, that is <code>(node-name($i1)
+ : eq node-name($i2))</code>.</p>
+ : </li>
+ : <li>
+ : <p>The typed value of <code>$i1</code> is deep-equal to the typed
+ : value of <code>$i2</code>.</p>
+ : </li>
+ : </ol>
+ : </li>
+ : <li>
+ : <p>If the two nodes are both processing instruction nodes, then
+ : they are deep-equal if and only if both the following conditions
+ : are satisfied:</p>
+ : <ol class="enumla">
+ : <li>
+ : <p>The two nodes have the same name, that is <code>(node-name($i1)
+ : eq node-name($i2))</code>.</p>
+ : </li>
+ : <li>
+ : <p>The string value of <code>$i1</code> is equal to the string
+ : value of <code>$i2</code>.</p>
+ : </li>
+ : </ol>
+ : </li>
+ : <li>
+ : <p>If the two nodes are both namespace nodes, then they are
+ : deep-equal if and only if both the following conditions are
+ : satisfied:</p>
+ : <ol class="enumla">
+ : <li>
+ : <p>The two nodes either have the same name or are both nameless,
+ : that is <code>fn:deep-equal(node-name($i1),
+ : node-name($i2))</code>.</p>
+ : </li>
+ : <li>
+ : <p>The string value of <code>$i1</code> is equal to the string
+ : value of <code>$i2</code> when compared using the Unicode codepoint
+ : collation.</p>
+ : </li>
+ : </ol>
+ : </li>
+ : <li>
+ : <p>If the two nodes are both text nodes or comment nodes, then they
+ : are deep-equal if and only if their string-values are equal.</p>
+ : </li>
+ : </ol>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>An error is raised [<span href="#ERRFOTY0015" title="err:FOTY0015">err:FOTY0015</span>] if either input sequence contains
+ : a function item.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>The two nodes are not required to have the same type annotation,
+ : and they are not required to have the same in-scope namespaces.
+ : They may also differ in their parent, their base URI, and the
+ : values returned by the <code>is-id</code> and
+ : <code>is-idrefs</code> accessors (see <span href="http://www.w3.org/TR/xpath-datamodel-30/#dm-is-id";>Section 5.5
+ : is-id Accessor</span> <sup><small>DM30</small></sup> and <span href="http://www.w3.org/TR/xpath-datamodel-30/#dm-is-idrefs";>Section 5.6
+ : is-idrefs Accessor</span> <sup><small>DM30</small></sup>). The order
+ : of children is significant, but the order of attributes is
+ : insignificant.</p>
+ : <p>The contents of comments and processing instructions are
+ : significant only if these nodes appear directly as items in the two
+ : sequences being compared. The content of a comment or processing
+ : instruction that appears as a descendant of an item in one of the
+ : sequences being compared does not affect the result. However, the
+ : presence of a comment or processing instruction, if it causes a
+ : text node to be split into two text nodes, may affect the
+ : result.</p>
+ : <p>The result of <code>fn:deep-equal(1, current-dateTime())</code>
+ : is <code>false</code>; it does not raise an error.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>let <code>$at</code> :=</p>
+ : <div class="exampleInner">
+ : <pre>
+ : &lt;attendees&gt; &lt;name last='Parker'
+ :             first='Peter'/&gt; &lt;name last='Barker' first='Bob'/&gt; &lt;name last='Parker'
+ :             first='Peter'/&gt; &lt;/attendees&gt;
+ : </pre></div>
+ : <p>The expression <code>fn:deep-equal($at, $at/*)</code> returns
+ : <code>false()</code>.</p>
+ : <p>The expression <code>fn:deep-equal($at/name[1],
+ : $at/name[2])</code> returns <code>false()</code>.</p>
+ : <p>The expression <code>fn:deep-equal($at/name[1],
+ : $at/name[3])</code> returns <code>true()</code>.</p>
+ : <p>The expression <code>fn:deep-equal($at/name[1], 'Peter
+ : Parker')</code> returns <code>false()</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-deep-equal
+ :)
+declare function fn:deep-equal($parameter1 as item()*,  $parameter2 as item()*) as  xs:boolean external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>This function assesses whether two sequences are deep-equal to
+ : each other. To be deep-equal, they must contain items that are
+ : pairwise deep-equal; and for two items to be deep-equal, they must
+ : either be atomic values that compare equal, or nodes of the same
+ : kind, with the same name, whose children are deep-equal.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:deep-equal</code>(<code class="arg">$parameter1</code><code class="as"> as </code><code class="type">item()*</code>, <code class="arg">$parameter2</code><code class="as"> as </code><code class="type">item()*</code>)<code class="as"> as </code><code class="return-type">xs:boolean</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="3"><code class="function">fn:deep-equal</code>(</td>
+ : <td valign="baseline"><code class="arg">$parameter1</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">item()*</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$parameter2</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">item()*</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$collation</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:boolean</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.
+ : It depends on collations.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The <code>$collation</code> argument identifies a collation
+ : which is used at all levels of recursion when strings are compared
+ : (but not when names are compared), according to the rules in
+ : <span href="#choosing-a-collation"><b>5.3.3 Choosing a
+ : collation</b></span>.</p>
+ : <p>If the two sequences are both empty, the function returns
+ : <code>true</code>.</p>
+ : <p>If the two sequences are of different lengths, the function
+ : returns <code>false</code>.</p>
+ : <p>If the two sequences are of the same length, the function
+ : returns <code>true</code> if and only if every item in the sequence
+ : <code>$parameter1</code> is deep-equal to the item at the same
+ : position in the sequence <code>$parameter2</code>. The rules for
+ : deciding whether two items are deep-equal follow.</p>
+ : <p>Call the two items <code>$i1</code> and <code>$i2</code>
+ : respectively.</p>
+ : <p>If <code>$i1</code> and <code>$i2</code> are both atomic values,
+ : they are deep-equal if and only if <code>($i1 eq $i2)</code> is
+ : <code>true</code>, or if both values are <code>NaN</code>. If the
+ : <code>eq</code> operator is not defined for <code>$i1</code> and
+ : <code>$i2</code>, the function returns <code>false</code>.</p>
+ : <p>If one of the pair <code>$i1</code> or <code>$i2</code> is an
+ : atomic value and the other is not, the function returns
+ : <code>false</code>.</p>
+ : <p>If <code>$i1</code> and <code>$i2</code> are both nodes, they
+ : are compared as described below:</p>
+ : <ol class="enumar">
+ : <li>
+ : <p>If the two nodes are of different kinds, the result is
+ : <code>false</code>.</p>
+ : </li>
+ : <li>
+ : <p>If the two nodes are both document nodes then they are
+ : deep-equal if and only if the sequence <code>$i1/(*|text())</code>
+ : is deep-equal to the sequence <code>$i2/(*|text())</code>.</p>
+ : </li>
+ : <li>
+ : <p>If the two nodes are both element nodes then they are deep-equal
+ : if and only if all of the following conditions are satisfied:</p>
+ : <ol class="enumla">
+ : <li>
+ : <p>The two nodes have the same name, that is <code>(node-name($i1)
+ : eq node-name($i2))</code>.</p>
+ : </li>
+ : <li>
+ : <p>The two nodes are both annotated as having simple content or
+ : both nodes are annotated as having complex content.</p>
+ : </li>
+ : <li>
+ : <p>The two nodes have the same number of attributes, and for every
+ : attribute <code>$a1</code> in <code>$i1/@*</code> there exists an
+ : attribute <code>$a2</code> in <code>$i2/@*</code> such that
+ : <code>$a1</code> and <code>$a2</code> are deep-equal.</p>
+ : </li>
+ : <li>
+ : <p>One of the following conditions holds:</p>
+ : <ul>
+ : <li>
+ : <p>Both element nodes have a type annotation that is simple
+ : content, and the typed value of <code>$i1</code> is deep-equal to
+ : the typed value of <code>$i2</code>.</p>
+ : </li>
+ : <li>
+ : <p>Both element nodes have a type annotation that is complex
+ : content with elementOnly content, and each child element of
+ : <code>$i1</code> is deep-equal to the corresponding child element
+ : of <code>$i2</code>.</p>
+ : </li>
+ : <li>
+ : <p>Both element nodes have a type annotation that is complex
+ : content with mixed content, and the sequence
+ : <code>$i1/(*|text())</code> is deep-equal to the sequence
+ : <code>$i2/(*|text())</code>.</p>
+ : </li>
+ : <li>
+ : <p>Both element nodes have a type annotation that is complex
+ : content with empty content.</p>
+ : </li>
+ : </ul>
+ : </li>
+ : </ol>
+ : </li>
+ : <li>
+ : <p>If the two nodes are both attribute nodes then they are
+ : deep-equal if and only if both the following conditions are
+ : satisfied:</p>
+ : <ol class="enumla">
+ : <li>
+ : <p>The two nodes have the same name, that is <code>(node-name($i1)
+ : eq node-name($i2))</code>.</p>
+ : </li>
+ : <li>
+ : <p>The typed value of <code>$i1</code> is deep-equal to the typed
+ : value of <code>$i2</code>.</p>
+ : </li>
+ : </ol>
+ : </li>
+ : <li>
+ : <p>If the two nodes are both processing instruction nodes, then
+ : they are deep-equal if and only if both the following conditions
+ : are satisfied:</p>
+ : <ol class="enumla">
+ : <li>
+ : <p>The two nodes have the same name, that is <code>(node-name($i1)
+ : eq node-name($i2))</code>.</p>
+ : </li>
+ : <li>
+ : <p>The string value of <code>$i1</code> is equal to the string
+ : value of <code>$i2</code>.</p>
+ : </li>
+ : </ol>
+ : </li>
+ : <li>
+ : <p>If the two nodes are both namespace nodes, then they are
+ : deep-equal if and only if both the following conditions are
+ : satisfied:</p>
+ : <ol class="enumla">
+ : <li>
+ : <p>The two nodes either have the same name or are both nameless,
+ : that is <code>fn:deep-equal(node-name($i1),
+ : node-name($i2))</code>.</p>
+ : </li>
+ : <li>
+ : <p>The string value of <code>$i1</code> is equal to the string
+ : value of <code>$i2</code> when compared using the Unicode codepoint
+ : collation.</p>
+ : </li>
+ : </ol>
+ : </li>
+ : <li>
+ : <p>If the two nodes are both text nodes or comment nodes, then they
+ : are deep-equal if and only if their string-values are equal.</p>
+ : </li>
+ : </ol>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>An error is raised [<span href="#ERRFOTY0015" title="err:FOTY0015">err:FOTY0015</span>] if either input sequence contains
+ : a function item.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>The two nodes are not required to have the same type annotation,
+ : and they are not required to have the same in-scope namespaces.
+ : They may also differ in their parent, their base URI, and the
+ : values returned by the <code>is-id</code> and
+ : <code>is-idrefs</code> accessors (see <span href="http://www.w3.org/TR/xpath-datamodel-30/#dm-is-id";>Section 5.5
+ : is-id Accessor</span> <sup><small>DM30</small></sup> and <span href="http://www.w3.org/TR/xpath-datamodel-30/#dm-is-idrefs";>Section 5.6
+ : is-idrefs Accessor</span> <sup><small>DM30</small></sup>). The order
+ : of children is significant, but the order of attributes is
+ : insignificant.</p>
+ : <p>The contents of comments and processing instructions are
+ : significant only if these nodes appear directly as items in the two
+ : sequences being compared. The content of a comment or processing
+ : instruction that appears as a descendant of an item in one of the
+ : sequences being compared does not affect the result. However, the
+ : presence of a comment or processing instruction, if it causes a
+ : text node to be split into two text nodes, may affect the
+ : result.</p>
+ : <p>The result of <code>fn:deep-equal(1, current-dateTime())</code>
+ : is <code>false</code>; it does not raise an error.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>let <code>$at</code> :=</p>
+ : <div class="exampleInner">
+ : <pre>
+ : &lt;attendees&gt; &lt;name last='Parker'
+ :             first='Peter'/&gt; &lt;name last='Barker' first='Bob'/&gt; &lt;name last='Parker'
+ :             first='Peter'/&gt; &lt;/attendees&gt;
+ : </pre></div>
+ : <p>The expression <code>fn:deep-equal($at, $at/*)</code> returns
+ : <code>false()</code>.</p>
+ : <p>The expression <code>fn:deep-equal($at/name[1],
+ : $at/name[2])</code> returns <code>false()</code>.</p>
+ : <p>The expression <code>fn:deep-equal($at/name[1],
+ : $at/name[3])</code> returns <code>true()</code>.</p>
+ : <p>The expression <code>fn:deep-equal($at/name[1], 'Peter
+ : Parker')</code> returns <code>false()</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-deep-equal
+ :)
+declare function fn:deep-equal( $parameter1 as item()*,  $parameter2 as item()*,  $collation as xs:string) as  xs:boolean external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns the values that appear in a sequence, with duplicates
+ : eliminated.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:distinct-values</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:anyAtomicType*</code>)<code class="as"> as </code><code class="return-type">xs:anyAtomicType*</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="2"><code class="function">fn:distinct-values</code>(</td>
+ : <td valign="baseline"><code class="arg">$arg</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:anyAtomicType*</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$collation</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:anyAtomicType*</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.
+ : It depends on collations.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The function returns the sequence that results from removing
+ : from <code>$arg</code> all but one of a set of values that are
+ : equal to one another. Values are compared using the <code>eq</code>
+ : operator, subject to the caveats defined below.</p>
+ : <p>Values of type <code>xs:untypedAtomic</code> are compared as if
+ : they were of type <code>xs:string</code>.</p>
+ : <p>Values that cannot be compared, because the <code>eq</code>
+ : operator is not defined for their types, are considered to be
+ : distinct.</p>
+ : <p>The collation used by this function is determined according to
+ : the rules in <span href="#choosing-a-collation"><b>5.3.3 Choosing a
+ : collation</b></span>. This collation is used when string comparison is
+ : required.</p>
+ : <p>For <code>xs:float</code> and <code>xs:double</code> values,
+ : positive zero is equal to negative zero and, although
+ : <code>NaN</code> does not equal itself, if <code>$arg</code>
+ : contains multiple <code>NaN</code> values a single <code>NaN</code>
+ : is returned.</p>
+ : <p>If <code>xs:dateTime</code>, <code>xs:date</code> or
+ : <code>xs:time</code> values do not have a timezone, they are
+ : considered to have the implicit timezone provided by the dynamic
+ : context for the purpose of comparison. Note that
+ : <code>xs:dateTime</code>, <code>xs:date</code> or
+ : <code>xs:time</code> values can compare equal even if their
+ : timezones are different.</p>
+ : <p>The order in which the sequence of values is returned is
+ : <span title="implementation dependent" class="termref" href="#implementation-dependent"><span class="arrow">·</span>implementation dependent<span class="arrow">·</span></span>.</p>
+ : <p>Which value of a set of values that compare equal is returned is
+ : <span title="implementation dependent" class="termref" href="#implementation-dependent"><span class="arrow">·</span>implementation dependent<span class="arrow">·</span></span>.</p>
+ : <p>If the input sequence contains values of different numeric types
+ : that differ from each other by small amounts, then the eq operator
+ : is not transitive, because of rounding effects occurring during
+ : type promotion. In the situation where the input contains three
+ : values <code>A</code>, <code>B</code>, and <code>C</code> such that
+ : <code>A eq B</code>, <code>B eq C</code>, but <code>A ne C</code>,
+ : then the number of items in the result of the function (as well as
+ : the choice of which items are returned) is <span title="implementation dependent" class="termref" href="#implementation-dependent"><span class="arrow">·</span>implementation dependent<span class="arrow">·</span></span>, subject only to the constraints that (a) no
+ : two items in the result sequence compare equal to each other, and
+ : (b) every input item that does not appear in the result sequence
+ : compares equal to some item that does appear in the result
+ : sequence.</p>
+ : <p>For example, this arises when computing:</p>
+ : <div class="exampleInner">
+ : <pre>
+ :     distinct-values(
+ :             (xs:float('1.0'),
+ :             xs:decimal('1.0000000000100000000001',
+ :             xs:double( '1.00000000001'))
+ : </pre></div>
+ : <p>because the values of type <code>xs:float</code> and
+ : <code>xs:double</code> both compare equal to the value of type
+ : <code>xs:decimal</code> but not equal to each other.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>If <code>$arg</code> is the empty sequence, the function returns
+ : the empty sequence.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:distinct-values((1, 2.0, 3, 2))</code>
+ : returns some permutation of <code>(1, 3, 2.0)</code>.</p>
+ : <p>The expression
+ : <code>fn:distinct-values((xs:untypedAtomic("cherry"),
+ : xs:untypedAtomic("plum"), xs:untypedAtomic("plum")))</code> returns
+ : some permutation of <code>(xs:untypedAtomic("cherry"),
+ : xs:untypedAtomic("plum"))</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-distinct-values
+ :)
+declare function fn:distinct-values($arg as xs:anyAtomicType*) as  xs:anyAtomicType* external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns the values that appear in a sequence, with duplicates
+ : eliminated.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:distinct-values</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:anyAtomicType*</code>)<code class="as"> as </code><code class="return-type">xs:anyAtomicType*</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="2"><code class="function">fn:distinct-values</code>(</td>
+ : <td valign="baseline"><code class="arg">$arg</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:anyAtomicType*</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$collation</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:anyAtomicType*</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.
+ : It depends on collations.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The function returns the sequence that results from removing
+ : from <code>$arg</code> all but one of a set of values that are
+ : equal to one another. Values are compared using the <code>eq</code>
+ : operator, subject to the caveats defined below.</p>
+ : <p>Values of type <code>xs:untypedAtomic</code> are compared as if
+ : they were of type <code>xs:string</code>.</p>
+ : <p>Values that cannot be compared, because the <code>eq</code>
+ : operator is not defined for their types, are considered to be
+ : distinct.</p>
+ : <p>The collation used by this function is determined according to
+ : the rules in <span href="#choosing-a-collation"><b>5.3.3 Choosing a
+ : collation</b></span>. This collation is used when string comparison is
+ : required.</p>
+ : <p>For <code>xs:float</code> and <code>xs:double</code> values,
+ : positive zero is equal to negative zero and, although
+ : <code>NaN</code> does not equal itself, if <code>$arg</code>
+ : contains multiple <code>NaN</code> values a single <code>NaN</code>
+ : is returned.</p>
+ : <p>If <code>xs:dateTime</code>, <code>xs:date</code> or
+ : <code>xs:time</code> values do not have a timezone, they are
+ : considered to have the implicit timezone provided by the dynamic
+ : context for the purpose of comparison. Note that
+ : <code>xs:dateTime</code>, <code>xs:date</code> or
+ : <code>xs:time</code> values can compare equal even if their
+ : timezones are different.</p>
+ : <p>The order in which the sequence of values is returned is
+ : <span title="implementation dependent" class="termref" href="#implementation-dependent"><span class="arrow">·</span>implementation dependent<span class="arrow">·</span></span>.</p>
+ : <p>Which value of a set of values that compare equal is returned is
+ : <span title="implementation dependent" class="termref" href="#implementation-dependent"><span class="arrow">·</span>implementation dependent<span class="arrow">·</span></span>.</p>
+ : <p>If the input sequence contains values of different numeric types
+ : that differ from each other by small amounts, then the eq operator
+ : is not transitive, because of rounding effects occurring during
+ : type promotion. In the situation where the input contains three
+ : values <code>A</code>, <code>B</code>, and <code>C</code> such that
+ : <code>A eq B</code>, <code>B eq C</code>, but <code>A ne C</code>,
+ : then the number of items in the result of the function (as well as
+ : the choice of which items are returned) is <span title="implementation dependent" class="termref" href="#implementation-dependent"><span class="arrow">·</span>implementation dependent<span class="arrow">·</span></span>, subject only to the constraints that (a) no
+ : two items in the result sequence compare equal to each other, and
+ : (b) every input item that does not appear in the result sequence
+ : compares equal to some item that does appear in the result
+ : sequence.</p>
+ : <p>For example, this arises when computing:</p>
+ : <div class="exampleInner">
+ : <pre>
+ :     distinct-values(
+ :             (xs:float('1.0'),
+ :             xs:decimal('1.0000000000100000000001',
+ :             xs:double( '1.00000000001'))
+ : </pre></div>
+ : <p>because the values of type <code>xs:float</code> and
+ : <code>xs:double</code> both compare equal to the value of type
+ : <code>xs:decimal</code> but not equal to each other.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>If <code>$arg</code> is the empty sequence, the function returns
+ : the empty sequence.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:distinct-values((1, 2.0, 3, 2))</code>
+ : returns some permutation of <code>(1, 3, 2.0)</code>.</p>
+ : <p>The expression
+ : <code>fn:distinct-values((xs:untypedAtomic("cherry"),
+ : xs:untypedAtomic("plum"), xs:untypedAtomic("plum")))</code> returns
+ : some permutation of <code>(xs:untypedAtomic("cherry"),
+ : xs:untypedAtomic("plum"))</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-distinct-values
+ :)
+declare function fn:distinct-values( $arg as xs:anyAtomicType*,  $collation as xs:string) as  xs:anyAtomicType* external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Retrieves a document using a URI supplied as an
+ : <code>xs:string</code>, and returns the corresponding document
+ : node.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:doc</code>(<code class="arg">$uri</code><code class="as"> as </code><code class="type">xs:string?</code>)<code class="as"> as </code><code class="return-type">document-node()?</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.
+ : It depends on available-documents.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If <code>$uri</code> is the empty sequence, the result is an
+ : empty sequence.</p>
+ : <p>If <code>$uri</code> is a relative URI reference, it is resolved
+ : relative to the value of the <span>Dynamic Base URI property from
+ : the dynamic context</span>. The resulting absolute URI is promoted
+ : to an <code>xs:string</code>.</p>
+ : <p>If the <b>Available documents</b> described in <span href="http://www.w3.org/TR/xpath-30/#eval_context";>Section 2.1.2 Dynamic
+ : Context</span> <sup><small>XP30</small></sup> provides a mapping from
+ : this string to a document node, the function returns that document
+ : node.</p>
+ : <p>The URI may include a fragment identifier.</p>
+ : <p>By default, this function is <span title="" class="termref" href="#"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>. Two calls on this function return the same
+ : document node if the same URI Reference (after resolution to an
+ : absolute URI Reference) is supplied to both calls. Thus, the
+ : following expression (if it does not raise an error) will always be
+ : true:</p>
+ : <div class="exampleInner">
+ : <pre>
+ : doc("foo.xml") is doc("foo.xml")
+ : </pre></div>
+ : <p>However, for performance reasons, implementations may provide a
+ : user option to evaluate the function without a guarantee of
+ : determinism. The manner in which any such option is provided is
+ : implementation-defined. If the user has not selected such an
+ : option, a call of the function must either return a deterministic
+ : result or must raise an error [<span href="#ERRFODC0003" title="err:FODC0003">err:FODC0003</span>].</p>
+ : <div class="note">
+ : <p class="prefix"><b>Note:</b></p>
+ : <p>If <code>$uri</code> is read from a source document, it is
+ : generally appropriate to resolve it relative to the base URI
+ : property of the relevant node in the source document. This can be
+ : achieved by calling the <span href="#func-resolve-uri"><code>fn:resolve-uri</code></span> function, and
+ : passing the resulting absolute URI as an argument to the
+ : <code>fn:doc</code> function.</p>
+ : </div>
+ : <p>If two calls to this function supply different absolute URI
+ : References as arguments, the same document node may be returned if
+ : the implementation can determine that the two arguments refer to
+ : the same resource.</p>
+ : <p>By defining the semantics of this function in terms of a
+ : string-to-document-node mapping in the dynamic context, the
+ : specification is acknowledging that the results of this function
+ : are outside the purview of the language specification itself, and
+ : depend entirely on the run-time environment in which the expression
+ : is evaluated. This run-time environment includes not only an
+ : unpredictable collection of resources ("the web"), but configurable
+ : machinery for locating resources and turning their contents into
+ : document nodes within the XPath data model. Both the set of
+ : resources that are reachable, and the mechanisms by which those
+ : resources are parsed and validated, are <span title="implementation dependent" class="termref" href="#implementation-dependent"><span class="arrow">·</span>implementation dependent<span class="arrow">·</span></span>.</p>
+ : <p>One possible processing model for this function is as follows.
+ : The resource identified by the URI Reference is retrieved. If the
+ : resource cannot be retrieved, an error is raised [<span href="#ERRFODC0002" title="err:FODC0002">err:FODC0002</span>]. The data
+ : resulting from the retrieval action is then parsed as an XML
+ : document and a tree is constructed in accordance with the <span href="#xpath-datamodel-30">[XQuery and XPath Data Model (XDM) 3.0]</span>.
+ : 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 [<span href="#ERRFODC0002" title="err:FODC0002">err:FODC0002</span>]. Otherwise, the result of the
+ : function is the document node at the root of the resulting tree.
+ : This tree is then optionally validated against a schema.</p>
+ : <p>Various aspects of this processing are <span title="implementation-defined" class="termref" href="#implementation-defined"><span class="arrow">·</span>implementation-defined<span class="arrow">·</span></span>. Implementations may provide external
+ : configuration options that allow any aspect of the processing to be
+ : controlled by the user. In particular:</p>
+ : <ul>
+ : <li>
+ : <p>The set of URI schemes that the implementation recognizes is
+ : implementation-defined. Implementations may allow the mapping of
+ : URIs to resources to be configured by the user, using mechanisms
+ : such as catalogs or user-written URI handlers.</p>
+ : </li>
+ : <li>
+ : <p>The handling of non-XML media types is implementation-defined.
+ : Implementations may allow instances of the data model to be
+ : constructed from non-XML resources, under user control.</p>
+ : </li>
+ : <li>
+ : <p>It is <span title="implementation-defined" class="termref" href="#implementation-defined"><span class="arrow">·</span>implementation-defined<span class="arrow">·</span></span> whether DTD validation and/or schema
+ : validation is applied to the source document.</p>
+ : </li>
+ : <li>
+ : <p>Implementations may provide user-defined error handling options
+ : that allow processing to continue following an error in retrieving
+ : a resource, or in parsing and validating its content. When errors
+ : have been handled in this way, the function may return either an
+ : empty sequence, or a fallback document provided by the error
+ : handler.</p>
+ : </li>
+ : <li>
+ : <p>Implementations may provide user options that relax the
+ : requirement for the function to return deterministic results.</p>
+ : </li>
+ : </ul>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>An error <strong>may</strong> be raised [<span href="#ERRFODC0005" title="err:FODC0005">err:FODC0005</span>] if <code>$uri</code> is not
+ : a valid URI.</p>
+ : <p>An error is raised [<span href="#ERRFODC0002" title="err:FODC0002">err:FODC0002</span>] if the <b>available documents</b>
+ : provides no mapping for the absolutized URI.</p>
+ : <p>An error is raised [<span href="#ERRFODC0002" title="err:FODC0002">err:FODC0002</span>] if the resource cannot be
+ : retrieved or cannot be parsed successfully as XML.</p>
+ : <p>An error is raised [<span href="#ERRFODC0003" title="err:FODC0003">err:FODC0003</span>] if the implementation is not able
+ : to guarantee that the result of the function will be deterministic,
+ : and the user has not indicated that an unstable result is
+ : acceptable.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-doc
+ :)
+declare function fn:doc($uri as xs:string?) as  document-node()? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>The function returns true if and only if the function call
+ : <span href="#func-doc"><code>fn:doc($uri)</code></span> would return a
+ : document node.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:doc-available</code>(<code class="arg">$uri</code><code class="as"> as </code><code class="type">xs:string?</code>)<code class="as"> as </code><code class="return-type">xs:boolean</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.
+ : It depends on collations.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If <code>$uri</code> is an empty sequence, this function returns
+ : <code>false</code>.</p>
+ : <p>If a call on <span href="#func-doc"><code>fn:doc($uri)</code></span>
+ : would return a document node, this function returns
+ : <code>true</code>.</p>
+ : <p>An error is raised [<span href="#ERRFODC0005" title="err:FODC0005">err:FODC0005</span>] if <code>$uri</code> is not a
+ : valid URI according to the rules applied by the implementation of
+ : <span href="#func-doc"><code>fn:doc</code></span>.</p>
+ : <p>Otherwise, this function returns <code>false</code>.</p>
+ : <p>If this function returns <code>true</code>, then calling
+ : <span href="#func-doc"><code>fn:doc($uri)</code></span> within the same
+ : <span title="execution scope" class="termref" href="#execution-scope"><span class="arrow">·</span>execution
+ : scope<span class="arrow">·</span></span> must return a document node.
+ : However, if nondeterministic processing has been selected for the
+ : <span href="#func-doc"><code>fn:doc</code></span> function, this
+ : guarantee is lost.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-doc-available
+ :)
+declare function fn:doc-available($uri as xs:string?) as  xs:boolean external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns the sequence of element nodes that have an
+ : <code>ID</code> value matching the value of one or more of the
+ : <code>IDREF</code> values supplied in <code>$arg</code>.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:element-with-id</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:string*</code>)<code class="as"> as </code><code class="return-type">element()*</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:element-with-id</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:string*</code>, <code class="arg">$node</code><code class="as"> as </code><code class="type">node()</code>)<code class="as"> as </code><code class="return-type">element()*</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>The one-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-dependent"><span class="arrow">·</span>focus-dependent<span class="arrow">·</span></span>.</p>
+ : <p>The two-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <div class="note">
+ : <p class="prefix"><b>Note:</b></p>
+ : <p>The effect of this function is identical to <code>fn:id</code>
+ : in respect of elements that have an attribute with the
+ : <code>is-id</code> property. However, it behaves differently in
+ : respect of element nodes with the <code>is-id</code> property.
+ : Whereas the <span href="#func-id"><code>fn:id</code></span>, for legacy
+ : reasons, returns the element that has the <code>is-id</code>
+ : property, this parent returns the element identified by the ID,
+ : which is the parent of the element having the <code>is-id</code>
+ : property.</p>
+ : </div>
+ : <p>The function returns a sequence, in document order with
+ : duplicates eliminated, containing every element node <code>E</code>
+ : that satisfies all the following conditions:</p>
+ : <ol class="enumar">
+ : <li>
+ : <p><code>E</code> is in the target document. The target document is
+ : the document containing <code>$node</code>, or the document
+ : containing the context item (<code>.</code>) if the second argument
+ : is omitted. The behavior of the function if <code>$node</code> is
+ : omitted is exactly the same as if the context item had been passed
+ : as <code>$node</code>.</p>
+ : </li>
+ : <li>
+ : <p><code>E</code> has an <code>ID</code> value equal to one of the
+ : candidate <code>IDREF</code> values, where:</p>
+ : <ul>
+ : <li>
+ : <p>An element has an <code>ID</code> value equal to <code>V</code>
+ : if either or both of the following conditions are true:</p>
+ : <ul>
+ : <li>
+ : <p>The element has an child element node whose <code>is-id</code>
+ : property (See <span href="http://www.w3.org/TR/xpath-datamodel-30/#dm-is-id";>Section 5.5
+ : is-id Accessor</span> <sup><small>DM30</small></sup>.) is true and
+ : whose typed value is equal to <code>V</code> under the rules of the
+ : <code>eq</code> operator using the Unicode code point collation
+ : (<code>http://www.w3.org/2005/xpath-functions/collation/codepoint</code>).</p>
+ : </li>
+ : <li>
+ : <p>The element has an attribute node whose <code>is-id</code>
+ : property (See <span href="http://www.w3.org/TR/xpath-datamodel-30/#dm-is-id";>Section 5.5
+ : is-id Accessor</span> <sup><small>DM30</small></sup>.) is true and
+ : whose typed value is equal to <code>V</code> under the rules of the
+ : <code>eq</code> operator using the Unicode code point collation
+ : (<code>http://www.w3.org/2005/xpath-functions/collation/codepoint</code>).</p>
+ : </li>
+ : </ul>
+ : </li>
+ : <li>
+ : <p>Each <code>xs:string</code> in <code>$arg</code> is parsed as if
+ : it were of type <code>IDREFS</code>, that is, each
+ : <code>xs:string</code> in <code>$arg</code> is treated as a
+ : whitespace-separated sequence of tokens, each acting as an
+ : <code>IDREF</code>. These tokens are then included in the list of
+ : candidate <code>IDREF</code>s. If any of the tokens is not a
+ : lexically valid <code>IDREF</code> (that is, if it is not lexically
+ : an <code>xs:NCName</code>), it is ignored. Formally, the candidate
+ : <code>IDREF</code> values are the strings in the sequence given by
+ : the expression:</p>
+ : <div class="exampleInner">
+ : <pre>
+ : for $s in $arg return 
+ :    fn:tokenize(fn:normalize-space($s), ' ')[. castable as xs:IDREF]
+ : </pre></div>
+ : </li>
+ : </ul>
+ : </li>
+ : <li>
+ : <p>If several elements have the same <code>ID</code> value, then
+ : <code>E</code> is the one that is first in document order.</p>
+ : </li>
+ : </ol>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>An error is raised [<span href="#ERRFODC0001" title="err:FODC0001">err:FODC0001</span>] if <code>$node</code>, or the
+ : context item if the second argument is omitted, is a node in a tree
+ : whose root is not a document node.</p>
+ : <p>If the second argument is the context item, or is omitted, the
+ : following errors may be raised: if the context item is <span href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent";>absent</span><sup><small>DM30</small></sup>,
+ : [<span href="http://www.w3.org/TR/xpath20/#ERRXPDY0002"; title="err:XPDY0002">err:XPDY0002</span>]<sup><small>XP</small></sup>; if
+ : the context item is not a node [<span href="http://www.w3.org/TR/xpath20/#ERRXPTY0004"; title="err:XPTY0004">err:XPTY0004</span>]<sup><small>XP</small></sup>.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>This function is equivalent to the <span href="#func-id"><code>fn:id</code></span> function except when dealing with
+ : ID-valued element nodes. Whereas the <span href="#func-id"><code>fn:id</code></span> function selects the element
+ : containing the identifier, this function selects its parent.</p>
+ : <p>If the data model is constructed from an Infoset, an attribute
+ : will have the <code>is-id</code> property if the corresponding
+ : attribute in the Infoset had an attribute type of <code>ID</code>:
+ : typically this means the attribute was declared as an
+ : <code>ID</code> in a DTD.</p>
+ : <p>If the data model is constructed from a PSVI, an element or
+ : attribute will have the <code>is-id</code> property if its typed
+ : value is a single atomic value of type <code>xs:ID</code> or a type
+ : derived by restriction from <code>xs:ID</code>.</p>
+ : <p>No error is raised in respect of a candidate <code>IDREF</code>
+ : value that does not match the <code>ID</code> of any element in the
+ : document. If no candidate <code>IDREF</code> value matches the
+ : <code>ID</code> value of any element, the function returns the
+ : empty sequence.</p>
+ : <p>It is not necessary that the supplied argument should have type
+ : <code>xs:IDREF</code> or <code>xs:IDREFS</code>, or that it should
+ : be derived from a node with the <code>is-idrefs</code>
+ : property.</p>
+ : <p>An element may have more than one <code>ID</code> value. This
+ : can occur with synthetic data models or with data models
+ : constructed from a PSVI where the element and one of its attributes
+ : are both typed as <code>xs:ID</code>.</p>
+ : <p>If the source document is well-formed but not valid, it is
+ : possible for two or more elements to have the same <code>ID</code>
+ : value. In this situation, the function will select the first such
+ : element.</p>
+ : <p>It is also possible in a well-formed but invalid document to
+ : have an element or attribute that has the <code>is-id</code>
+ : property but whose value does not conform to the lexical rules for
+ : the <code>xs:ID</code> type. Such a node will never be selected by
+ : this function.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>let <code>$emp</code> :=</p>
+ : <div class="exampleInner">
+ : <pre>
+ :             &lt;employee xml:id="ID21256"&gt;
+ :                &lt;empnr&gt;E21256&lt;/empnr&gt;
+ :                &lt;first&gt;John&lt;/first&gt;
+ :                &lt;last&gt;Brown&lt;/last&gt;
+ :             &lt;/employee&gt;
+ :          
+ : </pre></div>
+ : <p>The expression <code>id('ID21256')/name()</code> returns
+ : <code>"employee"</code>. <em>(The <code>xml:id</code> attribute has
+ : the <code>is-id</code> property, so the employee element is
+ : selected.).</em></p>
+ : <p>The expression <code>id('E21256')/name()</code> returns
+ : <code>"employee"</code>. <em>(Assuming the <code>empnr</code>
+ : element is given the type <code>xs:ID</code> as a result of schema
+ : validation, the element will have the <code>is-id</code> property
+ : and is therefore its parent is selected. Note the difference from
+ : the behavior of <span href="#func-id"><code>fn:id</code></span>.).</em></p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-element-with-id
+ :)
+declare function fn:element-with-id($arg as xs:string*) as  element()* external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns the sequence of element nodes that have an
+ : <code>ID</code> value matching the value of one or more of the
+ : <code>IDREF</code> values supplied in <code>$arg</code>.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:element-with-id</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:string*</code>)<code class="as"> as </code><code class="return-type">element()*</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:element-with-id</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:string*</code>, <code class="arg">$node</code><code class="as"> as </code><code class="type">node()</code>)<code class="as"> as </code><code class="return-type">element()*</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>The one-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-dependent"><span class="arrow">·</span>focus-dependent<span class="arrow">·</span></span>.</p>
+ : <p>The two-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <div class="note">
+ : <p class="prefix"><b>Note:</b></p>
+ : <p>The effect of this function is identical to <code>fn:id</code>
+ : in respect of elements that have an attribute with the
+ : <code>is-id</code> property. However, it behaves differently in
+ : respect of element nodes with the <code>is-id</code> property.
+ : Whereas the <span href="#func-id"><code>fn:id</code></span>, for legacy
+ : reasons, returns the element that has the <code>is-id</code>
+ : property, this parent returns the element identified by the ID,
+ : which is the parent of the element having the <code>is-id</code>
+ : property.</p>
+ : </div>
+ : <p>The function returns a sequence, in document order with
+ : duplicates eliminated, containing every element node <code>E</code>
+ : that satisfies all the following conditions:</p>
+ : <ol class="enumar">
+ : <li>
+ : <p><code>E</code> is in the target document. The target document is
+ : the document containing <code>$node</code>, or the document
+ : containing the context item (<code>.</code>) if the second argument
+ : is omitted. The behavior of the function if <code>$node</code> is
+ : omitted is exactly the same as if the context item had been passed
+ : as <code>$node</code>.</p>
+ : </li>
+ : <li>
+ : <p><code>E</code> has an <code>ID</code> value equal to one of the
+ : candidate <code>IDREF</code> values, where:</p>
+ : <ul>
+ : <li>
+ : <p>An element has an <code>ID</code> value equal to <code>V</code>
+ : if either or both of the following conditions are true:</p>
+ : <ul>
+ : <li>
+ : <p>The element has an child element node whose <code>is-id</code>
+ : property (See <span href="http://www.w3.org/TR/xpath-datamodel-30/#dm-is-id";>Section 5.5
+ : is-id Accessor</span> <sup><small>DM30</small></sup>.) is true and
+ : whose typed value is equal to <code>V</code> under the rules of the
+ : <code>eq</code> operator using the Unicode code point collation
+ : (<code>http://www.w3.org/2005/xpath-functions/collation/codepoint</code>).</p>
+ : </li>
+ : <li>
+ : <p>The element has an attribute node whose <code>is-id</code>
+ : property (See <span href="http://www.w3.org/TR/xpath-datamodel-30/#dm-is-id";>Section 5.5
+ : is-id Accessor</span> <sup><small>DM30</small></sup>.) is true and
+ : whose typed value is equal to <code>V</code> under the rules of the
+ : <code>eq</code> operator using the Unicode code point collation
+ : (<code>http://www.w3.org/2005/xpath-functions/collation/codepoint</code>).</p>
+ : </li>
+ : </ul>
+ : </li>
+ : <li>
+ : <p>Each <code>xs:string</code> in <code>$arg</code> is parsed as if
+ : it were of type <code>IDREFS</code>, that is, each
+ : <code>xs:string</code> in <code>$arg</code> is treated as a
+ : whitespace-separated sequence of tokens, each acting as an
+ : <code>IDREF</code>. These tokens are then included in the list of
+ : candidate <code>IDREF</code>s. If any of the tokens is not a
+ : lexically valid <code>IDREF</code> (that is, if it is not lexically
+ : an <code>xs:NCName</code>), it is ignored. Formally, the candidate
+ : <code>IDREF</code> values are the strings in the sequence given by
+ : the expression:</p>
+ : <div class="exampleInner">
+ : <pre>
+ : for $s in $arg return 
+ :    fn:tokenize(fn:normalize-space($s), ' ')[. castable as xs:IDREF]
+ : </pre></div>
+ : </li>
+ : </ul>
+ : </li>
+ : <li>
+ : <p>If several elements have the same <code>ID</code> value, then
+ : <code>E</code> is the one that is first in document order.</p>
+ : </li>
+ : </ol>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>An error is raised [<span href="#ERRFODC0001" title="err:FODC0001">err:FODC0001</span>] if <code>$node</code>, or the
+ : context item if the second argument is omitted, is a node in a tree
+ : whose root is not a document node.</p>
+ : <p>If the second argument is the context item, or is omitted, the
+ : following errors may be raised: if the context item is <span href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent";>absent</span><sup><small>DM30</small></sup>,
+ : [<span href="http://www.w3.org/TR/xpath20/#ERRXPDY0002"; title="err:XPDY0002">err:XPDY0002</span>]<sup><small>XP</small></sup>; if
+ : the context item is not a node [<span href="http://www.w3.org/TR/xpath20/#ERRXPTY0004"; title="err:XPTY0004">err:XPTY0004</span>]<sup><small>XP</small></sup>.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>This function is equivalent to the <span href="#func-id"><code>fn:id</code></span> function except when dealing with
+ : ID-valued element nodes. Whereas the <span href="#func-id"><code>fn:id</code></span> function selects the element
+ : containing the identifier, this function selects its parent.</p>
+ : <p>If the data model is constructed from an Infoset, an attribute
+ : will have the <code>is-id</code> property if the corresponding
+ : attribute in the Infoset had an attribute type of <code>ID</code>:
+ : typically this means the attribute was declared as an
+ : <code>ID</code> in a DTD.</p>
+ : <p>If the data model is constructed from a PSVI, an element or
+ : attribute will have the <code>is-id</code> property if its typed
+ : value is a single atomic value of type <code>xs:ID</code> or a type
+ : derived by restriction from <code>xs:ID</code>.</p>
+ : <p>No error is raised in respect of a candidate <code>IDREF</code>
+ : value that does not match the <code>ID</code> of any element in the
+ : document. If no candidate <code>IDREF</code> value matches the
+ : <code>ID</code> value of any element, the function returns the
+ : empty sequence.</p>
+ : <p>It is not necessary that the supplied argument should have type
+ : <code>xs:IDREF</code> or <code>xs:IDREFS</code>, or that it should
+ : be derived from a node with the <code>is-idrefs</code>
+ : property.</p>
+ : <p>An element may have more than one <code>ID</code> value. This
+ : can occur with synthetic data models or with data models
+ : constructed from a PSVI where the element and one of its attributes
+ : are both typed as <code>xs:ID</code>.</p>
+ : <p>If the source document is well-formed but not valid, it is
+ : possible for two or more elements to have the same <code>ID</code>
+ : value. In this situation, the function will select the first such
+ : element.</p>
+ : <p>It is also possible in a well-formed but invalid document to
+ : have an element or attribute that has the <code>is-id</code>
+ : property but whose value does not conform to the lexical rules for
+ : the <code>xs:ID</code> type. Such a node will never be selected by
+ : this function.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>let <code>$emp</code> :=</p>
+ : <div class="exampleInner">
+ : <pre>
+ :             &lt;employee xml:id="ID21256"&gt;
+ :                &lt;empnr&gt;E21256&lt;/empnr&gt;
+ :                &lt;first&gt;John&lt;/first&gt;
+ :                &lt;last&gt;Brown&lt;/last&gt;
+ :             &lt;/employee&gt;
+ :          
+ : </pre></div>
+ : <p>The expression <code>id('ID21256')/name()</code> returns
+ : <code>"employee"</code>. <em>(The <code>xml:id</code> attribute has
+ : the <code>is-id</code> property, so the employee element is
+ : selected.).</em></p>
+ : <p>The expression <code>id('E21256')/name()</code> returns
+ : <code>"employee"</code>. <em>(Assuming the <code>empnr</code>
+ : element is given the type <code>xs:ID</code> as a result of schema
+ : validation, the element will have the <code>is-id</code> property
+ : and is therefore its parent is selected. Note the difference from
+ : the behavior of <span href="#func-id"><code>fn:id</code></span>.).</em></p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-element-with-id
+ :)
+declare function fn:element-with-id($arg as xs:string*,  $node as node()) as  element()* external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns true if the argument is the empty sequence.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:empty</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">item()*</code>)<code class="as"> as </code><code class="return-type">xs:boolean</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If the value of <code>$arg</code> is the empty sequence, the
+ : function returns <code>true</code>; otherwise, the function returns
+ : <code>false</code>.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:empty((1,2,3)[10])</code> returns
+ : <code>true()</code>.</p>
+ : <p>The expression <code>fn:empty(fn:remove(("hello", "world"),
+ : 1))</code> returns <code>false()</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-empty
+ :)
+declare function fn:empty($arg as item()*) as  xs:boolean external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns true if the string <code>$arg1</code> contains
+ : <code>$arg2</code> as a trailing substring, taking collations into
+ : account.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:ends-with</code>(<code class="arg">$arg1</code><code class="as"> as </code><code class="type">xs:string?</code>, <code class="arg">$arg2</code><code class="as"> as </code><code class="type">xs:string?</code>)<code class="as"> as </code><code class="return-type">xs:boolean</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="3"><code class="function">fn:ends-with</code>(</td>
+ : <td valign="baseline"><code class="arg">$arg1</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$arg2</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$collation</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:boolean</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.
+ : It depends on collations.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If the value of <code>$arg1</code> or <code>$arg2</code> is the
+ : empty sequence, or contains only ignorable collation units, it is
+ : interpreted as the zero-length string.</p>
+ : <p>If the value of <code>$arg2</code> is the zero-length string,
+ : then the function returns <code>true</code>. If the value of
+ : <code>$arg1</code> is the zero-length string and the value of
+ : <code>$arg2</code> is not the zero-length string, then the function
+ : returns <code>false</code>.</p>
+ : <p>The collation used by this function is determined according to
+ : the rules in <span href="#choosing-a-collation"><b>5.3.3 Choosing a
+ : collation</b></span>.</p>
+ : <p>The function returns an <code>xs:boolean</code> indicating
+ : whether or not the value of <code>$arg1</code> starts with a
+ : sequence of collation units that provides a <b>match</b> to the
+ : collation units of <code>$arg2</code> according to the collation
+ : that is used.</p>
+ : <div class="note">
+ : <p class="prefix"><b>Note:</b></p>
+ : <p><b>Match</b> is defined in <span href="#Unicode-Collations">[Unicode Collation Algorithm]</span>.</p>
+ : </div>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>An error <strong>may</strong> be raised [<span href="#ERRFOCH0004" title="err:FOCH0004">err:FOCH0004</span>] if the specified collation
+ : does not support collation units.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The collation used in these examples,
+ : <code>http://example.com/CollationA</code> is a collation in which
+ : both "-" and "*" are ignorable collation units.</p>
+ : <p>"Ignorable collation unit" is equivalent to "ignorable collation
+ : element" in <span href="#Unicode-Collations">[Unicode Collation
+ : Algorithm]</span>.</p>
+ : <p>The expression <code>fn:ends-with ( "tattoo", "tattoo")</code>
+ : returns <code>true()</code>.</p>
+ : <p>The expression <code>fn:ends-with ( "tattoo", "atto")</code>
+ : returns <code>false()</code>.</p>
+ : <p>The expression <code>fn:ends-with ((), ())</code> returns
+ : <code>true()</code>.</p>
+ : <p>The expression <code>fn:ends-with ( "abcdefghi", "-g-h-i-",
+ : "http://example.com/CollationA";)</code> returns
+ : <code>true()</code>.</p>
+ : <p>The expression <code>fn:ends-with ( "abcd***e---f*--*ghi",
+ : "defghi", "http://example.com/CollationA";)</code> returns
+ : <code>true()</code>.</p>
+ : <p>The expression <code>fn:ends-with ( "abcd***e---f*--*ghi",
+ : "defghi", "http://example.com/CollationA";)</code> returns
+ : <code>true()</code>.</p>
+ : <p>The expression <code>fn:ends-with ( (), "--***-*---",
+ : "http://example.com/CollationA";)</code> returns
+ : <code>true()</code>. <em>(The second argument contains only
+ : ignorable collation units and is equivalent to the zero-length
+ : string.).</em></p>
+ : <p>The expression <code>fn:ends-with ( "abcdefghi", "ghi-",
+ : "http://example.com/CollationA";)</code> returns
+ : <code>true()</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-ends-with
+ :)
+declare function fn:ends-with($arg1 as xs:string?,  $arg2 as xs:string?) as  xs:boolean external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns true if the string <code>$arg1</code> contains
+ : <code>$arg2</code> as a trailing substring, taking collations into
+ : account.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:ends-with</code>(<code class="arg">$arg1</code><code class="as"> as </code><code class="type">xs:string?</code>, <code class="arg">$arg2</code><code class="as"> as </code><code class="type">xs:string?</code>)<code class="as"> as </code><code class="return-type">xs:boolean</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="3"><code class="function">fn:ends-with</code>(</td>
+ : <td valign="baseline"><code class="arg">$arg1</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$arg2</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$collation</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:boolean</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.
+ : It depends on collations.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If the value of <code>$arg1</code> or <code>$arg2</code> is the
+ : empty sequence, or contains only ignorable collation units, it is
+ : interpreted as the zero-length string.</p>
+ : <p>If the value of <code>$arg2</code> is the zero-length string,
+ : then the function returns <code>true</code>. If the value of
+ : <code>$arg1</code> is the zero-length string and the value of
+ : <code>$arg2</code> is not the zero-length string, then the function
+ : returns <code>false</code>.</p>
+ : <p>The collation used by this function is determined according to
+ : the rules in <span href="#choosing-a-collation"><b>5.3.3 Choosing a
+ : collation</b></span>.</p>
+ : <p>The function returns an <code>xs:boolean</code> indicating
+ : whether or not the value of <code>$arg1</code> starts with a
+ : sequence of collation units that provides a <b>match</b> to the
+ : collation units of <code>$arg2</code> according to the collation
+ : that is used.</p>
+ : <div class="note">
+ : <p class="prefix"><b>Note:</b></p>
+ : <p><b>Match</b> is defined in <span href="#Unicode-Collations">[Unicode Collation Algorithm]</span>.</p>
+ : </div>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>An error <strong>may</strong> be raised [<span href="#ERRFOCH0004" title="err:FOCH0004">err:FOCH0004</span>] if the specified collation
+ : does not support collation units.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The collation used in these examples,
+ : <code>http://example.com/CollationA</code> is a collation in which
+ : both "-" and "*" are ignorable collation units.</p>
+ : <p>"Ignorable collation unit" is equivalent to "ignorable collation
+ : element" in <span href="#Unicode-Collations">[Unicode Collation
+ : Algorithm]</span>.</p>
+ : <p>The expression <code>fn:ends-with ( "tattoo", "tattoo")</code>
+ : returns <code>true()</code>.</p>
+ : <p>The expression <code>fn:ends-with ( "tattoo", "atto")</code>
+ : returns <code>false()</code>.</p>
+ : <p>The expression <code>fn:ends-with ((), ())</code> returns
+ : <code>true()</code>.</p>
+ : <p>The expression <code>fn:ends-with ( "abcdefghi", "-g-h-i-",
+ : "http://example.com/CollationA";)</code> returns
+ : <code>true()</code>.</p>
+ : <p>The expression <code>fn:ends-with ( "abcd***e---f*--*ghi",
+ : "defghi", "http://example.com/CollationA";)</code> returns
+ : <code>true()</code>.</p>
+ : <p>The expression <code>fn:ends-with ( "abcd***e---f*--*ghi",
+ : "defghi", "http://example.com/CollationA";)</code> returns
+ : <code>true()</code>.</p>
+ : <p>The expression <code>fn:ends-with ( (), "--***-*---",
+ : "http://example.com/CollationA";)</code> returns
+ : <code>true()</code>. <em>(The second argument contains only
+ : ignorable collation units and is equivalent to the zero-length
+ : string.).</em></p>
+ : <p>The expression <code>fn:ends-with ( "abcdefghi", "ghi-",
+ : "http://example.com/CollationA";)</code> returns
+ : <code>true()</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-ends-with
+ :)
+declare function fn:ends-with( $arg1 as xs:string?,  $arg2 as xs:string?,  $collation as xs:string) as  xs:boolean external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns the value of a system environment variable, if it
+ : exists.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:environment-variable</code>(<code class="arg">$name</code><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:string?</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.
+ : It depends on environment-variables.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The set of available <span href="http://www.w3.org/TR/xpath-30/#dt-environment-variables";>environment
+ : variables</span><sup><small>XP30</small></sup> is a set of (name,
+ : value) pairs forming part of the dynamic context, in which the name
+ : is unique within the set of pairs. The name and value are arbitrary
+ : strings.</p>
+ : <p>If the <code>$name</code> argument matches the name of one of
+ : these pairs, the function returns the corresponding value.</p>
+ : <p>If there is no environment variable with a matching name, the
+ : function returns the empty sequence.</p>
+ : <p>The collation used for matching names is <span title="implementation-defined" class="termref" href="#implementation-defined"><span class="arrow">·</span>implementation-defined<span class="arrow">·</span></span>, but must be the same as the collation used to
+ : ensure that the names of all environment variables are unique.</p>
+ : <p>The function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : which means that if it is called several times within the same
+ : <span title="" class="termref" href="#"><span class="arrow">·</span>execution scope<span class="arrow">·</span></span>,
+ : with the same arguments, it must return the same result.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>On many platforms, the term "environment variable" has a natural
+ : meaning in terms of facilities provided by the operating system.
+ : This interpretation of the concept does not exclude other
+ : interpretations, such as a mapping to a set of configuration
+ : parameters in a database system.</p>
+ : <p>Environment variable names are usually case sensitive. Names are
+ : usually of the form <code>(letter|_) (letter|_|digit)*</code>, but
+ : this varies by platform.</p>
+ : <p>On some platforms, there may sometimes be multiple environment
+ : variables with the same name; in this case, it is
+ : implementation-dependent as to which is returned; see for example
+ : <span href="#POSIX.1-2008">[POSIX.1-2008]</span> (Chapter 8, Environment
+ : Variables). Implementations <strong>may</strong> use prefixes or
+ : other naming conventions to disambiguate the names.</p>
+ : <p>The requirement to ensure that the function is deterministic
+ : means in practice that the implementation must make a snapshot of
+ : the environment variables at some time during execution, and return
+ : values obtained from this snapshot, rather than using live values
+ : that are subject to change at any time.</p>
+ : <p>Operating system environment variables may be associated with a
+ : particular process, while queries and stylesheets may execute
+ : across multiple processes (or multiple machines). In such
+ : circumstances implementations <strong>may</strong> choose to
+ : provide access to the environment variables associated with the
+ : process in which the query or stylesheet processing was
+ : initiated.</p>
+ : <p>Security advice: Queries from untrusted sources should not be
+ : permitted unrestricted access to environment variables. For
+ : example, the name of the account under which the query is running
+ : may be useful information to a would-be intruder. An implementation
+ : may therefore choose to restrict access to the environment, or may
+ : provide a facility to make <code>fn:environment-variable</code>
+ : always return the empty sequence.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-environment-variable
+ :)
+declare function fn:environment-variable($name as xs:string) as  xs:string? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Calling the <code>fn:error</code> function raises an
+ : application-defined error.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:error</code>()<code class="as"> as </code><code class="return-type">none</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:error</code>(<code class="arg">$code</code><code class="as"> as </code><code class="type">xs:QName</code>)<code class="as"> as </code><code class="return-type">none</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:error</code>(<code class="arg">$code</code><code class="as"> as </code><code class="type">xs:QName?</code>, <code class="arg">$description</code><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">none</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="3"><code class="function">fn:error</code>(</td>
+ : <td valign="baseline"><code class="arg">$code</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:QName?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$description</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$error-object</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">item()*</code>)<code class="as"> as </code><code class="return-type">none</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="nondeterministic" class="termref" href="#dt-nondeterministic"><span class="arrow">·</span>nondeterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>This function never returns a value. Instead it always raises an
+ : error. The effect of the error is identical to the effect of
+ : dynamic errors raised implicitly, for example when an incorrect
+ : argument is supplied to a function.</p>
+ : <p>The parameters to the <code>fn:error</code> function supply
+ : information that is associated with the error condition and that is
+ : made available to a caller that asks for information about the
+ : error. The error may be caught either by the host language (using a
+ : try/catch construct in XSLT or XQuery, for example), or by the
+ : calling application or external processing environment. The way in
+ : which error information is returned to the external processing
+ : environment is <span title="implementation dependent" class="termref" href="#implementation-dependent"><span class="arrow">·</span>implementation dependent<span class="arrow">·</span></span></p>
+ : <p>If <code>fn:error</code> is called with no arguments, then its
+ : behavior is the same as the function call:</p>
+ : <div class="exampleInner">
+ : <pre>
+ :  fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:FOER0000')) 
+ : </pre></div>
+ : <p>If <code>$code</code> is the empty sequence then the effective
+ : value is the <code>xs:QName</code> constructed by:</p>
+ : <div class="exampleInner">
+ : <pre>
+ :  fn:QName('http://www.w3.org/2005/xqt-errors', 'err:FOER0000')
+ : </pre></div>
+ : <p>There are three pieces of information that may be associated
+ : with an error:</p>
+ : <ul>
+ : <li>
+ : <p>The <code>$code</code> is an error code that distinguishes this
+ : error from others. It is an <code>xs:QName</code>; the namespace
+ : URI conventionally identifies the component, subsystem, or
+ : authority responsible for defining the meaning of the error code,
+ : while the local part identifies the specific error condition. The
+ : namespace URI <code>http://www.w3.org/2005/xqt-errors</code> is
+ : used for errors defined in this specification; other namespace URIs
+ : may be used for errors defined by the application.</p>
+ : <p>If the external processing environment expects the error code to
+ : be returned as a URI or a string rather than as an
+ : <code>xs:QName</code>, then an error code with namespace URI
+ : <code>NS</code> and local part <code>LP</code> will be returned in
+ : the form <code>NS#LP</code>. The namespace URI part of the error
+ : code should therefore not include a fragment identifier.</p>
+ : </li>
+ : <li>
+ : <p>The <code>$description</code> is a natural-language description
+ : of the error condition.</p>
+ : </li>
+ : <li>
+ : <p>The <code>$error-object</code> is an arbitrary value used to
+ : convey additional information about the error, and may be used in
+ : any way the application chooses.</p>
+ : </li>
+ : </ul>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>This function always raises an error.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>The value of the <code>$description</code> parameter may need to
+ : be localized.</p>
+ : <p>The type "none" is a special type defined in <span href="#xquery-semantics">[XQuery 1.0 and XPath 2.0 Formal Semantics]</span>
+ : and is not available to the user. It indicates that the function
+ : never returns and ensures that it has the correct static type.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:error()</code> raises error
+ : <code>FOER0000</code>. <em>(This returns the URI
+ : <code>http://www.w3.org/2005/xqt-errors#FOER0000</code> (or the
+ : corresponding <code>xs:QName</code>) to the external processing
+ : environment, unless the error is caught using a try/catch construct
+ : in the host language.).</em></p>
+ : <p>The expression
+ : <code>fn:error(fn:QName('http://www.example.com/HR',
+ : 'myerr:toohighsal'), 'Does not apply because salary is too
+ : high')</code> raises error <code>myerr:toohighsal</code>. <em>(This
+ : returns <code>http://www.example.com/HR#toohighsal</code> and the
+ : <code>xs:string</code> <code>"Does not apply because salary is too
+ : high"</code> (or the corresponding <code>xs:QName</code>) to the
+ : external processing environment, unless the error is caught using a
+ : try/catch construct in the host language.).</em></p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-error
+ :)
+declare function fn:error() as  none external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Calling the <code>fn:error</code> function raises an
+ : application-defined error.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:error</code>()<code class="as"> as </code><code class="return-type">none</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:error</code>(<code class="arg">$code</code><code class="as"> as </code><code class="type">xs:QName</code>)<code class="as"> as </code><code class="return-type">none</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:error</code>(<code class="arg">$code</code><code class="as"> as </code><code class="type">xs:QName?</code>, <code class="arg">$description</code><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">none</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="3"><code class="function">fn:error</code>(</td>
+ : <td valign="baseline"><code class="arg">$code</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:QName?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$description</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$error-object</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">item()*</code>)<code class="as"> as </code><code class="return-type">none</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="nondeterministic" class="termref" href="#dt-nondeterministic"><span class="arrow">·</span>nondeterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>This function never returns a value. Instead it always raises an
+ : error. The effect of the error is identical to the effect of
+ : dynamic errors raised implicitly, for example when an incorrect
+ : argument is supplied to a function.</p>
+ : <p>The parameters to the <code>fn:error</code> function supply
+ : information that is associated with the error condition and that is
+ : made available to a caller that asks for information about the
+ : error. The error may be caught either by the host language (using a
+ : try/catch construct in XSLT or XQuery, for example), or by the
+ : calling application or external processing environment. The way in
+ : which error information is returned to the external processing
+ : environment is <span title="implementation dependent" class="termref" href="#implementation-dependent"><span class="arrow">·</span>implementation dependent<span class="arrow">·</span></span></p>
+ : <p>If <code>fn:error</code> is called with no arguments, then its
+ : behavior is the same as the function call:</p>
+ : <div class="exampleInner">
+ : <pre>
+ :  fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:FOER0000')) 
+ : </pre></div>
+ : <p>If <code>$code</code> is the empty sequence then the effective
+ : value is the <code>xs:QName</code> constructed by:</p>
+ : <div class="exampleInner">
+ : <pre>
+ :  fn:QName('http://www.w3.org/2005/xqt-errors', 'err:FOER0000')
+ : </pre></div>
+ : <p>There are three pieces of information that may be associated
+ : with an error:</p>
+ : <ul>
+ : <li>
+ : <p>The <code>$code</code> is an error code that distinguishes this
+ : error from others. It is an <code>xs:QName</code>; the namespace
+ : URI conventionally identifies the component, subsystem, or
+ : authority responsible for defining the meaning of the error code,
+ : while the local part identifies the specific error condition. The
+ : namespace URI <code>http://www.w3.org/2005/xqt-errors</code> is
+ : used for errors defined in this specification; other namespace URIs
+ : may be used for errors defined by the application.</p>
+ : <p>If the external processing environment expects the error code to
+ : be returned as a URI or a string rather than as an
+ : <code>xs:QName</code>, then an error code with namespace URI
+ : <code>NS</code> and local part <code>LP</code> will be returned in
+ : the form <code>NS#LP</code>. The namespace URI part of the error
+ : code should therefore not include a fragment identifier.</p>
+ : </li>
+ : <li>
+ : <p>The <code>$description</code> is a natural-language description
+ : of the error condition.</p>
+ : </li>
+ : <li>
+ : <p>The <code>$error-object</code> is an arbitrary value used to
+ : convey additional information about the error, and may be used in
+ : any way the application chooses.</p>
+ : </li>
+ : </ul>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>This function always raises an error.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>The value of the <code>$description</code> parameter may need to
+ : be localized.</p>
+ : <p>The type "none" is a special type defined in <span href="#xquery-semantics">[XQuery 1.0 and XPath 2.0 Formal Semantics]</span>
+ : and is not available to the user. It indicates that the function
+ : never returns and ensures that it has the correct static type.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:error()</code> raises error
+ : <code>FOER0000</code>. <em>(This returns the URI
+ : <code>http://www.w3.org/2005/xqt-errors#FOER0000</code> (or the
+ : corresponding <code>xs:QName</code>) to the external processing
+ : environment, unless the error is caught using a try/catch construct
+ : in the host language.).</em></p>
+ : <p>The expression
+ : <code>fn:error(fn:QName('http://www.example.com/HR',
+ : 'myerr:toohighsal'), 'Does not apply because salary is too
+ : high')</code> raises error <code>myerr:toohighsal</code>. <em>(This
+ : returns <code>http://www.example.com/HR#toohighsal</code> and the
+ : <code>xs:string</code> <code>"Does not apply because salary is too
+ : high"</code> (or the corresponding <code>xs:QName</code>) to the
+ : external processing environment, unless the error is caught using a
+ : try/catch construct in the host language.).</em></p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-error
+ :)
+declare function fn:error($code as xs:QName) as  none external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Calling the <code>fn:error</code> function raises an
+ : application-defined error.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:error</code>()<code class="as"> as </code><code class="return-type">none</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:error</code>(<code class="arg">$code</code><code class="as"> as </code><code class="type">xs:QName</code>)<code class="as"> as </code><code class="return-type">none</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:error</code>(<code class="arg">$code</code><code class="as"> as </code><code class="type">xs:QName?</code>, <code class="arg">$description</code><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">none</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="3"><code class="function">fn:error</code>(</td>
+ : <td valign="baseline"><code class="arg">$code</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:QName?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$description</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$error-object</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">item()*</code>)<code class="as"> as </code><code class="return-type">none</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="nondeterministic" class="termref" href="#dt-nondeterministic"><span class="arrow">·</span>nondeterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>This function never returns a value. Instead it always raises an
+ : error. The effect of the error is identical to the effect of
+ : dynamic errors raised implicitly, for example when an incorrect
+ : argument is supplied to a function.</p>
+ : <p>The parameters to the <code>fn:error</code> function supply
+ : information that is associated with the error condition and that is
+ : made available to a caller that asks for information about the
+ : error. The error may be caught either by the host language (using a
+ : try/catch construct in XSLT or XQuery, for example), or by the
+ : calling application or external processing environment. The way in
+ : which error information is returned to the external processing
+ : environment is <span title="implementation dependent" class="termref" href="#implementation-dependent"><span class="arrow">·</span>implementation dependent<span class="arrow">·</span></span></p>
+ : <p>If <code>fn:error</code> is called with no arguments, then its
+ : behavior is the same as the function call:</p>
+ : <div class="exampleInner">
+ : <pre>
+ :  fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:FOER0000')) 
+ : </pre></div>
+ : <p>If <code>$code</code> is the empty sequence then the effective
+ : value is the <code>xs:QName</code> constructed by:</p>
+ : <div class="exampleInner">
+ : <pre>
+ :  fn:QName('http://www.w3.org/2005/xqt-errors', 'err:FOER0000')
+ : </pre></div>
+ : <p>There are three pieces of information that may be associated
+ : with an error:</p>
+ : <ul>
+ : <li>
+ : <p>The <code>$code</code> is an error code that distinguishes this
+ : error from others. It is an <code>xs:QName</code>; the namespace
+ : URI conventionally identifies the component, subsystem, or
+ : authority responsible for defining the meaning of the error code,
+ : while the local part identifies the specific error condition. The
+ : namespace URI <code>http://www.w3.org/2005/xqt-errors</code> is
+ : used for errors defined in this specification; other namespace URIs
+ : may be used for errors defined by the application.</p>
+ : <p>If the external processing environment expects the error code to
+ : be returned as a URI or a string rather than as an
+ : <code>xs:QName</code>, then an error code with namespace URI
+ : <code>NS</code> and local part <code>LP</code> will be returned in
+ : the form <code>NS#LP</code>. The namespace URI part of the error
+ : code should therefore not include a fragment identifier.</p>
+ : </li>
+ : <li>
+ : <p>The <code>$description</code> is a natural-language description
+ : of the error condition.</p>
+ : </li>
+ : <li>
+ : <p>The <code>$error-object</code> is an arbitrary value used to
+ : convey additional information about the error, and may be used in
+ : any way the application chooses.</p>
+ : </li>
+ : </ul>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>This function always raises an error.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>The value of the <code>$description</code> parameter may need to
+ : be localized.</p>
+ : <p>The type "none" is a special type defined in <span href="#xquery-semantics">[XQuery 1.0 and XPath 2.0 Formal Semantics]</span>
+ : and is not available to the user. It indicates that the function
+ : never returns and ensures that it has the correct static type.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:error()</code> raises error
+ : <code>FOER0000</code>. <em>(This returns the URI
+ : <code>http://www.w3.org/2005/xqt-errors#FOER0000</code> (or the
+ : corresponding <code>xs:QName</code>) to the external processing
+ : environment, unless the error is caught using a try/catch construct
+ : in the host language.).</em></p>
+ : <p>The expression
+ : <code>fn:error(fn:QName('http://www.example.com/HR',
+ : 'myerr:toohighsal'), 'Does not apply because salary is too
+ : high')</code> raises error <code>myerr:toohighsal</code>. <em>(This
+ : returns <code>http://www.example.com/HR#toohighsal</code> and the
+ : <code>xs:string</code> <code>"Does not apply because salary is too
+ : high"</code> (or the corresponding <code>xs:QName</code>) to the
+ : external processing environment, unless the error is caught using a
+ : try/catch construct in the host language.).</em></p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-error
+ :)
+declare function fn:error($code as xs:QName?,  $description as xs:string) as  none external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Calling the <code>fn:error</code> function raises an
+ : application-defined error.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:error</code>()<code class="as"> as </code><code class="return-type">none</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:error</code>(<code class="arg">$code</code><code class="as"> as </code><code class="type">xs:QName</code>)<code class="as"> as </code><code class="return-type">none</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:error</code>(<code class="arg">$code</code><code class="as"> as </code><code class="type">xs:QName?</code>, <code class="arg">$description</code><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">none</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="3"><code class="function">fn:error</code>(</td>
+ : <td valign="baseline"><code class="arg">$code</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:QName?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$description</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$error-object</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">item()*</code>)<code class="as"> as </code><code class="return-type">none</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="nondeterministic" class="termref" href="#dt-nondeterministic"><span class="arrow">·</span>nondeterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>This function never returns a value. Instead it always raises an
+ : error. The effect of the error is identical to the effect of
+ : dynamic errors raised implicitly, for example when an incorrect
+ : argument is supplied to a function.</p>
+ : <p>The parameters to the <code>fn:error</code> function supply
+ : information that is associated with the error condition and that is
+ : made available to a caller that asks for information about the
+ : error. The error may be caught either by the host language (using a
+ : try/catch construct in XSLT or XQuery, for example), or by the
+ : calling application or external processing environment. The way in
+ : which error information is returned to the external processing
+ : environment is <span title="implementation dependent" class="termref" href="#implementation-dependent"><span class="arrow">·</span>implementation dependent<span class="arrow">·</span></span></p>
+ : <p>If <code>fn:error</code> is called with no arguments, then its
+ : behavior is the same as the function call:</p>
+ : <div class="exampleInner">
+ : <pre>
+ :  fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:FOER0000')) 
+ : </pre></div>
+ : <p>If <code>$code</code> is the empty sequence then the effective
+ : value is the <code>xs:QName</code> constructed by:</p>
+ : <div class="exampleInner">
+ : <pre>
+ :  fn:QName('http://www.w3.org/2005/xqt-errors', 'err:FOER0000')
+ : </pre></div>
+ : <p>There are three pieces of information that may be associated
+ : with an error:</p>
+ : <ul>
+ : <li>
+ : <p>The <code>$code</code> is an error code that distinguishes this
+ : error from others. It is an <code>xs:QName</code>; the namespace
+ : URI conventionally identifies the component, subsystem, or
+ : authority responsible for defining the meaning of the error code,
+ : while the local part identifies the specific error condition. The
+ : namespace URI <code>http://www.w3.org/2005/xqt-errors</code> is
+ : used for errors defined in this specification; other namespace URIs
+ : may be used for errors defined by the application.</p>
+ : <p>If the external processing environment expects the error code to
+ : be returned as a URI or a string rather than as an
+ : <code>xs:QName</code>, then an error code with namespace URI
+ : <code>NS</code> and local part <code>LP</code> will be returned in
+ : the form <code>NS#LP</code>. The namespace URI part of the error
+ : code should therefore not include a fragment identifier.</p>
+ : </li>
+ : <li>
+ : <p>The <code>$description</code> is a natural-language description
+ : of the error condition.</p>
+ : </li>
+ : <li>
+ : <p>The <code>$error-object</code> is an arbitrary value used to
+ : convey additional information about the error, and may be used in
+ : any way the application chooses.</p>
+ : </li>
+ : </ul>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>This function always raises an error.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>The value of the <code>$description</code> parameter may need to
+ : be localized.</p>
+ : <p>The type "none" is a special type defined in <span href="#xquery-semantics">[XQuery 1.0 and XPath 2.0 Formal Semantics]</span>
+ : and is not available to the user. It indicates that the function
+ : never returns and ensures that it has the correct static type.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:error()</code> raises error
+ : <code>FOER0000</code>. <em>(This returns the URI
+ : <code>http://www.w3.org/2005/xqt-errors#FOER0000</code> (or the
+ : corresponding <code>xs:QName</code>) to the external processing
+ : environment, unless the error is caught using a try/catch construct
+ : in the host language.).</em></p>
+ : <p>The expression
+ : <code>fn:error(fn:QName('http://www.example.com/HR',
+ : 'myerr:toohighsal'), 'Does not apply because salary is too
+ : high')</code> raises error <code>myerr:toohighsal</code>. <em>(This
+ : returns <code>http://www.example.com/HR#toohighsal</code> and the
+ : <code>xs:string</code> <code>"Does not apply because salary is too
+ : high"</code> (or the corresponding <code>xs:QName</code>) to the
+ : external processing environment, unless the error is caught using a
+ : try/catch construct in the host language.).</em></p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-error
+ :)
+declare function fn:error( $code as xs:QName?,  $description as xs:string,  $error-object as item()*) as  none external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns <code>$arg</code> if it contains exactly one item.
+ : Otherwise, raises an error.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:exactly-one</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">item()*</code>)<code class="as"> as </code><code class="return-type">item()</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>Except in error cases, the function returns <code>$arg</code>
+ : unchanged.</p>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>An error is raised [<span href="#ERRFORG0005" title="err:FORG0005">err:FORG0005</span>] if <code>$arg</code> is an empty
+ : sequence or a sequence containing more than one item.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-exactly-one
+ :)
+declare function fn:exactly-one($arg as item()*) as  item() external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns true if the argument is a non-empty sequence.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:exists</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">item()*</code>)<code class="as"> as </code><code class="return-type">xs:boolean</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If the value of <code>$arg</code> is a non-empty sequence, the
+ : function returns <code>true</code>; otherwise, the function returns
+ : <code>false</code>.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:exists(fn:remove(("hello"), 1))</code>
+ : returns <code>false()</code>.</p>
+ : <p>The expression <code>fn:exists(fn:remove(("hello", "world"),
+ : 1))</code> returns <code>true()</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-exists
+ :)
+declare function fn:exists($arg as item()*) as  xs:boolean external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns the <code>xs:boolean</code> value
+ : <code>false</code>.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:false</code>()<code class="as"> as </code><code class="return-type">xs:boolean</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The result is equivalent to <code>xs:boolean("0")</code>.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:false()</code> returns
+ : <code>xs:boolean(0)</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-false
+ :)
+declare function fn:false() as  xs:boolean external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns those items from the sequence <var>$seq</var> for which
+ : the supplied function <var>$f</var> returns true.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:filter</code>(<code class="arg">$f</code><code class="as"> as </code><code class="type">function(item()) as
+ : xs:boolean</code>, <code class="arg">$seq</code><code class="as"> as </code><code class="type">item()*</code>)<code class="as"> as </code><code class="return-type">item()*</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The effect of the function is equivalent to the following
+ : implementation in XQuery:</p>
+ : <div class="exampleInner">
+ : <pre>
+ : declare function fn:filter(
+ :         $f as function(item()) as xs:boolean, 
+ :         $seq as item()*)
+ :         as item()* {
+ :   if (fn:empty($seq))
+ :   then ()
+ :   else ( fn:head($seq)[$f(.) eq fn:true()], 
+ :          fn:filter($f, fn:tail($seq))
+ :        )
+ : };
+ : </pre></div>
+ : <p>or its equivalent in XSLT:</p>
+ : <div class="exampleInner">
+ : <pre>
+ : &lt;xsl:function name="fn:filter" as="item()*"&gt;
+ :   &lt;xsl:param name="f" as="function(item()) as xs:boolean"/&gt;
+ :   &lt;xsl:param name="seq" as="item()*"/&gt;
+ :   &lt;xsl:if test="fn:exists($seq)"&gt;
+ :     &lt;xsl:sequence select="fn:head($seq)[$f(.) eq fn:true()], fn:filter($f, fn:tail($seq))"/&gt;
+ :   &lt;/xsl:if&gt;
+ : &lt;/xsl:function&gt;
+ :          
+ : </pre></div>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>As a consequence of the function signature and the function
+ : calling rules, a type error occurs if the supplied function
+ : <var>$f</var> returns anything other than a single
+ : <code>xs:boolean</code> item; there is no conversion to an
+ : effective boolean value.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>The function call <code>fn:filter($F, $SEQ)</code> has a very
+ : similar effect to the expression <code>$SEQ[$F(.)]</code>. There
+ : are some differences, however. In the case of
+ : <code>fn:filter</code>, the function <code>$F</code> is required to
+ : return a boolean; there is no special treatment for numeric
+ : predicate values, and no conversion to an effective boolean value.
+ : Also, with a filter expression <code>$SEQ[$F(.)]</code>, the focus
+ : within the predicate is different from that outside; this means
+ : that the use of a context-sensitive function such as <span href="#func-lang"><code>fn:lang#1</code></span> will give different results
+ : in the two cases.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:filter(function($a) {$a mod 2 = 0}, 1 to
+ : 10)</code> returns <code>(2, 4, 6, 8, 10)</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-filter
+ :)
+declare function fn:filter($f as function(item()) as xs:boolean,  $seq as item()*) as  item()* external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Rounds <code>$arg</code> downwards to a whole number.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:floor</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">numeric?</code>)<code class="as"> as </code><code class="return-type">numeric?</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>General rules: see <span href="#numeric-value-functions"><b>4.4
+ : Functions on numeric values</b></span>.</p>
+ : <p>The function returns the largest (closest to positive infinity)
+ : number with no fractional part that is not greater than the value
+ : of <code>$arg</code>.</p>
+ : <p>If the type of <code>$arg</code> is one of the four numeric
+ : types <code>xs:float</code>, <code>xs:double</code>,
+ : <code>xs:decimal</code> or <code>xs:integer</code> the type of the
+ : result is the same as the type of <code>$arg</code>. If the type of
+ : <code>$arg</code> is a type derived from one of the numeric types,
+ : the result is an instance of the base numeric type.</p>
+ : <p>For <code>xs:float</code> and <code>xs:double</code> arguments,
+ : if the argument is positive zero, then positive zero is returned.
+ : If the argument is negative zero, then negative zero is
+ : returned.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:floor(10.5)</code> returns
+ : <code>10</code>.</p>
+ : <p>The expression <code>fn:floor(-10.5)</code> returns
+ : <code>-11</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-floor
+ :)
+declare function fn:floor($arg as numeric?) as  numeric? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Processes the supplied sequence from left to right, applying the
+ : supplied function repeatedly to each item in turn, together with an
+ : accumulated result value.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="3"><code class="function">fn:fold-left</code>(</td>
+ : <td valign="baseline"><code class="arg">$f</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">function(item()*, item()) as item()*</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$zero</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">item()*</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$seq</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">item()*</code>)<code class="as"> as </code><code class="return-type">item()*</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The effect of the function is equivalent to the following
+ : implementation in XQuery:</p>
+ : <div class="exampleInner">
+ : <pre>
+ : declare function fn:fold-left(
+ :         $f as function(item()*, item()) as item()*, 
+ :         $zero as item()*, 
+ :         $seq as item()*) 
+ :         as item()* {
+ :   if (fn:empty($seq))
+ :   then $zero
+ :   else fn:fold-left($f, $f($zero, fn:head($seq)), fn:tail($seq))
+ : };
+ : </pre></div>
+ : <p>or its equivalent in XSLT:</p>
+ : <div class="exampleInner">
+ : <pre>
+ : &lt;xsl:function name="fn:fold-left" as="item()*"&gt;
+ :   &lt;xsl:param name="f" as="function(item()*, item()) as item()*"/&gt;
+ :   &lt;xsl:param name="zero" as="item()*"/&gt;
+ :   &lt;xsl:param name="seq" as="item()*"/&gt;
+ :   &lt;xsl:choose&gt;
+ :     &lt;xsl:when test="fn:empty($seq)"&gt;
+ :       &lt;xsl:sequence select="$zero"/&gt;
+ :     &lt;/xsl:when&gt;
+ :     &lt;xsl:otherwise&gt;
+ :       &lt;xsl:sequence select="fn:fold-left($f, $f($zero, fn:head($seq)), fn:tail($seq))"/&gt;
+ :     &lt;/xsl:otherwise&gt;
+ :   &lt;/xsl:choose&gt;
+ : &lt;/xsl:function&gt;
+ :          
+ : </pre></div>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>As a consequence of the function signature and the function
+ : calling rules, a type error occurs if the supplied function
+ : <var>$f</var> cannot be applied to two arguments, where the first
+ : argument is either the value of <var>$zero</var> or the result of a
+ : previous application of <var>$f</var>, and the second is
+ : <var>$seq</var> or any trailing subsequence of <var>$seq</var>.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>This operation is often referred to in the functional
+ : programming literature as "folding" or "reducing" a sequence. It
+ : takes a function that operates on a pair of values, and applies it
+ : repeatedly, with an accumulated result as the first argument, and
+ : the next item in the sequence as the second argument. The
+ : accumulated result is initially set to the value of the
+ : <var>$zero</var> argument, which is conventionally a value (such as
+ : zero in the case of addition, one in the case of multiplication, or
+ : a zero-length string in the case of string concatenation) that
+ : causes the function to return the value of the other argument
+ : unchanged.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:fold-left(function($a, $b) { $a + $b },
+ : 0, 1 to 5)</code> returns <code>15</code>. <em>(This returns the
+ : sum of the items in the sequence).</em></p>
+ : <p>The expression <code>fn:fold-left(function($a, $b) { $a * $b },
+ : 1, (2,3,5,7))</code> returns <code>210</code>. <em>(This returns
+ : the product of the items in the sequence).</em></p>
+ : <p>The expression <code>fn:fold-left(function($a, $b) { $a or $b },
+ : false(), (true(), false(), false()))</code> returns
+ : <code>true()</code>. <em>(This returns true if any item in the
+ : sequence has an effective boolean value of true).</em></p>
+ : <p>The expression <code>fn:fold-left(function($a, $b) { $a and $b
+ : }, false(), (true(), false(), false()))</code> returns
+ : <code>false()</code>. <em>(This returns true only if every item in
+ : the sequence has an effective boolean value of true).</em></p>
+ : <p>The expression <code>fn:fold-left(function($a, $b) {($b, $a)},
+ : (), 1 to 5)</code> returns <code>(5,4,3,2,1)</code>. <em>(This
+ : reverses the order of the items in a sequence).</em></p>
+ : <p>The expression <code>fn:fold-left(fn:concat(?, ".", ?), "", 1 to
+ : 5)</code> returns <code>".1.2.3.4.5"</code>.</p>
+ : <p>The expression <code>fn:fold-left(fn:concat("$f(", ?, ", ", ?,
+ : ")"), "$zero", 1 to 5)</code> returns <code>"$f($f($f($f($f($zero,
+ : 1), 2), 3), 4), 5)"</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-fold-left
+ :)
+declare function fn:fold-left( $f as function(item()*, item()) as item()*,  $zero as item()*,  $seq as item()*) as  item()* external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Processes the supplied sequence from right to left, applying the
+ : supplied function repeatedly to each item in turn, together with an
+ : accumulated result value.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="3"><code class="function">fn:fold-right</code>(</td>
+ : <td valign="baseline"><code class="arg">$f</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">function(item(), item()*) as item()*</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$zero</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">item()*</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$seq</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">item()*</code>)<code class="as"> as </code><code class="return-type">item()*</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The effect of the function is equivalent to the following
+ : implementation in XQuery:</p>
+ : <div class="exampleInner">
+ : <pre>
+ : declare function fn:fold-right(
+ :         $f as function(item(), item()*) as item()*, 
+ :         $zero as item()*, 
+ :         $seq as item()*) 
+ :         as item()* {
+ :   if (fn:empty($seq))
+ :   then $zero
+ :   else $f(fn:head($seq), fn:fold-right($f, $zero, fn:tail($seq)))
+ : };
+ : </pre></div>
+ : <p>or its equivalent in XSLT:</p>
+ : <div class="exampleInner">
+ : <pre>
+ : &lt;xsl:function name="fn:fold-right" as="item()*"&gt;
+ :   &lt;xsl:param name="f" as="function(item(), item()*) as item()*"/&gt;
+ :   &lt;xsl:param name="zero" as="item()*"/&gt;
+ :   &lt;xsl:param name="seq" as="item()*"/&gt;
+ :   &lt;xsl:choose&gt;
+ :     &lt;xsl:when test="fn:empty($seq)"&gt;
+ :       &lt;xsl:sequence select="$zero"/&gt;
+ :     &lt;/xsl:when&gt;
+ :     &lt;xsl:otherwise&gt;
+ :       &lt;xsl:sequence select="$f(fn:head($seq), fn:fold-right($f, $zero, fn:tail($seq))"/&gt;
+ :     &lt;/xsl:otherwise&gt;
+ :   &lt;/xsl:choose&gt;
+ : &lt;/xsl:function&gt;
+ :          
+ : </pre></div>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>As a consequence of the function signature and the function
+ : calling rules, a type error occurs if the supplied function
+ : <var>$f</var> cannot be applied to two arguments, where the first
+ : argument is any item in the sequence <var>$seq</var>, and the
+ : second is either the value of <var>$zero</var> or the result of a
+ : previous application of <var>$f</var>.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>This operation is often referred to in the functional
+ : programming literature as "folding" or "reducing" a sequence. It
+ : takes a function that operates on a pair of values, and applies it
+ : repeatedly, with the next item in the sequence as the first
+ : argument, and the result of processing the remainder of the
+ : sequence as the second argument. The accumulated result is
+ : initially set to the value of the <var>$zero</var> argument, which
+ : is conventionally a value (such as zero in the case of addition,
+ : one in the case of multiplication, or a zero-length string in the
+ : case of string concatenation) that causes the function to return
+ : the value of the other argument unchanged.</p>
+ : <p>In cases where the function performs an associative operation on
+ : its two arguments (such as addition or multiplication),
+ : <code>fn:fold-right</code> produces the same result as <span href="#func-fold-left"><code>fn:fold-left</code></span>.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:fold-right(function($a, $b) { $a + $b },
+ : 0, 1 to 5)</code> returns <code>15</code>. <em>(This returns the
+ : sum of the items in the sequence).</em></p>
+ : <p>The expression <code>fn:fold-right(fn:concat(?, ".", ?), "", 1
+ : to 5)</code> returns <code>"1.2.3.4.5."</code>.</p>
+ : <p>The expression <code>fn:fold-right(concat("$f(", ?, ", ", ?,
+ : ")"), "$zero", 1 to 5)</code> returns <code>"$f(1, $f(2, $f(3,
+ : $f(4, $f(5, $zero)))))"</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-fold-right
+ :)
+declare function fn:fold-right( $f as function(item(), item()*) as item()*,  $zero as item()*,  $seq as item()*) as  item()* external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns a string containing an <code>xs:date</code> value
+ : formatted for display.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:format-date</code>(<code class="arg">$value</code><code class="as"> as </code><code class="type">xs:date?</code>, <code class="arg">$picture</code><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:string?</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="5"><code class="function">fn:format-date</code>(</td>
+ : <td valign="baseline"><code class="arg">$value</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:date?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$picture</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$language</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$calendar</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$place</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>)<code class="as"> as </code><code class="return-type">xs:string?</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>See <span href="#rules-for-datetime-formatting"><b>9.8.4 The
+ : date/time formatting functions</b></span>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-format-date
+ :)
+declare function fn:format-date( $value as xs:date?,  $picture as xs:string,  $language as xs:string?,  $calendar as xs:string?,  $place as xs:string?) as  xs:string? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns a string containing an <code>xs:date</code> value
+ : formatted for display.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:format-date</code>(<code class="arg">$value</code><code class="as"> as </code><code class="type">xs:date?</code>, <code class="arg">$picture</code><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:string?</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="5"><code class="function">fn:format-date</code>(</td>
+ : <td valign="baseline"><code class="arg">$value</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:date?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$picture</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$language</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$calendar</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$place</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>)<code class="as"> as </code><code class="return-type">xs:string?</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>See <span href="#rules-for-datetime-formatting"><b>9.8.4 The
+ : date/time formatting functions</b></span>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-format-date
+ :)
+declare function fn:format-date($value as xs:date?,  $picture as xs:string) as  xs:string? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns a string containing an <code>xs:dateTime</code> value
+ : formatted for display.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:format-dateTime</code>(<code class="arg">$value</code><code class="as"> as </code><code class="type">xs:dateTime?</code>, <code class="arg">$picture</code><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:string?</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="5"><code class="function">fn:format-dateTime</code>(</td>
+ : <td valign="baseline"><code class="arg">$value</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:dateTime?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$picture</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$language</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$calendar</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$place</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>)<code class="as"> as </code><code class="return-type">xs:string?</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>See <span href="#rules-for-datetime-formatting"><b>9.8.4 The
+ : date/time formatting functions</b></span>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-format-dateTime
+ :)
+declare function fn:format-dateTime( $value as xs:dateTime?,  $picture as xs:string,  $language as xs:string?,  $calendar as xs:string?,  $place as xs:string?) as  xs:string? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns a string containing an <code>xs:dateTime</code> value
+ : formatted for display.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:format-dateTime</code>(<code class="arg">$value</code><code class="as"> as </code><code class="type">xs:dateTime?</code>, <code class="arg">$picture</code><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:string?</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="5"><code class="function">fn:format-dateTime</code>(</td>
+ : <td valign="baseline"><code class="arg">$value</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:dateTime?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$picture</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$language</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$calendar</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$place</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>)<code class="as"> as </code><code class="return-type">xs:string?</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>See <span href="#rules-for-datetime-formatting"><b>9.8.4 The
+ : date/time formatting functions</b></span>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-format-dateTime
+ :)
+declare function fn:format-dateTime($value as xs:dateTime?,  $picture as xs:string) as  xs:string? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Formats an integer according to a given picture string, using
+ : the conventions of a given natural language if specified.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:format-integer</code>(<code class="arg">$value</code><code class="as"> as </code><code class="type">xs:integer?</code>, <code class="arg">$picture</code><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:string</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="3"><code class="function">fn:format-integer</code>(</td>
+ : <td valign="baseline"><code class="arg">$value</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:integer?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$picture</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$language</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>)<code class="as"> as </code><code class="return-type">xs:string</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If <code>$value</code> is an empty sequence, the function
+ : returns a zero-length string.</p>
+ : <p>In all other cases, the <code>$picture</code> argument describes
+ : the format in which <code>$value</code> is output.</p>
+ : <p>The rules that follow describe how non-negative numbers are
+ : output. If the value of <code>$value</code> is negative, the rules
+ : below are applied to the absolute value of <code>$value</code>, and
+ : a minus sign is prepended to the result.</p>
+ : <p>The value of <code>$picture</code> <strong>must</strong> match
+ : the regular expression:</p>
+ : <p>
+ : <code>^((\p{Nd}|#|[^\p{N}\p{L}])+?)(([co](\([^()]\))?)?[at]?)$</code></p>
+ : <p>The substring that matches the first capturing group in this
+ : regular expression are referred to as the primary format token. The
+ : substring that matches the second capturing group (which may be
+ : empty) is referred to as the format modifier. A picture thus
+ : consists of a primary format token, followed by an optional format
+ : modifier.</p>
+ : <p>The primary format token is classified as one of the
+ : following:</p>
+ : <ul>
+ : <li>
+ : <p>A <var>decimal-digit-pattern</var> made up of
+ : <var>optional-digit-signs</var>, <var>mandatory-digit-signs</var>,
+ : and <var>grouping-separator-signs</var>.</p>
+ : <ul>
+ : <li>
+ : <p>The <var>optional-digit-sign</var> is the character "#".</p>
+ : </li>
+ : <li>
+ : <p>A <var>mandatory-digit-sign</var> is a <span title="character" class="termref" href="#character"><span class="arrow">·</span>character<span class="arrow">·</span></span> in
+ : Unicode category Nd. All <var>mandatory-digit-signs</var> within
+ : the format token must be from the same digit family, where a digit
+ : family is a sequence of ten consecutive characters in Unicode
+ : category Nd, having digit values 0 through 9. Within the format
+ : token, these digits are interchangeable: a three-digit number may
+ : thus be indicated equivalently by <code>000</code>,
+ : <code>001</code>, or <code>999</code>.</p>
+ : </li>
+ : <li>
+ : <p>a <var>grouping-separator-sign</var> is a non-alphanumeric
+ : character, that is a <span title="character" class="termref" href="#character"><span class="arrow">·</span>character<span class="arrow">·</span></span> whose Unicode category is other than Nd, Nl,
+ : No, Lu, Ll, Lt, Lm or Lo.</p>
+ : </li>
+ : </ul>
+ : <p>There <strong>must</strong> be at least one
+ : <var>mandatory-digit-sign</var>. There may be zero or more
+ : <var>optional-digit-signs</var>, and (if present) these
+ : <strong>must</strong> precede all <var>mandatory-digit-signs</var>.
+ : There may be zero or more <var>grouping-separator-signs</var>. A
+ : <var>grouping-separator-sign</var> <strong>must not</strong> appear
+ : at the start or end of the <var>decimal-digit-pattern</var>, nor
+ : adjacent to another <var>grouping-separator-sign</var>.</p>
+ : <p>The corresponding output format is a decimal number, using this
+ : digit family, with at least as many digits as there are
+ : <var>mandatory-digit-signs</var> in the format token. Thus, a
+ : format token <code>1</code> generates the sequence <code>0 1 2 ...
+ : 10 11 12 ...</code>, and a format token <code>01</code> (or
+ : equivalently, <code>00</code> or <code>99</code>) generates the
+ : sequence <code>00 01 02 ... 09 10 11 12 ... 99 100 101</code>. A
+ : format token of <code>&amp;#x661;</code> (Arabic-Indic digit one)
+ : generates the sequence <code>١</code> then <code>٢</code> then
+ : <code>٣</code> ...</p>
+ : <p>The <var>grouping-separator-signs</var> are handled as follows.
+ : The position of grouping separators within the format token,
+ : counting backwards from the last digit, indicates the position of
+ : grouping separators to appear within the formatted number, and the
+ : character used as the <var>grouping-separator-sign</var> within the
+ : format token indicates the character to be used as the
+ : corresponding grouping separator in the formatted number. If
+ : <var>grouping-separator-signs</var> appear at regular intervals
+ : within the format token, that is if the same grouping separator
+ : appears at positions forming a sequence <var>N</var>,
+ : 2<var>N</var>, 3<var>N</var>, ... for some integer value
+ : <var>N</var> (including the case where there is only one number in
+ : the list), then the sequence is extrapolated to the left, so
+ : grouping separators will be used in the formatted number at every
+ : multiple of <var>N</var>. For example, if the format token is
+ : <code>0'000</code> then the number one million will be formatted as
+ : <code>1'000'000</code>, while the number fifteen will be formatted
+ : as <code>0'015</code>.</p>
+ : <p>The only purpose of <var>optional-digit-signs</var> is to mark
+ : the position of <var>grouping-separator-signs</var>. For example,
+ : if the format token is <code>#'##0</code> then the number one
+ : million will be formatted as <code>1'000'000</code>, while the
+ : number fifteen will be formatted as <code>15</code>. A grouping
+ : separator is included in the formatted number only if there is a
+ : digit to its left, which will only be the case if either (a) the
+ : number is large enough to require that digit, or (b) the number of
+ : <var>mandatory-digit-signs</var> in the format token requires
+ : insignificant leading zeros to be present.</p>
+ : <div class="note">
+ : <p class="prefix"><b>Note:</b></p>
+ : <p>Numbers will never be truncated. Given the
+ : <var>decimal-digit-pattern</var> <code>01</code>, the number three
+ : hundred will be output as <code>300</code>, despite the absence of
+ : any <var>optional-digit-sign</var>.</p>
+ : </div>
+ : </li>
+ : <li>
+ : <p>The format token <code>A</code>, which generates the sequence
+ : <code>A B C ... Z AA AB AC...</code>.</p>
+ : </li>
+ : <li>
+ : <p>The format token <code>a</code>, which generates the sequence
+ : <code>a b c ... z aa ab ac...</code>.</p>
+ : </li>
+ : <li>
+ : <p>The format token <code>i</code>, which generates the sequence
+ : <code>i ii iii iv v vi vii viii ix x ...</code>.</p>
+ : </li>
+ : <li>
+ : <p>The format token <code>I</code>, which generates the sequence
+ : <code>I II III IV V VI VII VIII IX X ...</code>.</p>
+ : </li>
+ : <li>
+ : <p>The format token <code>w</code>, which generates numbers written
+ : as lower-case words, for example in English, <code>one two three
+ : four ...</code></p>
+ : </li>
+ : <li>
+ : <p>The format token <code>W</code>, which generates numbers written
+ : as upper-case words, for example in English, <code>ONE TWO THREE
+ : FOUR ...</code></p>
+ : </li>
+ : <li>
+ : <p>The format token <code>Ww</code>, which generates numbers
+ : written as title-case words, for example in English, <code>One Two
+ : Three Four ...</code></p>
+ : </li>
+ : <li>
+ : <p>Any other format token, which indicates a numbering sequence in
+ : which that token represents the number 1 (one) (but see the note
+ : below). It is <span title="implementation-defined" class="termref" href="#implementation-defined"><span class="arrow">·</span>implementation-defined<span class="arrow">·</span></span> which numbering sequences, additional to those
+ : listed above, are supported. If an implementation does not support
+ : a numbering sequence represented by the given token, it
+ : <strong>must</strong> use a format token of <code>1</code>.</p>
+ : <div class="note">
+ : <p class="prefix"><b>Note:</b></p>
+ : <p>In some traditional numbering sequences additional signs are
+ : added to denote that the letters should be interpreted as numbers;
+ : these are not included in the format token. An example (see also
+ : the example below) is classical Greek where a <em>dexia keraia</em>
+ : (x0374, ʹ) and sometimes an <em>aristeri keraia</em> (x0375, ͵) is
+ : added.</p>
+ : </div>
+ : </li>
+ : </ul>
+ : <p>For all format tokens other than the first kind above (one that
+ : consists of decimal digits), there <strong>may</strong> be
+ : <span title="implementation-defined" class="termref" href="#implementation-defined"><span class="arrow">·</span>implementation-defined<span class="arrow">·</span></span> lower and upper bounds on the range of numbers
+ : that can be formatted using this format token; indeed, for some
+ : numbering sequences there may be intrinsic limits. For example, the
+ : format token <code>&amp;#x2460;</code> (circled digit one, ①) has a
+ : range of 1 to 20 imposed by the Unicode character repertoire. For
+ : the numbering sequences described above any upper bound imposed by
+ : the implementation <strong>must not</strong> be less than 1000 (one
+ : thousand) and any lower bound must not be greater than 1. Numbers
+ : that fall outside this range <strong>must</strong> be formatted
+ : using the format token <code>1</code>.</p>
+ : <p>The above expansions of numbering sequences for format tokens
+ : such as <code>a</code> and <code>i</code> are indicative but not
+ : prescriptive. There are various conventions in use for how
+ : alphabetic sequences continue when the alphabet is exhausted, and
+ : differing conventions for how roman numerals are written (for
+ : example, <code>IV</code> versus <code>IIII</code> as the
+ : representation of the number 4). Sometimes alphabetic sequences are
+ : used that omit letters such as <code>i</code> and <code>o</code>.
+ : This specification does not prescribe the detail of any sequence
+ : other than those sequences consisting entirely of decimal
+ : digits.</p>
+ : <p>Many numbering sequences are language-sensitive. This applies
+ : especially to the sequence selected by the tokens <code>w</code>,
+ : <code>W</code> and <code>Ww</code>. It also applies to other
+ : sequences, for example different languages using the Cyrillic
+ : alphabet use different sequences of characters, each starting with
+ : the letter #x410 (Cyrillic capital letter A). In such cases, the
+ : <code>$language</code> argument specifies which language's
+ : conventions are to be used. <span>If the argument is specified, the
+ : value <strong>should</strong> be a string that is castable to the
+ : type <code>xs:language</code></span>.</p>
+ : <p>The set of languages for which numbering is supported is
+ : <span title="implementation-defined" class="termref" href="#implementation-defined"><span class="arrow">·</span>implementation-defined<span class="arrow">·</span></span>. If the <code>$language</code> argument is
+ : absent, or is set to an empty sequence, or is invalid, or is not a
+ : language supported by the implementation, then the number is
+ : formatted using a default language; the default language is
+ : <span title="implementation-defined" class="termref" href="#implementation-defined"><span class="arrow">·</span>implementation-defined<span class="arrow">·</span></span>.</p>
+ : <p>The format modifier, if present, is one <span>or more</span> of
+ : the following, in order:</p>
+ : <ul>
+ : <li>
+ : <p>either <code>c</code> or <code>o</code>, optionally followed by
+ : a sequence of characters enclosed between parentheses, to indicate
+ : cardinal or ordinal numbering respectively, the default being
+ : cardinal numbering</p>
+ : </li>
+ : <li>
+ : <p>either <code>a</code> or <code>t</code>, to indicate alphabetic
+ : or traditional numbering respectively, the default being <span title="implementation-defined" class="termref" href="#implementation-defined"><span class="arrow">·</span>implementation-defined<span class="arrow">·</span></span>.</p>
+ : </li>
+ : </ul>
+ : <p>If the <code>o</code> modifier is present, this indicates a
+ : request to output ordinal numbers rather than cardinal numbers. For
+ : example, in English, when used with the format token
+ : <code>1</code>, this outputs the sequence <code>1st 2nd 3rd 4th
+ : ...</code>, and when used with the format token <code>w</code>
+ : outputs the sequence <code>first second third fourth
+ : ...</code>.</p>
+ : <p>In some languages, ordinal numbers vary depending on the
+ : grammatical context, for example they may have different genders
+ : and may decline with the noun that they qualify. In such cases the
+ : string appearing in parentheses after the letter <code>o</code> may
+ : be used to indicate the variation of the ordinal number required.
+ : The way in which the variation is indicated will depend on the
+ : conventions of the language. For inflected languages that vary the
+ : ending of the word, the preferred approach is to indicate the
+ : required ending, preceded by a hyphen: for example in German,
+ : appropriate values are <code>o(-e)</code>, <code>o(-er)</code>,
+ : <code>o(-es)</code>, <code>o(-en)</code>.</p>
+ : <p>It is <span title="implementation-defined" class="termref" href="#implementation-defined"><span class="arrow">·</span>implementation-defined<span class="arrow">·</span></span> what combinations of values of the format
+ : token, the language, and the cardinal/ordinal modifier are
+ : supported. If ordinal numbering is not supported for the
+ : combination of the format token, the language, and the string
+ : appearing in parentheses, the request is ignored and cardinal
+ : numbers are generated instead.</p>
+ : <div class="exampleOuter">
+ : <div class="exampleHeader"><span name="d5e6102" id="d5e6102"/>Example: Ordinal Numbering in Italian</div>
+ : <p>The specification <code>"1o(-º)"</code> with
+ : <code>$language</code> equal to <code>it</code>, if supported,
+ : should produce the sequence:</p>
+ : <div class="exampleInner">
+ : <pre>
+ : 1º 2º 3º 4º ...
+ : </pre></div>
+ : <p>The specification <code>"Wwo"</code> with <code>$language</code>
+ : equal to <code>it</code>, if supported, should produce the
+ : sequence:</p>
+ : <div class="exampleInner">
+ : <pre>
+ : Primo Secondo Terzo Quarto Quinto ...
+ : </pre></div>
+ : </div>
+ : <p>The <span>use of the <code>a</code> or <code>t</code>
+ : modifier</span> disambiguates between numbering sequences that use
+ : letters. In many languages there are two commonly used numbering
+ : sequences that use letters. One numbering sequence assigns numeric
+ : values to letters in alphabetic sequence, and the other assigns
+ : numeric values to each letter in some other manner traditional in
+ : that language. In English, these would correspond to the numbering
+ : sequences specified by the format tokens <code>a</code> and
+ : <code>i</code>. In some languages, the first member of each
+ : sequence is the same, and so the format token alone would be
+ : ambiguous. <span>In the absence of the <code>a</code> or
+ : <code>t</code> modifier, the default is <span title="implementation-defined" class="termref" href="#implementation-defined"><span class="arrow">·</span>implementation-defined<span class="arrow">·</span></span></span>.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>format-integer(123, '0000')</code> returns
+ : <code>"0123"</code>.</p>
+ : <p><code>format-integer(123, 'w')</code> might return <code>"one
+ : hundred and twenty-three"</code></p>
+ : <p>The expression <code>format-integer(21, '1o', 'en')</code>
+ : returns <code>"21st"</code>.</p>
+ : <p><code>format-integer(14, 'Wwo(-e)', 'de')</code> might return
+ : <code>"Vierzehnte"</code></p>
+ : <p>The expression <code>format-integer(7, 'a')</code> returns
+ : <code>"g"</code>.</p>
+ : <p>The expression <code>format-integer(57, 'I')</code> returns
+ : <code>"LVII"</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-format-integer
+ :)
+declare function fn:format-integer($value as xs:integer?,  $picture as xs:string) as  xs:string external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Formats an integer according to a given picture string, using
+ : the conventions of a given natural language if specified.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:format-integer</code>(<code class="arg">$value</code><code class="as"> as </code><code class="type">xs:integer?</code>, <code class="arg">$picture</code><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:string</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="3"><code class="function">fn:format-integer</code>(</td>
+ : <td valign="baseline"><code class="arg">$value</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:integer?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$picture</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$language</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>)<code class="as"> as </code><code class="return-type">xs:string</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If <code>$value</code> is an empty sequence, the function
+ : returns a zero-length string.</p>
+ : <p>In all other cases, the <code>$picture</code> argument describes
+ : the format in which <code>$value</code> is output.</p>
+ : <p>The rules that follow describe how non-negative numbers are
+ : output. If the value of <code>$value</code> is negative, the rules
+ : below are applied to the absolute value of <code>$value</code>, and
+ : a minus sign is prepended to the result.</p>
+ : <p>The value of <code>$picture</code> <strong>must</strong> match
+ : the regular expression:</p>
+ : <p>
+ : <code>^((\p{Nd}|#|[^\p{N}\p{L}])+?)(([co](\([^()]\))?)?[at]?)$</code></p>
+ : <p>The substring that matches the first capturing group in this
+ : regular expression are referred to as the primary format token. The
+ : substring that matches the second capturing group (which may be
+ : empty) is referred to as the format modifier. A picture thus
+ : consists of a primary format token, followed by an optional format
+ : modifier.</p>
+ : <p>The primary format token is classified as one of the
+ : following:</p>
+ : <ul>
+ : <li>
+ : <p>A <var>decimal-digit-pattern</var> made up of
+ : <var>optional-digit-signs</var>, <var>mandatory-digit-signs</var>,
+ : and <var>grouping-separator-signs</var>.</p>
+ : <ul>
+ : <li>
+ : <p>The <var>optional-digit-sign</var> is the character "#".</p>
+ : </li>
+ : <li>
+ : <p>A <var>mandatory-digit-sign</var> is a <span title="character" class="termref" href="#character"><span class="arrow">·</span>character<span class="arrow">·</span></span> in
+ : Unicode category Nd. All <var>mandatory-digit-signs</var> within
+ : the format token must be from the same digit family, where a digit
+ : family is a sequence of ten consecutive characters in Unicode
+ : category Nd, having digit values 0 through 9. Within the format
+ : token, these digits are interchangeable: a three-digit number may
+ : thus be indicated equivalently by <code>000</code>,
+ : <code>001</code>, or <code>999</code>.</p>
+ : </li>
+ : <li>
+ : <p>a <var>grouping-separator-sign</var> is a non-alphanumeric
+ : character, that is a <span title="character" class="termref" href="#character"><span class="arrow">·</span>character<span class="arrow">·</span></span> whose Unicode category is other than Nd, Nl,
+ : No, Lu, Ll, Lt, Lm or Lo.</p>
+ : </li>
+ : </ul>
+ : <p>There <strong>must</strong> be at least one
+ : <var>mandatory-digit-sign</var>. There may be zero or more
+ : <var>optional-digit-signs</var>, and (if present) these
+ : <strong>must</strong> precede all <var>mandatory-digit-signs</var>.
+ : There may be zero or more <var>grouping-separator-signs</var>. A
+ : <var>grouping-separator-sign</var> <strong>must not</strong> appear
+ : at the start or end of the <var>decimal-digit-pattern</var>, nor
+ : adjacent to another <var>grouping-separator-sign</var>.</p>
+ : <p>The corresponding output format is a decimal number, using this
+ : digit family, with at least as many digits as there are
+ : <var>mandatory-digit-signs</var> in the format token. Thus, a
+ : format token <code>1</code> generates the sequence <code>0 1 2 ...
+ : 10 11 12 ...</code>, and a format token <code>01</code> (or
+ : equivalently, <code>00</code> or <code>99</code>) generates the
+ : sequence <code>00 01 02 ... 09 10 11 12 ... 99 100 101</code>. A
+ : format token of <code>&amp;#x661;</code> (Arabic-Indic digit one)
+ : generates the sequence <code>١</code> then <code>٢</code> then
+ : <code>٣</code> ...</p>
+ : <p>The <var>grouping-separator-signs</var> are handled as follows.
+ : The position of grouping separators within the format token,
+ : counting backwards from the last digit, indicates the position of
+ : grouping separators to appear within the formatted number, and the
+ : character used as the <var>grouping-separator-sign</var> within the
+ : format token indicates the character to be used as the
+ : corresponding grouping separator in the formatted number. If
+ : <var>grouping-separator-signs</var> appear at regular intervals
+ : within the format token, that is if the same grouping separator
+ : appears at positions forming a sequence <var>N</var>,
+ : 2<var>N</var>, 3<var>N</var>, ... for some integer value
+ : <var>N</var> (including the case where there is only one number in
+ : the list), then the sequence is extrapolated to the left, so
+ : grouping separators will be used in the formatted number at every
+ : multiple of <var>N</var>. For example, if the format token is
+ : <code>0'000</code> then the number one million will be formatted as
+ : <code>1'000'000</code>, while the number fifteen will be formatted
+ : as <code>0'015</code>.</p>
+ : <p>The only purpose of <var>optional-digit-signs</var> is to mark
+ : the position of <var>grouping-separator-signs</var>. For example,
+ : if the format token is <code>#'##0</code> then the number one
+ : million will be formatted as <code>1'000'000</code>, while the
+ : number fifteen will be formatted as <code>15</code>. A grouping
+ : separator is included in the formatted number only if there is a
+ : digit to its left, which will only be the case if either (a) the
+ : number is large enough to require that digit, or (b) the number of
+ : <var>mandatory-digit-signs</var> in the format token requires
+ : insignificant leading zeros to be present.</p>
+ : <div class="note">
+ : <p class="prefix"><b>Note:</b></p>
+ : <p>Numbers will never be truncated. Given the
+ : <var>decimal-digit-pattern</var> <code>01</code>, the number three
+ : hundred will be output as <code>300</code>, despite the absence of
+ : any <var>optional-digit-sign</var>.</p>
+ : </div>
+ : </li>
+ : <li>
+ : <p>The format token <code>A</code>, which generates the sequence
+ : <code>A B C ... Z AA AB AC...</code>.</p>
+ : </li>
+ : <li>
+ : <p>The format token <code>a</code>, which generates the sequence
+ : <code>a b c ... z aa ab ac...</code>.</p>
+ : </li>
+ : <li>
+ : <p>The format token <code>i</code>, which generates the sequence
+ : <code>i ii iii iv v vi vii viii ix x ...</code>.</p>
+ : </li>
+ : <li>
+ : <p>The format token <code>I</code>, which generates the sequence
+ : <code>I II III IV V VI VII VIII IX X ...</code>.</p>
+ : </li>
+ : <li>
+ : <p>The format token <code>w</code>, which generates numbers written
+ : as lower-case words, for example in English, <code>one two three
+ : four ...</code></p>
+ : </li>
+ : <li>
+ : <p>The format token <code>W</code>, which generates numbers written
+ : as upper-case words, for example in English, <code>ONE TWO THREE
+ : FOUR ...</code></p>
+ : </li>
+ : <li>
+ : <p>The format token <code>Ww</code>, which generates numbers
+ : written as title-case words, for example in English, <code>One Two
+ : Three Four ...</code></p>
+ : </li>
+ : <li>
+ : <p>Any other format token, which indicates a numbering sequence in
+ : which that token represents the number 1 (one) (but see the note
+ : below). It is <span title="implementation-defined" class="termref" href="#implementation-defined"><span class="arrow">·</span>implementation-defined<span class="arrow">·</span></span> which numbering sequences, additional to those
+ : listed above, are supported. If an implementation does not support
+ : a numbering sequence represented by the given token, it
+ : <strong>must</strong> use a format token of <code>1</code>.</p>
+ : <div class="note">
+ : <p class="prefix"><b>Note:</b></p>
+ : <p>In some traditional numbering sequences additional signs are
+ : added to denote that the letters should be interpreted as numbers;
+ : these are not included in the format token. An example (see also
+ : the example below) is classical Greek where a <em>dexia keraia</em>
+ : (x0374, ʹ) and sometimes an <em>aristeri keraia</em> (x0375, ͵) is
+ : added.</p>
+ : </div>
+ : </li>
+ : </ul>
+ : <p>For all format tokens other than the first kind above (one that
+ : consists of decimal digits), there <strong>may</strong> be
+ : <span title="implementation-defined" class="termref" href="#implementation-defined"><span class="arrow">·</span>implementation-defined<span class="arrow">·</span></span> lower and upper bounds on the range of numbers
+ : that can be formatted using this format token; indeed, for some
+ : numbering sequences there may be intrinsic limits. For example, the
+ : format token <code>&amp;#x2460;</code> (circled digit one, ①) has a
+ : range of 1 to 20 imposed by the Unicode character repertoire. For
+ : the numbering sequences described above any upper bound imposed by
+ : the implementation <strong>must not</strong> be less than 1000 (one
+ : thousand) and any lower bound must not be greater than 1. Numbers
+ : that fall outside this range <strong>must</strong> be formatted
+ : using the format token <code>1</code>.</p>
+ : <p>The above expansions of numbering sequences for format tokens
+ : such as <code>a</code> and <code>i</code> are indicative but not
+ : prescriptive. There are various conventions in use for how
+ : alphabetic sequences continue when the alphabet is exhausted, and
+ : differing conventions for how roman numerals are written (for
+ : example, <code>IV</code> versus <code>IIII</code> as the
+ : representation of the number 4). Sometimes alphabetic sequences are
+ : used that omit letters such as <code>i</code> and <code>o</code>.
+ : This specification does not prescribe the detail of any sequence
+ : other than those sequences consisting entirely of decimal
+ : digits.</p>
+ : <p>Many numbering sequences are language-sensitive. This applies
+ : especially to the sequence selected by the tokens <code>w</code>,
+ : <code>W</code> and <code>Ww</code>. It also applies to other
+ : sequences, for example different languages using the Cyrillic
+ : alphabet use different sequences of characters, each starting with
+ : the letter #x410 (Cyrillic capital letter A). In such cases, the
+ : <code>$language</code> argument specifies which language's
+ : conventions are to be used. <span>If the argument is specified, the
+ : value <strong>should</strong> be a string that is castable to the
+ : type <code>xs:language</code></span>.</p>
+ : <p>The set of languages for which numbering is supported is
+ : <span title="implementation-defined" class="termref" href="#implementation-defined"><span class="arrow">·</span>implementation-defined<span class="arrow">·</span></span>. If the <code>$language</code> argument is
+ : absent, or is set to an empty sequence, or is invalid, or is not a
+ : language supported by the implementation, then the number is
+ : formatted using a default language; the default language is
+ : <span title="implementation-defined" class="termref" href="#implementation-defined"><span class="arrow">·</span>implementation-defined<span class="arrow">·</span></span>.</p>
+ : <p>The format modifier, if present, is one <span>or more</span> of
+ : the following, in order:</p>
+ : <ul>
+ : <li>
+ : <p>either <code>c</code> or <code>o</code>, optionally followed by
+ : a sequence of characters enclosed between parentheses, to indicate
+ : cardinal or ordinal numbering respectively, the default being
+ : cardinal numbering</p>
+ : </li>
+ : <li>
+ : <p>either <code>a</code> or <code>t</code>, to indicate alphabetic
+ : or traditional numbering respectively, the default being <span title="implementation-defined" class="termref" href="#implementation-defined"><span class="arrow">·</span>implementation-defined<span class="arrow">·</span></span>.</p>
+ : </li>
+ : </ul>
+ : <p>If the <code>o</code> modifier is present, this indicates a
+ : request to output ordinal numbers rather than cardinal numbers. For
+ : example, in English, when used with the format token
+ : <code>1</code>, this outputs the sequence <code>1st 2nd 3rd 4th
+ : ...</code>, and when used with the format token <code>w</code>
+ : outputs the sequence <code>first second third fourth
+ : ...</code>.</p>
+ : <p>In some languages, ordinal numbers vary depending on the
+ : grammatical context, for example they may have different genders
+ : and may decline with the noun that they qualify. In such cases the
+ : string appearing in parentheses after the letter <code>o</code> may
+ : be used to indicate the variation of the ordinal number required.
+ : The way in which the variation is indicated will depend on the
+ : conventions of the language. For inflected languages that vary the
+ : ending of the word, the preferred approach is to indicate the
+ : required ending, preceded by a hyphen: for example in German,
+ : appropriate values are <code>o(-e)</code>, <code>o(-er)</code>,
+ : <code>o(-es)</code>, <code>o(-en)</code>.</p>
+ : <p>It is <span title="implementation-defined" class="termref" href="#implementation-defined"><span class="arrow">·</span>implementation-defined<span class="arrow">·</span></span> what combinations of values of the format
+ : token, the language, and the cardinal/ordinal modifier are
+ : supported. If ordinal numbering is not supported for the
+ : combination of the format token, the language, and the string
+ : appearing in parentheses, the request is ignored and cardinal
+ : numbers are generated instead.</p>
+ : <div class="exampleOuter">
+ : <div class="exampleHeader"><span name="d5e6102" id="d5e6102"/>Example: Ordinal Numbering in Italian</div>
+ : <p>The specification <code>"1o(-º)"</code> with
+ : <code>$language</code> equal to <code>it</code>, if supported,
+ : should produce the sequence:</p>
+ : <div class="exampleInner">
+ : <pre>
+ : 1º 2º 3º 4º ...
+ : </pre></div>
+ : <p>The specification <code>"Wwo"</code> with <code>$language</code>
+ : equal to <code>it</code>, if supported, should produce the
+ : sequence:</p>
+ : <div class="exampleInner">
+ : <pre>
+ : Primo Secondo Terzo Quarto Quinto ...
+ : </pre></div>
+ : </div>
+ : <p>The <span>use of the <code>a</code> or <code>t</code>
+ : modifier</span> disambiguates between numbering sequences that use
+ : letters. In many languages there are two commonly used numbering
+ : sequences that use letters. One numbering sequence assigns numeric
+ : values to letters in alphabetic sequence, and the other assigns
+ : numeric values to each letter in some other manner traditional in
+ : that language. In English, these would correspond to the numbering
+ : sequences specified by the format tokens <code>a</code> and
+ : <code>i</code>. In some languages, the first member of each
+ : sequence is the same, and so the format token alone would be
+ : ambiguous. <span>In the absence of the <code>a</code> or
+ : <code>t</code> modifier, the default is <span title="implementation-defined" class="termref" href="#implementation-defined"><span class="arrow">·</span>implementation-defined<span class="arrow">·</span></span></span>.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>format-integer(123, '0000')</code> returns
+ : <code>"0123"</code>.</p>
+ : <p><code>format-integer(123, 'w')</code> might return <code>"one
+ : hundred and twenty-three"</code></p>
+ : <p>The expression <code>format-integer(21, '1o', 'en')</code>
+ : returns <code>"21st"</code>.</p>
+ : <p><code>format-integer(14, 'Wwo(-e)', 'de')</code> might return
+ : <code>"Vierzehnte"</code></p>
+ : <p>The expression <code>format-integer(7, 'a')</code> returns
+ : <code>"g"</code>.</p>
+ : <p>The expression <code>format-integer(57, 'I')</code> returns
+ : <code>"LVII"</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-format-integer
+ :)
+declare function fn:format-integer( $value as xs:integer?,  $picture as xs:string,  $language as xs:string) as  xs:string external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns a string containing a number formatted according to a
+ : given picture string, taking account of decimal formats specified
+ : in the static context.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:format-number</code>(<code class="arg">$value</code><code class="as"> as </code><code class="type">numeric?</code>, <code class="arg">$picture</code><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:string</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="3"><code class="function">fn:format-number</code>(</td>
+ : <td valign="baseline"><code class="arg">$value</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">numeric?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$picture</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$decimal-format-name</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>)<code class="as"> as </code><code class="return-type">xs:string</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>The two-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : <p>The three-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.
+ : It depends on decimal-formats and namespaces.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The effect of the two-argument form of the function is
+ : equivalent to calling the three-argument form with an empty
+ : sequence as the value of the third argument.</p>
+ : <p>The function formats <code>$value</code> as a string using the
+ : <span title="picture string" class="termref" href="#dt-picture-string"><span class="arrow">·</span>picture
+ : string<span class="arrow">·</span></span> specified by the
+ : <code>$picture</code> argument and the decimal-format named by the
+ : <code>$decimal-format-name</code> argument, or the default
+ : decimal-format, if there is no <code>$decimal-format-name</code>
+ : argument. The syntax of the picture string is described in <span href="#syntax-of-picture-string"><b>4.7.3 Syntax of the picture
+ : string</b></span>.</p>
+ : <p>The <code>$value</code> argument may be of any numeric data type
+ : (<code>xs:double</code>, <code>xs:float</code>,
+ : <code>xs:decimal</code>, or their subtypes including
+ : <code>xs:integer</code>). Note that if an <code>xs:decimal</code>
+ : is supplied, it is not automatically promoted to an
+ : <code>xs:double</code>, as such promotion can involve a loss of
+ : precision.</p>
+ : <p>If the supplied value of the <code>$value</code> argument is an
+ : empty sequence, the function behaves as if the supplied value were
+ : the <code>xs:double</code> value <code>NaN</code>.</p>
+ : <p>The value of <code>$decimal-format-name</code>, <span>if present
+ : and non-empty,</span> <strong>must</strong> be a lexical QName,
+ : which is expanded using the <span>statically known
+ : namespaces</span>. The default namespace is not used (no prefix
+ : means no namespace).</p>
+ : <p>The decimal format that is used is the decimal format in the
+ : static context whose name matches <code>$decimal-format-name</code>
+ : if supplied, or the default decimal format in the static context
+ : otherwise.</p>
+ : <p>The evaluation of the <code>format-number</code> function takes
+ : place in two phases, an analysis phase described in <span href="#analysing-picture-string"><b>4.7.4 Analysing the picture
+ : string</b></span> and a formatting phase described in <span href="#formatting-the-number"><b>4.7.5 Formatting the
+ : number</b></span>.</p>
+ : <p>The analysis phase takes as its inputs the <span title="picture string" class="termref" href="#dt-picture-string"><span class="arrow">·</span>picture
+ : string<span class="arrow">·</span></span> and the variables derived
+ : from the relevant decimal format in the static context, and
+ : produces as its output a number of variables with defined values.
+ : The formatting phase takes as its inputs the number to be formatted
+ : and the variables produced by the analysis phase, and produces as
+ : its output a string containing a formatted representation of the
+ : number.</p>
+ : <p>The result of the function is the formatted string
+ : representation of the supplied number.</p>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>An error is raised [<span href="#ERRFODF1280" title="err:FODF1280">err:FODF1280</span>] if the name specified as the
+ : <code>$decimal-format-name</code> argument is not a valid lexical
+ : QName, or if its prefix <span>is not found in the statically known
+ : namespaces</span>, or if the static context does not contain a
+ : declaration of a decimal-format with a matching expanded QName. If
+ : the processor is able to detect the error statically (for example,
+ : when the argument is supplied as a string literal), then the
+ : processor <strong>may</strong> optionally signal this as a static
+ : error.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>Numbers will always be formatted with the most significant digit
+ : on the left.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>format-number(12345.6, '#.###,00')</code>
+ : returns <code>"12.345,00"</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-format-number
+ :)
+declare function fn:format-number($value as numeric?,  $picture as xs:string) as  xs:string external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns a string containing a number formatted according to a
+ : given picture string, taking account of decimal formats specified
+ : in the static context.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:format-number</code>(<code class="arg">$value</code><code class="as"> as </code><code class="type">numeric?</code>, <code class="arg">$picture</code><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:string</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="3"><code class="function">fn:format-number</code>(</td>
+ : <td valign="baseline"><code class="arg">$value</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">numeric?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$picture</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$decimal-format-name</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>)<code class="as"> as </code><code class="return-type">xs:string</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>The two-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : <p>The three-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.
+ : It depends on decimal-formats and namespaces.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The effect of the two-argument form of the function is
+ : equivalent to calling the three-argument form with an empty
+ : sequence as the value of the third argument.</p>
+ : <p>The function formats <code>$value</code> as a string using the
+ : <span title="picture string" class="termref" href="#dt-picture-string"><span class="arrow">·</span>picture
+ : string<span class="arrow">·</span></span> specified by the
+ : <code>$picture</code> argument and the decimal-format named by the
+ : <code>$decimal-format-name</code> argument, or the default
+ : decimal-format, if there is no <code>$decimal-format-name</code>
+ : argument. The syntax of the picture string is described in <span href="#syntax-of-picture-string"><b>4.7.3 Syntax of the picture
+ : string</b></span>.</p>
+ : <p>The <code>$value</code> argument may be of any numeric data type
+ : (<code>xs:double</code>, <code>xs:float</code>,
+ : <code>xs:decimal</code>, or their subtypes including
+ : <code>xs:integer</code>). Note that if an <code>xs:decimal</code>
+ : is supplied, it is not automatically promoted to an
+ : <code>xs:double</code>, as such promotion can involve a loss of
+ : precision.</p>
+ : <p>If the supplied value of the <code>$value</code> argument is an
+ : empty sequence, the function behaves as if the supplied value were
+ : the <code>xs:double</code> value <code>NaN</code>.</p>
+ : <p>The value of <code>$decimal-format-name</code>, <span>if present
+ : and non-empty,</span> <strong>must</strong> be a lexical QName,
+ : which is expanded using the <span>statically known
+ : namespaces</span>. The default namespace is not used (no prefix
+ : means no namespace).</p>
+ : <p>The decimal format that is used is the decimal format in the
+ : static context whose name matches <code>$decimal-format-name</code>
+ : if supplied, or the default decimal format in the static context
+ : otherwise.</p>
+ : <p>The evaluation of the <code>format-number</code> function takes
+ : place in two phases, an analysis phase described in <span href="#analysing-picture-string"><b>4.7.4 Analysing the picture
+ : string</b></span> and a formatting phase described in <span href="#formatting-the-number"><b>4.7.5 Formatting the
+ : number</b></span>.</p>
+ : <p>The analysis phase takes as its inputs the <span title="picture string" class="termref" href="#dt-picture-string"><span class="arrow">·</span>picture
+ : string<span class="arrow">·</span></span> and the variables derived
+ : from the relevant decimal format in the static context, and
+ : produces as its output a number of variables with defined values.
+ : The formatting phase takes as its inputs the number to be formatted
+ : and the variables produced by the analysis phase, and produces as
+ : its output a string containing a formatted representation of the
+ : number.</p>
+ : <p>The result of the function is the formatted string
+ : representation of the supplied number.</p>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>An error is raised [<span href="#ERRFODF1280" title="err:FODF1280">err:FODF1280</span>] if the name specified as the
+ : <code>$decimal-format-name</code> argument is not a valid lexical
+ : QName, or if its prefix <span>is not found in the statically known
+ : namespaces</span>, or if the static context does not contain a
+ : declaration of a decimal-format with a matching expanded QName. If
+ : the processor is able to detect the error statically (for example,
+ : when the argument is supplied as a string literal), then the
+ : processor <strong>may</strong> optionally signal this as a static
+ : error.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>Numbers will always be formatted with the most significant digit
+ : on the left.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>format-number(12345.6, '#.###,00')</code>
+ : returns <code>"12.345,00"</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-format-number
+ :)
+declare function fn:format-number( $value as numeric?,  $picture as xs:string,  $decimal-format-name as xs:string) as  xs:string external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns a string containing an <code>xs:time</code> value
+ : formatted for display.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:format-time</code>(<code class="arg">$value</code><code class="as"> as </code><code class="type">xs:time?</code>, <code class="arg">$picture</code><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:string?</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="5"><code class="function">fn:format-time</code>(</td>
+ : <td valign="baseline"><code class="arg">$value</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:time?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$picture</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$language</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$calendar</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$place</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>)<code class="as"> as </code><code class="return-type">xs:string?</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>See <span href="#rules-for-datetime-formatting"><b>9.8.4 The
+ : date/time formatting functions</b></span>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-format-time
+ :)
+declare function fn:format-time( $value as xs:time?,  $picture as xs:string,  $language as xs:string?,  $calendar as xs:string?,  $place as xs:string?) as  xs:string? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns a string containing an <code>xs:time</code> value
+ : formatted for display.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:format-time</code>(<code class="arg">$value</code><code class="as"> as </code><code class="type">xs:time?</code>, <code class="arg">$picture</code><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:string?</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="5"><code class="function">fn:format-time</code>(</td>
+ : <td valign="baseline"><code class="arg">$value</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:time?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$picture</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$language</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$calendar</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$place</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>)<code class="as"> as </code><code class="return-type">xs:string?</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>See <span href="#rules-for-datetime-formatting"><b>9.8.4 The
+ : date/time formatting functions</b></span>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-format-time
+ :)
+declare function fn:format-time($value as xs:time?,  $picture as xs:string) as  xs:string? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns the arity of the function identified by a function
+ : item.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:function-arity</code>(<code class="arg">$func</code><code class="as"> as </code><code class="type">function(*)</code>)<code class="as"> as </code><code class="return-type">xs:integer</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The <code>fn:function-arity</code> function returns the arity
+ : (number of arguments) of the function identified by
+ : <code>$func</code>.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:function-arity(fn:substring#2)</code>
+ : returns <code>2</code>.</p>
+ : <p>The expression
+ : <code>fn:function-arity(function($node){name($node)})</code>
+ : returns <code>1</code>.</p>
+ : <p>The expression <code>let $initial := fn:substring(?, 1, 1)
+ : return fn:function-arity($initial)</code> returns
+ : <code>1</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-function-arity
+ :)
+declare function fn:function-arity($func as function(*)) as  xs:integer external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>This function returns a string that uniquely identifies a given
+ : node.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:generate-id</code>()<code class="as"> as </code><code class="return-type">xs:string</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:generate-id</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">node()?</code>)<code class="as"> as </code><code class="return-type">xs:string</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>The zero-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-dependent"><span class="arrow">·</span>focus-dependent<span class="arrow">·</span></span>.</p>
+ : <p>The one-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If the argument is omitted, it defaults to the context item
+ : (<code>.</code>). The behavior of the function if the argument is
+ : omitted is exactly the same as if the context item had been passed
+ : as the argument.</p>
+ : <p>If the argument is the empty sequence, the result is the
+ : zero-length string.</p>
+ : <p>In other cases, the function returns a string that uniquely
+ : identifies a given node.</p>
+ : <p>The returned identifier <strong>must</strong> consist of ASCII
+ : alphanumeric characters and <strong>must</strong> start with an
+ : alphabetic character. Thus, the string is syntactically an XML
+ : name.</p>
+ : <p>An implementation is free to generate an identifier in any
+ : convenient way provided that it always generates the same
+ : identifier for the same node and that different identifiers are
+ : always generated from different nodes. An implementation is under
+ : no obligation to generate the same identifiers each time a document
+ : is transformed or queried.</p>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>The following errors may be raised when <code>$arg</code> is
+ : omitted: if the context item is <span href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent";>absent</span><sup><small>DM30</small></sup>
+ : [<span href="http://www.w3.org/TR/xpath20/#ERRXPDY0002"; title="err:XPDY0002">err:XPDY0002</span>]<sup><small>XP</small></sup>; if
+ : the context item is not a node [<span href="http://www.w3.org/TR/xpath20/#ERRXPTY0004"; title="err:XPTY0004">err:XPTY0004</span>]<sup><small>XP</small></sup>.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>There is no guarantee that a generated unique identifier will be
+ : distinct from any unique IDs specified in the source document.</p>
+ : <p>There is no inverse to this function; it is not directly
+ : possible to find the node with a given generated ID. Of course, it
+ : is possible to search a given sequence of nodes using an expression
+ : such as <code>$nodes[generate-id()=$id]</code>.</p>
+ : <p>It is advisable, but not required, for implementations to
+ : generate IDs that are distinct even when compared using a
+ : case-blind collation.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The primary use case for this function is to generate
+ : hyperlinks. For example, when generating HTML, an anchor for a
+ : given section <code>$sect</code> can be generated by writing (in
+ : either XSLT or XQuery):</p>
+ : <p><code>&lt;a name="{generate-id($sect)}"/&gt;</code></p>
+ : <p>and a link to that section can then be produced with code such
+ : as:</p>
+ : <p><code>see &lt;a
+ : href="#{generate-id($sect)}"&gt;here&lt;/a&gt;</code></p>
+ : <p>Note that anchors generated in this way will not necessarily be
+ : the same each time a document is republished.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-generate-id
+ :)
+declare function fn:generate-id() as  xs:string external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>This function returns a string that uniquely identifies a given
+ : node.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:generate-id</code>()<code class="as"> as </code><code class="return-type">xs:string</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:generate-id</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">node()?</code>)<code class="as"> as </code><code class="return-type">xs:string</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>The zero-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-dependent"><span class="arrow">·</span>focus-dependent<span class="arrow">·</span></span>.</p>
+ : <p>The one-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If the argument is omitted, it defaults to the context item
+ : (<code>.</code>). The behavior of the function if the argument is
+ : omitted is exactly the same as if the context item had been passed
+ : as the argument.</p>
+ : <p>If the argument is the empty sequence, the result is the
+ : zero-length string.</p>
+ : <p>In other cases, the function returns a string that uniquely
+ : identifies a given node.</p>
+ : <p>The returned identifier <strong>must</strong> consist of ASCII
+ : alphanumeric characters and <strong>must</strong> start with an
+ : alphabetic character. Thus, the string is syntactically an XML
+ : name.</p>
+ : <p>An implementation is free to generate an identifier in any
+ : convenient way provided that it always generates the same
+ : identifier for the same node and that different identifiers are
+ : always generated from different nodes. An implementation is under
+ : no obligation to generate the same identifiers each time a document
+ : is transformed or queried.</p>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>The following errors may be raised when <code>$arg</code> is
+ : omitted: if the context item is <span href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent";>absent</span><sup><small>DM30</small></sup>
+ : [<span href="http://www.w3.org/TR/xpath20/#ERRXPDY0002"; title="err:XPDY0002">err:XPDY0002</span>]<sup><small>XP</small></sup>; if
+ : the context item is not a node [<span href="http://www.w3.org/TR/xpath20/#ERRXPTY0004"; title="err:XPTY0004">err:XPTY0004</span>]<sup><small>XP</small></sup>.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>There is no guarantee that a generated unique identifier will be
+ : distinct from any unique IDs specified in the source document.</p>
+ : <p>There is no inverse to this function; it is not directly
+ : possible to find the node with a given generated ID. Of course, it
+ : is possible to search a given sequence of nodes using an expression
+ : such as <code>$nodes[generate-id()=$id]</code>.</p>
+ : <p>It is advisable, but not required, for implementations to
+ : generate IDs that are distinct even when compared using a
+ : case-blind collation.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The primary use case for this function is to generate
+ : hyperlinks. For example, when generating HTML, an anchor for a
+ : given section <code>$sect</code> can be generated by writing (in
+ : either XSLT or XQuery):</p>
+ : <p><code>&lt;a name="{generate-id($sect)}"/&gt;</code></p>
+ : <p>and a link to that section can then be produced with code such
+ : as:</p>
+ : <p><code>see &lt;a
+ : href="#{generate-id($sect)}"&gt;here&lt;/a&gt;</code></p>
+ : <p>Note that anchors generated in this way will not necessarily be
+ : the same each time a document is republished.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-generate-id
+ :)
+declare function fn:generate-id($arg as node()?) as  xs:string external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns the first item in a sequence.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:head</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">item()*</code>)<code class="as"> as </code><code class="return-type">item()?</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The function returns the value of the expression
+ : <code>$arg[1]</code></p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>If <code>$arg</code> is the empty sequence, the empty sequence
+ : is returned. Otherwise the first item in the sequence is
+ : returned.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:head(1 to 5)</code> returns
+ : <code>1</code>.</p>
+ : <p>The expression <code>fn:head(("a", "b", "c"))</code> returns
+ : <code>"a"</code>.</p>
+ : <p>The expression <code>fn:head(())</code> returns
+ : <code>()</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-head
+ :)
+declare function fn:head($arg as item()*) as  item()? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns the number of hours in a duration.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:hours-from-duration</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:duration?</code>)<code class="as"> as </code><code class="return-type">xs:integer?</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If <code>$arg</code> is the empty sequence, the function returns
+ : the empty sequence.</p>
+ : <p>Otherwise, the function returns an <code>xs:integer</code>
+ : representing the hours component in the value of <code>$arg</code>.
+ : The result is obtained by casting <code>$arg</code> to an
+ : <code>xs:dayTimeDuration</code> (see <span href="#casting-to-durations"><b>18.1.3 Casting to duration
+ : types</b></span>) and then computing the hours component as described
+ : in <span href="#canonical-dayTimeDuration"><b>8.1.2.3 Canonical
+ : representation</b></span>.</p>
+ : <p>If <code>$arg</code> is a negative duration then the result will
+ : be negative..</p>
+ : <p>If <code>$arg</code> is an <code>xs:yearMonthDuration</code> the
+ : function returns 0.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression
+ : <code>fn:hours-from-duration(xs:dayTimeDuration("P3DT10H"))</code>
+ : returns <code>10</code>.</p>
+ : <p>The expression
+ : <code>fn:hours-from-duration(xs:dayTimeDuration("P3DT12H32M12S"))</code>
+ : returns <code>12</code>.</p>
+ : <p>The expression
+ : <code>fn:hours-from-duration(xs:dayTimeDuration("PT123H"))</code>
+ : returns <code>3</code>.</p>
+ : <p>The expression
+ : <code>fn:hours-from-duration(xs:dayTimeDuration("-P3DT10H"))</code>
+ : returns <code>-10</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-hours-from-duration
+ :)
+declare function fn:hours-from-duration($arg as xs:duration?) as  xs:integer? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns the hours component of an <code>xs:time</code>.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:hours-from-time</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:time?</code>)<code class="as"> as </code><code class="return-type">xs:integer?</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If <code>$arg</code> is the empty sequence, the function returns
+ : the empty sequence.</p>
+ : <p>Otherwise, the function returns an <code>xs:integer</code>
+ : between 0 and 23, both inclusive, representing the value of the
+ : hours component in the local value of <code>$arg</code>.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>Assume that the dynamic context provides an implicit timezone
+ : value of <code>-05:00</code>.</p>
+ : <p>The expression
+ : <code>fn:hours-from-time(xs:time("11:23:00"))</code> returns
+ : <code>11</code>.</p>
+ : <p>The expression
+ : <code>fn:hours-from-time(xs:time("21:23:00"))</code> returns
+ : <code>21</code>.</p>
+ : <p>The expression
+ : <code>fn:hours-from-time(xs:time("01:23:00+05:00"))</code> returns
+ : <code>1</code>.</p>
+ : <p>The expression
+ : <code>fn:hours-from-time(fn:adjust-time-to-timezone(xs:time("01:23:00+05:00"),
+ : xs:dayTimeDuration("PT0S")))</code> returns <code>20</code>.</p>
+ : <p>The expression
+ : <code>fn:hours-from-time(xs:time("24:00:00"))</code> returns
+ : <code>0</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-hours-from-time
+ :)
+declare function fn:hours-from-time($arg as xs:time?) as  xs:integer? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns the sequence of element nodes that have an
+ : <code>ID</code> value matching the value of one or more of the
+ : <code>IDREF</code> values supplied in <code>$arg</code>.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:id</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:string*</code>)<code class="as"> as </code><code class="return-type">element()*</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:id</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:string*</code>, <code class="arg">$node</code><code class="as"> as </code><code class="type">node()</code>)<code class="as"> as </code><code class="return-type">element()*</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>The one-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-dependent"><span class="arrow">·</span>focus-dependent<span class="arrow">·</span></span>.</p>
+ : <p>The two-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The function returns a sequence, in document order with
+ : duplicates eliminated, containing every element node <code>E</code>
+ : that satisfies all the following conditions:</p>
+ : <ol class="enumar">
+ : <li>
+ : <p><code>E</code> is in the target document. The target document is
+ : the document containing <code>$node</code>, or the document
+ : containing the context item (<code>.</code>) if the second argument
+ : is omitted. The behavior of the function if <code>$node</code> is
+ : omitted is exactly the same as if the context item had been passed
+ : as <code>$node</code>.</p>
+ : </li>
+ : <li>
+ : <p><code>E</code> has an <code>ID</code> value equal to one of the
+ : candidate <code>IDREF</code> values, where:</p>
+ : <ul>
+ : <li>
+ : <p>An element has an <code>ID</code> value equal to <code>V</code>
+ : if either or both of the following conditions are true:</p>
+ : <ul>
+ : <li>
+ : <p>The <code>is-id</code> property (See <span href="http://www.w3.org/TR/xpath-datamodel-30/#dm-is-id";>Section 5.5
+ : is-id Accessor</span> <sup><small>DM30</small></sup>.) of the element
+ : node is true, and the typed value of the element node is equal to V
+ : under the rules of the <code>eq</code> operator using the Unicode
+ : codepoint collation
+ : (<code>http://www.w3.org/2005/xpath-functions/collation/codepoint</code>).</p>
+ : </li>
+ : <li>
+ : <p>The element has an attribute node whose <code>is-id</code>
+ : property (See <span href="http://www.w3.org/TR/xpath-datamodel-30/#dm-is-id";>Section 5.5
+ : is-id Accessor</span> <sup><small>DM30</small></sup>.) is true and
+ : whose typed value is equal to <code>V</code> under the rules of the
+ : <code>eq</code> operator using the Unicode code point collation
+ : (<code>http://www.w3.org/2005/xpath-functions/collation/codepoint</code>).</p>
+ : </li>
+ : </ul>
+ : </li>
+ : <li>
+ : <p>Each <code>xs:string</code> in <code>$arg</code> is parsed as if
+ : it were of type <code>IDREFS</code>, that is, each
+ : <code>xs:string</code> in <code>$arg</code> is treated as a
+ : whitespace-separated sequence of tokens, each acting as an
+ : <code>IDREF</code>. These tokens are then included in the list of
+ : candidate <code>IDREF</code>s. If any of the tokens is not a
+ : lexically valid <code>IDREF</code> (that is, if it is not lexically
+ : an <code>xs:NCName</code>), it is ignored. Formally, the candidate
+ : <code>IDREF</code> values are the strings in the sequence given by
+ : the expression:</p>
+ : <div class="exampleInner">
+ : <pre>
+ : for $s in $arg return 
+ :     fn:tokenize(fn:normalize-space($s), ' ')[. castable as xs:IDREF]
+ : </pre></div>
+ : </li>
+ : </ul>
+ : </li>
+ : <li>
+ : <p>If several elements have the same <code>ID</code> value, then
+ : <code>E</code> is the one that is first in document order.</p>
+ : </li>
+ : </ol>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>An error is raised [<span href="#ERRFODC0001" title="err:FODC0001">err:FODC0001</span>] if <code>$node</code>, or the
+ : context item if the second argument is absent, is a node in a tree
+ : whose root is not a document node.</p>
+ : <p>If the second argument is the context item, or is omitted, the
+ : following errors may be raised: if the context item is <span href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent";>absent</span><sup><small>DM30</small></sup>,
+ : [<span href="http://www.w3.org/TR/xpath20/#ERRXPDY0002"; title="err:XPDY0002">err:XPDY0002</span>]<sup><small>XP</small></sup>; if
+ : the context item is not a node [<span href="http://www.w3.org/TR/xpath20/#ERRXPTY0004"; title="err:XPTY0004">err:XPTY0004</span>]<sup><small>XP</small></sup>.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>The effect of this function is anomalous in respect of element
+ : nodes with the <code>is-id</code> property. For legacy reasons,
+ : this function returns the element that has the <code>is-id</code>
+ : property, whereas it would be more appropriate to return its
+ : parent, that being the element that is uniquely identified by the
+ : ID. A new function <code>element-with-id</code> is being introduced
+ : with the desired behavior.</p>
+ : <p>If the data model is constructed from an Infoset, an attribute
+ : will have the <code>is-id</code> property if the corresponding
+ : attribute in the Infoset had an attribute type of <code>ID</code>:
+ : typically this means the attribute was declared as an
+ : <code>ID</code> in a DTD.</p>
+ : <p>If the data model is constructed from a PSVI, an element or
+ : attribute will have the <code>is-id</code> property if its typed
+ : value is a single atomic value of type <code>xs:ID</code> or a type
+ : derived by restriction from <code>xs:ID</code>.</p>
+ : <p>No error is raised in respect of a candidate <code>IDREF</code>
+ : value that does not match the <code>ID</code> of any element in the
+ : document. If no candidate <code>IDREF</code> value matches the
+ : <code>ID</code> value of any element, the function returns the
+ : empty sequence.</p>
+ : <p>It is not necessary that the supplied argument should have type
+ : <code>xs:IDREF</code> or <code>xs:IDREFS</code>, or that it should
+ : be derived from a node with the <code>is-idrefs</code>
+ : property.</p>
+ : <p>An element may have more than one <code>ID</code> value. This
+ : can occur with synthetic data models or with data models
+ : constructed from a PSVI where the element and one of its attributes
+ : are both typed as <code>xs:ID</code>.</p>
+ : <p>If the source document is well-formed but not valid, it is
+ : possible for two or more elements to have the same <code>ID</code>
+ : value. In this situation, the function will select the first such
+ : element.</p>
+ : <p>It is also possible in a well-formed but invalid document to
+ : have an element or attribute that has the <code>is-id</code>
+ : property but whose value does not conform to the lexical rules for
+ : the <code>xs:ID</code> type. Such a node will never be selected by
+ : this function.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>let <code>$emp</code> :=</p>
+ : <div class="exampleInner">
+ : <pre>
+ :             &lt;employee xml:id="ID21256"&gt;
+ :                &lt;empnr&gt;E21256&lt;/empnr&gt;
+ :                &lt;first&gt;John&lt;/first&gt;
+ :                &lt;last&gt;Brown&lt;/last&gt;
+ :             &lt;/employee&gt;
+ :          
+ : </pre></div>
+ : <p>The expression <code>id('ID21256')/name()</code> returns
+ : <code>employee</code>. <em>(The <code>xml:id</code> attribute has
+ : the <code>is-id</code> property, so the employee element is
+ : selected.).</em></p>
+ : <p>The expression <code>id('E21256')/name()</code> returns
+ : <code>empnr</code>. <em>(Assuming the <code>empnr</code> element is
+ : given the type <code>xs:ID</code> as a result of schema validation,
+ : the element will have the <code>is-id</code> property and is
+ : therefore selected. Note the difference from the behavior of
+ : <span href="#func-element-with-id"><code>fn:element-with-id</code></span>.).</em></p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-id
+ :)
+declare function fn:id($arg as xs:string*) as  element()* external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns the sequence of element nodes that have an
+ : <code>ID</code> value matching the value of one or more of the
+ : <code>IDREF</code> values supplied in <code>$arg</code>.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:id</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:string*</code>)<code class="as"> as </code><code class="return-type">element()*</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:id</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:string*</code>, <code class="arg">$node</code><code class="as"> as </code><code class="type">node()</code>)<code class="as"> as </code><code class="return-type">element()*</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>The one-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-dependent"><span class="arrow">·</span>focus-dependent<span class="arrow">·</span></span>.</p>
+ : <p>The two-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The function returns a sequence, in document order with
+ : duplicates eliminated, containing every element node <code>E</code>
+ : that satisfies all the following conditions:</p>
+ : <ol class="enumar">
+ : <li>
+ : <p><code>E</code> is in the target document. The target document is
+ : the document containing <code>$node</code>, or the document
+ : containing the context item (<code>.</code>) if the second argument
+ : is omitted. The behavior of the function if <code>$node</code> is
+ : omitted is exactly the same as if the context item had been passed
+ : as <code>$node</code>.</p>
+ : </li>
+ : <li>
+ : <p><code>E</code> has an <code>ID</code> value equal to one of the
+ : candidate <code>IDREF</code> values, where:</p>
+ : <ul>
+ : <li>
+ : <p>An element has an <code>ID</code> value equal to <code>V</code>
+ : if either or both of the following conditions are true:</p>
+ : <ul>
+ : <li>
+ : <p>The <code>is-id</code> property (See <span href="http://www.w3.org/TR/xpath-datamodel-30/#dm-is-id";>Section 5.5
+ : is-id Accessor</span> <sup><small>DM30</small></sup>.) of the element
+ : node is true, and the typed value of the element node is equal to V
+ : under the rules of the <code>eq</code> operator using the Unicode
+ : codepoint collation
+ : (<code>http://www.w3.org/2005/xpath-functions/collation/codepoint</code>).</p>
+ : </li>
+ : <li>
+ : <p>The element has an attribute node whose <code>is-id</code>
+ : property (See <span href="http://www.w3.org/TR/xpath-datamodel-30/#dm-is-id";>Section 5.5
+ : is-id Accessor</span> <sup><small>DM30</small></sup>.) is true and
+ : whose typed value is equal to <code>V</code> under the rules of the
+ : <code>eq</code> operator using the Unicode code point collation
+ : (<code>http://www.w3.org/2005/xpath-functions/collation/codepoint</code>).</p>
+ : </li>
+ : </ul>
+ : </li>
+ : <li>
+ : <p>Each <code>xs:string</code> in <code>$arg</code> is parsed as if
+ : it were of type <code>IDREFS</code>, that is, each
+ : <code>xs:string</code> in <code>$arg</code> is treated as a
+ : whitespace-separated sequence of tokens, each acting as an
+ : <code>IDREF</code>. These tokens are then included in the list of
+ : candidate <code>IDREF</code>s. If any of the tokens is not a
+ : lexically valid <code>IDREF</code> (that is, if it is not lexically
+ : an <code>xs:NCName</code>), it is ignored. Formally, the candidate
+ : <code>IDREF</code> values are the strings in the sequence given by
+ : the expression:</p>
+ : <div class="exampleInner">
+ : <pre>
+ : for $s in $arg return 
+ :     fn:tokenize(fn:normalize-space($s), ' ')[. castable as xs:IDREF]
+ : </pre></div>
+ : </li>
+ : </ul>
+ : </li>
+ : <li>
+ : <p>If several elements have the same <code>ID</code> value, then
+ : <code>E</code> is the one that is first in document order.</p>
+ : </li>
+ : </ol>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>An error is raised [<span href="#ERRFODC0001" title="err:FODC0001">err:FODC0001</span>] if <code>$node</code>, or the
+ : context item if the second argument is absent, is a node in a tree
+ : whose root is not a document node.</p>
+ : <p>If the second argument is the context item, or is omitted, the
+ : following errors may be raised: if the context item is <span href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent";>absent</span><sup><small>DM30</small></sup>,
+ : [<span href="http://www.w3.org/TR/xpath20/#ERRXPDY0002"; title="err:XPDY0002">err:XPDY0002</span>]<sup><small>XP</small></sup>; if
+ : the context item is not a node [<span href="http://www.w3.org/TR/xpath20/#ERRXPTY0004"; title="err:XPTY0004">err:XPTY0004</span>]<sup><small>XP</small></sup>.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>The effect of this function is anomalous in respect of element
+ : nodes with the <code>is-id</code> property. For legacy reasons,
+ : this function returns the element that has the <code>is-id</code>
+ : property, whereas it would be more appropriate to return its
+ : parent, that being the element that is uniquely identified by the
+ : ID. A new function <code>element-with-id</code> is being introduced
+ : with the desired behavior.</p>
+ : <p>If the data model is constructed from an Infoset, an attribute
+ : will have the <code>is-id</code> property if the corresponding
+ : attribute in the Infoset had an attribute type of <code>ID</code>:
+ : typically this means the attribute was declared as an
+ : <code>ID</code> in a DTD.</p>
+ : <p>If the data model is constructed from a PSVI, an element or
+ : attribute will have the <code>is-id</code> property if its typed
+ : value is a single atomic value of type <code>xs:ID</code> or a type
+ : derived by restriction from <code>xs:ID</code>.</p>
+ : <p>No error is raised in respect of a candidate <code>IDREF</code>
+ : value that does not match the <code>ID</code> of any element in the
+ : document. If no candidate <code>IDREF</code> value matches the
+ : <code>ID</code> value of any element, the function returns the
+ : empty sequence.</p>
+ : <p>It is not necessary that the supplied argument should have type
+ : <code>xs:IDREF</code> or <code>xs:IDREFS</code>, or that it should
+ : be derived from a node with the <code>is-idrefs</code>
+ : property.</p>
+ : <p>An element may have more than one <code>ID</code> value. This
+ : can occur with synthetic data models or with data models
+ : constructed from a PSVI where the element and one of its attributes
+ : are both typed as <code>xs:ID</code>.</p>
+ : <p>If the source document is well-formed but not valid, it is
+ : possible for two or more elements to have the same <code>ID</code>
+ : value. In this situation, the function will select the first such
+ : element.</p>
+ : <p>It is also possible in a well-formed but invalid document to
+ : have an element or attribute that has the <code>is-id</code>
+ : property but whose value does not conform to the lexical rules for
+ : the <code>xs:ID</code> type. Such a node will never be selected by
+ : this function.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>let <code>$emp</code> :=</p>
+ : <div class="exampleInner">
+ : <pre>
+ :             &lt;employee xml:id="ID21256"&gt;
+ :                &lt;empnr&gt;E21256&lt;/empnr&gt;
+ :                &lt;first&gt;John&lt;/first&gt;
+ :                &lt;last&gt;Brown&lt;/last&gt;
+ :             &lt;/employee&gt;
+ :          
+ : </pre></div>
+ : <p>The expression <code>id('ID21256')/name()</code> returns
+ : <code>employee</code>. <em>(The <code>xml:id</code> attribute has
+ : the <code>is-id</code> property, so the employee element is
+ : selected.).</em></p>
+ : <p>The expression <code>id('E21256')/name()</code> returns
+ : <code>empnr</code>. <em>(Assuming the <code>empnr</code> element is
+ : given the type <code>xs:ID</code> as a result of schema validation,
+ : the element will have the <code>is-id</code> property and is
+ : therefore selected. Note the difference from the behavior of
+ : <span href="#func-element-with-id"><code>fn:element-with-id</code></span>.).</em></p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-id
+ :)
+declare function fn:id($arg as xs:string*,  $node as node()) as  element()* external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns the sequence of element or attribute nodes with an
+ : <code>IDREF</code> value matching the value of one or more of the
+ : <code>ID</code> values supplied in <code>$arg</code>.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:idref</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:string*</code>)<code class="as"> as </code><code class="return-type">node()*</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:idref</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:string*</code>, <code class="arg">$node</code><code class="as"> as </code><code class="type">node()</code>)<code class="as"> as </code><code class="return-type">node()*</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>The one-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-dependent"><span class="arrow">·</span>focus-dependent<span class="arrow">·</span></span>.</p>
+ : <p>The two-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The function returns a sequence, in document order with
+ : duplicates eliminated, containing every element or attribute node
+ : <code>$N</code> that satisfies all the following conditions:</p>
+ : <ol class="enumar">
+ : <li>
+ : <p><code>$N</code> is in the target document. The target document
+ : is the document containing <code>$node</code> or the document
+ : containing the context item (<code>.</code>) if the second argument
+ : is omitted. The behavior of the function if <code>$node</code> is
+ : omitted is exactly the same as if the context item had been passed
+ : as <code>$node</code>.</p>
+ : </li>
+ : <li>
+ : <p><code>$N</code> has an <code>IDREF</code> value equal to one of
+ : the candidate <code>ID</code> values, where:</p>
+ : <ul>
+ : <li>
+ : <p>A node <code>$N</code> has an <code>IDREF</code> value equal to
+ : <code>V</code> if both of the following conditions are true:</p>
+ : <ul>
+ : <li>
+ : <p>The <code>is-idrefs</code> property (see <span href="http://www.w3.org/TR/xpath-datamodel-30/#dm-is-idrefs";>Section 5.6
+ : is-idrefs Accessor</span> <sup><small>DM30</small></sup>) of
+ : <code>$N</code> is <code>true</code>.</p>
+ : </li>
+ : <li>
+ : <p>The sequence</p>
+ : <div class="exampleInner">
+ : <pre>
+ : fn:tokenize(fn:normalize-space(fn:string($N)), ' ')
+ : </pre></div>
+ : contains a string that is equal to <code>V</code> under the rules
+ : of the <code>eq</code> operator using the Unicode code point
+ : collation
+ : (<code>http://www.w3.org/2005/xpath-functions/collation/codepoint</code>).</li>
+ : </ul>
+ : </li>
+ : <li>
+ : <p>Each <code>xs:string</code> in <code>$arg</code> is parsed as if
+ : it were of lexically of type <code>xs:ID</code>. These
+ : <code>xs:string</code>s are then included in the list of candidate
+ : <code>xs:ID</code>s. If any of the strings in <code>$arg</code> is
+ : not a lexically valid <code>xs:ID</code> (that is, if it is not
+ : lexically an <code>xs:NCName</code>), it is ignored. More formally,
+ : the candidate <code>ID</code> values are the strings in the
+ : sequence:</p>
+ : <div class="exampleInner">
+ : <pre>
+ : $arg[. castable as xs:NCName]
+ : </pre></div>
+ : </li>
+ : </ul>
+ : </li>
+ : </ol>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>An error is raised [<span href="#ERRFODC0001" title="err:FODC0001">err:FODC0001</span>] if <code>$node</code>, or the
+ : context item if the second argument is omitted, is a node in a tree
+ : whose root is not a document node.</p>
+ : <p>If the second argument is the context item, or is omitted, the
+ : following errors may be raised: if the context item is <span href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent";>absent</span><sup><small>DM30</small></sup>
+ : [<span href="http://www.w3.org/TR/xpath20/#ERRXPDY0002"; title="err:XPDY0002">err:XPDY0002</span>]<sup><small>XP</small></sup>; if
+ : the context item is not a node [<span href="http://www.w3.org/TR/xpath20/#ERRXPTY0004"; title="err:XPTY0004">err:XPTY0004</span>]<sup><small>XP</small></sup>.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>An element or attribute typically acquires the
+ : <code>is-idrefs</code> property by being validated against the
+ : schema type <code>xs:IDREF</code> or <code>xs:IDREFS</code>, or
+ : (for attributes only) by being described as of type
+ : <code>IDREF</code> or <code>IDREFS</code> in a DTD.</p>
+ : <p>No error is raised in respect of a candidate <code>ID</code>
+ : value that does not match the <code>IDREF</code> value of any
+ : element or attribute in the document. If no candidate
+ : <code>ID</code> value matches the <code>IDREF</code> value of any
+ : element or attribute, the function returns the empty sequence.</p>
+ : <p>It is possible for two or more nodes to have an
+ : <code>IDREF</code> value that matches a given candidate
+ : <code>ID</code> value. In this situation, the function will return
+ : all such nodes. However, each matching node will be returned at
+ : most once, regardless how many candidate <code>ID</code> values it
+ : matches.</p>
+ : <p>It is possible in a well-formed but invalid document to have a
+ : node whose <code>is-idrefs</code> property is true but that does
+ : not conform to the lexical rules for the <code>xs:IDREF</code>
+ : type. The effect of the above rules is that ill-formed candidate
+ : <code>ID</code> values and ill-formed <code>IDREF</code> values are
+ : ignored.</p>
+ : <p>If the data model is constructed from a PSVI, the typed value of
+ : a node that has the <code>is-idrefs</code> property will contain at
+ : least one atomic value of type <code>xs:IDREF</code> (or a type
+ : derived by restriction from <code>xs:IDREF</code>). It may also
+ : contain atomic values of other types. These atomic values are
+ : treated as candidate <code>ID</code> values if their lexical form
+ : is valid as an <code>xs:NCName</code>, and they are ignored
+ : otherwise.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-idref
+ :)
+declare function fn:idref($arg as xs:string*) as  node()* external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns the sequence of element or attribute nodes with an
+ : <code>IDREF</code> value matching the value of one or more of the
+ : <code>ID</code> values supplied in <code>$arg</code>.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:idref</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:string*</code>)<code class="as"> as </code><code class="return-type">node()*</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:idref</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:string*</code>, <code class="arg">$node</code><code class="as"> as </code><code class="type">node()</code>)<code class="as"> as </code><code class="return-type">node()*</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>The one-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-dependent"><span class="arrow">·</span>focus-dependent<span class="arrow">·</span></span>.</p>
+ : <p>The two-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The function returns a sequence, in document order with
+ : duplicates eliminated, containing every element or attribute node
+ : <code>$N</code> that satisfies all the following conditions:</p>
+ : <ol class="enumar">
+ : <li>
+ : <p><code>$N</code> is in the target document. The target document
+ : is the document containing <code>$node</code> or the document
+ : containing the context item (<code>.</code>) if the second argument
+ : is omitted. The behavior of the function if <code>$node</code> is
+ : omitted is exactly the same as if the context item had been passed
+ : as <code>$node</code>.</p>
+ : </li>
+ : <li>
+ : <p><code>$N</code> has an <code>IDREF</code> value equal to one of
+ : the candidate <code>ID</code> values, where:</p>
+ : <ul>
+ : <li>
+ : <p>A node <code>$N</code> has an <code>IDREF</code> value equal to
+ : <code>V</code> if both of the following conditions are true:</p>
+ : <ul>
+ : <li>
+ : <p>The <code>is-idrefs</code> property (see <span href="http://www.w3.org/TR/xpath-datamodel-30/#dm-is-idrefs";>Section 5.6
+ : is-idrefs Accessor</span> <sup><small>DM30</small></sup>) of
+ : <code>$N</code> is <code>true</code>.</p>
+ : </li>
+ : <li>
+ : <p>The sequence</p>
+ : <div class="exampleInner">
+ : <pre>
+ : fn:tokenize(fn:normalize-space(fn:string($N)), ' ')
+ : </pre></div>
+ : contains a string that is equal to <code>V</code> under the rules
+ : of the <code>eq</code> operator using the Unicode code point
+ : collation
+ : (<code>http://www.w3.org/2005/xpath-functions/collation/codepoint</code>).</li>
+ : </ul>
+ : </li>
+ : <li>
+ : <p>Each <code>xs:string</code> in <code>$arg</code> is parsed as if
+ : it were of lexically of type <code>xs:ID</code>. These
+ : <code>xs:string</code>s are then included in the list of candidate
+ : <code>xs:ID</code>s. If any of the strings in <code>$arg</code> is
+ : not a lexically valid <code>xs:ID</code> (that is, if it is not
+ : lexically an <code>xs:NCName</code>), it is ignored. More formally,
+ : the candidate <code>ID</code> values are the strings in the
+ : sequence:</p>
+ : <div class="exampleInner">
+ : <pre>
+ : $arg[. castable as xs:NCName]
+ : </pre></div>
+ : </li>
+ : </ul>
+ : </li>
+ : </ol>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>An error is raised [<span href="#ERRFODC0001" title="err:FODC0001">err:FODC0001</span>] if <code>$node</code>, or the
+ : context item if the second argument is omitted, is a node in a tree
+ : whose root is not a document node.</p>
+ : <p>If the second argument is the context item, or is omitted, the
+ : following errors may be raised: if the context item is <span href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent";>absent</span><sup><small>DM30</small></sup>
+ : [<span href="http://www.w3.org/TR/xpath20/#ERRXPDY0002"; title="err:XPDY0002">err:XPDY0002</span>]<sup><small>XP</small></sup>; if
+ : the context item is not a node [<span href="http://www.w3.org/TR/xpath20/#ERRXPTY0004"; title="err:XPTY0004">err:XPTY0004</span>]<sup><small>XP</small></sup>.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>An element or attribute typically acquires the
+ : <code>is-idrefs</code> property by being validated against the
+ : schema type <code>xs:IDREF</code> or <code>xs:IDREFS</code>, or
+ : (for attributes only) by being described as of type
+ : <code>IDREF</code> or <code>IDREFS</code> in a DTD.</p>
+ : <p>No error is raised in respect of a candidate <code>ID</code>
+ : value that does not match the <code>IDREF</code> value of any
+ : element or attribute in the document. If no candidate
+ : <code>ID</code> value matches the <code>IDREF</code> value of any
+ : element or attribute, the function returns the empty sequence.</p>
+ : <p>It is possible for two or more nodes to have an
+ : <code>IDREF</code> value that matches a given candidate
+ : <code>ID</code> value. In this situation, the function will return
+ : all such nodes. However, each matching node will be returned at
+ : most once, regardless how many candidate <code>ID</code> values it
+ : matches.</p>
+ : <p>It is possible in a well-formed but invalid document to have a
+ : node whose <code>is-idrefs</code> property is true but that does
+ : not conform to the lexical rules for the <code>xs:IDREF</code>
+ : type. The effect of the above rules is that ill-formed candidate
+ : <code>ID</code> values and ill-formed <code>IDREF</code> values are
+ : ignored.</p>
+ : <p>If the data model is constructed from a PSVI, the typed value of
+ : a node that has the <code>is-idrefs</code> property will contain at
+ : least one atomic value of type <code>xs:IDREF</code> (or a type
+ : derived by restriction from <code>xs:IDREF</code>). It may also
+ : contain atomic values of other types. These atomic values are
+ : treated as candidate <code>ID</code> values if their lexical form
+ : is valid as an <code>xs:NCName</code>, and they are ignored
+ : otherwise.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-idref
+ :)
+declare function fn:idref($arg as xs:string*,  $node as node()) as  node()* external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns the prefixes of the in-scope namespaces for an element
+ : node.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:in-scope-prefixes</code>(<code class="arg">$element</code><code class="as"> as </code><code class="type">element()</code>)<code class="as"> as </code><code class="return-type">xs:string*</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The function returns a sequence of strings representing the
+ : prefixes of the in-scope namespaces for <code>$element</code>.</p>
+ : <p>For namespace bindings that have a prefix, the function returns
+ : the prefix as an <code>xs:NCName</code>. For the default namespace,
+ : which has no prefix, it returns the zero-length string.</p>
+ : <p>The result sequence contains no duplicates.</p>
+ : <p>The ordering of the result sequence is <span title="implementation dependent" class="termref" href="#implementation-dependent"><span class="arrow">·</span>implementation-dependent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-in-scope-prefixes
+ :)
+declare function fn:in-scope-prefixes($element as element()) as  xs:string* external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns a sequence of positive integers giving the positions
+ : within the sequence <code>$seq</code> of items that are equal to
+ : <code>$search</code>.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="2"><code class="function">fn:index-of</code>(</td>
+ : <td valign="baseline"><code class="arg">$seq</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:anyAtomicType*</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$search</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:anyAtomicType</code>)<code class="as"> as </code><code class="return-type">xs:integer*</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="3"><code class="function">fn:index-of</code>(</td>
+ : <td valign="baseline"><code class="arg">$seq</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:anyAtomicType*</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$search</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:anyAtomicType</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$collation</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:integer*</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.
+ : It depends on collations.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The function returns a sequence of positive integers giving the
+ : positions within the sequence <code>$seq</code> of items that are
+ : equal to <code>$search</code>.</p>
+ : <p>The collation used by this function is determined according to
+ : the rules in <span href="#choosing-a-collation"><b>5.3.3 Choosing a
+ : collation</b></span>. This collation is used when string comparison is
+ : required.</p>
+ : <p>The items in the sequence <code>$seq</code> are compared with
+ : <code>$search</code> under the rules for the <code>eq</code>
+ : operator. Values of type <code>xs:untypedAtomic</code> are compared
+ : as if they were of type <code>xs:string</code>. Values that cannot
+ : be compared, because the <code>eq</code> operator is not defined
+ : for their types, are considered to be distinct. If an item compares
+ : equal, then the position of that item in the sequence
+ : <code>$seq</code> is included in the result.</p>
+ : <p>The first item in a sequence is at position 1, not position
+ : 0.</p>
+ : <p>The result sequence is in ascending numeric order.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>If the value of <code>$seq</code> is the empty sequence, or if
+ : no item in <code>$seq</code> matches <code>$search</code>, then the
+ : function returns the empty sequence.</p>
+ : <p>No error occurs if non-comparable values are encountered. So
+ : when comparing two atomic values, the effective boolean value of
+ : <code>fn:index-of($a, $b)</code> is true if <code>$a</code> and
+ : <code>$b</code> are equal, false if they are not equal or not
+ : comparable.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:index-of((10, 20, 30, 40), 35)</code>
+ : returns <code>()</code>.</p>
+ : <p>The expression <code>fn:index-of((10, 20, 30, 30, 20, 10),
+ : 20)</code> returns <code>(2, 5)</code>.</p>
+ : <p>The expression <code>fn:index-of(("a", "sport", "and", "a",
+ : "pastime"), "a")</code> returns <code>(1, 4)</code>.</p>
+ : <p>The expression <code>fn:index-of(current-date(), 23)</code>
+ : returns <code>()</code>.</p>
+ : <p>If <code>@a</code> is an attribute of type
+ : <code>xs:NMTOKENS</code> whose string value is <code>"red green
+ : blue"</code>, and whose typed value is therefore <code>("red",
+ : "green", "blue")</code>, then <code>fn:index-of(@a, "blue")</code>
+ : returns <code>3</code>. This is because the function calling
+ : mechanism atomizes the attribute node to produce a sequence of
+ : three <code>xs:NMTOKEN</code> values.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-index-of
+ :)
+declare function fn:index-of( $seq as xs:anyAtomicType*,  $search as xs:anyAtomicType) as  xs:integer* external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns a sequence of positive integers giving the positions
+ : within the sequence <code>$seq</code> of items that are equal to
+ : <code>$search</code>.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="2"><code class="function">fn:index-of</code>(</td>
+ : <td valign="baseline"><code class="arg">$seq</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:anyAtomicType*</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$search</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:anyAtomicType</code>)<code class="as"> as </code><code class="return-type">xs:integer*</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="3"><code class="function">fn:index-of</code>(</td>
+ : <td valign="baseline"><code class="arg">$seq</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:anyAtomicType*</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$search</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:anyAtomicType</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$collation</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:integer*</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.
+ : It depends on collations.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The function returns a sequence of positive integers giving the
+ : positions within the sequence <code>$seq</code> of items that are
+ : equal to <code>$search</code>.</p>
+ : <p>The collation used by this function is determined according to
+ : the rules in <span href="#choosing-a-collation"><b>5.3.3 Choosing a
+ : collation</b></span>. This collation is used when string comparison is
+ : required.</p>
+ : <p>The items in the sequence <code>$seq</code> are compared with
+ : <code>$search</code> under the rules for the <code>eq</code>
+ : operator. Values of type <code>xs:untypedAtomic</code> are compared
+ : as if they were of type <code>xs:string</code>. Values that cannot
+ : be compared, because the <code>eq</code> operator is not defined
+ : for their types, are considered to be distinct. If an item compares
+ : equal, then the position of that item in the sequence
+ : <code>$seq</code> is included in the result.</p>
+ : <p>The first item in a sequence is at position 1, not position
+ : 0.</p>
+ : <p>The result sequence is in ascending numeric order.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>If the value of <code>$seq</code> is the empty sequence, or if
+ : no item in <code>$seq</code> matches <code>$search</code>, then the
+ : function returns the empty sequence.</p>
+ : <p>No error occurs if non-comparable values are encountered. So
+ : when comparing two atomic values, the effective boolean value of
+ : <code>fn:index-of($a, $b)</code> is true if <code>$a</code> and
+ : <code>$b</code> are equal, false if they are not equal or not
+ : comparable.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:index-of((10, 20, 30, 40), 35)</code>
+ : returns <code>()</code>.</p>
+ : <p>The expression <code>fn:index-of((10, 20, 30, 30, 20, 10),
+ : 20)</code> returns <code>(2, 5)</code>.</p>
+ : <p>The expression <code>fn:index-of(("a", "sport", "and", "a",
+ : "pastime"), "a")</code> returns <code>(1, 4)</code>.</p>
+ : <p>The expression <code>fn:index-of(current-date(), 23)</code>
+ : returns <code>()</code>.</p>
+ : <p>If <code>@a</code> is an attribute of type
+ : <code>xs:NMTOKENS</code> whose string value is <code>"red green
+ : blue"</code>, and whose typed value is therefore <code>("red",
+ : "green", "blue")</code>, then <code>fn:index-of(@a, "blue")</code>
+ : returns <code>3</code>. This is because the function calling
+ : mechanism atomizes the attribute node to produce a sequence of
+ : three <code>xs:NMTOKEN</code> values.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-index-of
+ :)
+declare function fn:index-of( $seq as xs:anyAtomicType*,  $search as xs:anyAtomicType,  $collation as xs:string) as  xs:integer* external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns a sequence constructed by inserting an item or a
+ : sequence of items at a given position within an existing
+ : sequence.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="3"><code class="function">fn:insert-before</code>(</td>
+ : <td valign="baseline"><code class="arg">$target</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">item()*</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$position</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:integer</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$inserts</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">item()*</code>)<code class="as"> as </code><code class="return-type">item()*</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The value returned by the function consists of all items of
+ : <code>$target</code> whose index is less than
+ : <code>$position</code>, followed by all items of
+ : <code>$inserts</code>, followed by the remaining elements of
+ : <code>$target</code>, in that order.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>If <code>$target</code> is the empty sequence,
+ : <code>$inserts</code> is returned. If <code>$inserts</code> is the
+ : empty sequence, <code>$target</code> is returned.</p>
+ : <p>If <code>$position</code> is less than one (1), the first
+ : position, the effective value of <code>$position</code> is one (1).
+ : If <code>$position</code> is greater than the number of items in
+ : <code>$target</code>, then the effective value of
+ : <code>$position</code> is equal to the number of items in
+ : <code>$target</code> plus 1.</p>
+ : <p>The value of <code>$target</code> is not affected by the
+ : sequence construction.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>let <code>$abc</code> := <code>("a", "b", "c")</code></p>
+ : <p>The expression <code>fn:insert-before($abc, 0, "z")</code>
+ : returns <code>("z", "a", "b", "c")</code>.</p>
+ : <p>The expression <code>fn:insert-before($abc, 1, "z")</code>
+ : returns <code>("z", "a", "b", "c")</code>.</p>
+ : <p>The expression <code>fn:insert-before($abc, 2, "z")</code>
+ : returns <code>("a", "z", "b", "c")</code>.</p>
+ : <p>The expression <code>fn:insert-before($abc, 3, "z")</code>
+ : returns <code>("a", "b", "z", "c")</code>.</p>
+ : <p>The expression <code>fn:insert-before($abc, 4, "z")</code>
+ : returns <code>("a", "b", "c", "z")</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-insert-before
+ :)
+declare function fn:insert-before( $target as item()*,  $position as xs:integer,  $inserts as item()*) as  item()* external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns the local part of the supplied QName.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:local-name-from-QName</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:QName?</code>)<code class="as"> as </code><code class="return-type">xs:NCName?</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If <code>$arg</code> is the empty sequence the function returns
+ : the empty sequence.</p>
+ : <p>Otherwise, the function returns an <code>xs:NCName</code>
+ : representing the local part of <code>$arg</code>.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression
+ : <code>fn:local-name-from-QName(fn:QName("http://www.example.com/example";,
+ : "person"))</code> returns <code>"person"</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-local-name-from-QName
+ :)
+declare function fn:local-name-from-QName($arg as xs:QName?) as  xs:NCName? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Converts a string to lower case.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:lower-case</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:string?</code>)<code class="as"> as </code><code class="return-type">xs:string</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If the value of <code>$arg</code> is the empty sequence, the
+ : zero-length string is returned.</p>
+ : <p>Otherwise, the function returns the value of <code>$arg</code>
+ : after translating every <span title="character" class="termref" href="#character"><span class="arrow">·</span>character<span class="arrow">·</span></span> to its lower-case correspondent as defined in
+ : the appropriate case mappings section in the Unicode standard
+ : <span href="#Unicode">[The Unicode Standard]</span>. For versions of
+ : Unicode beginning with the 2.1.8 update, only locale-insensitive
+ : case mappings should be applied. Beginning with version 3.2.0 (and
+ : likely future versions) of Unicode, precise mappings are described
+ : in default case operations, which are full case mappings in the
+ : absence of tailoring for particular languages and environments.
+ : Every upper-case character that does not have a lower-case
+ : correspondent, as well as every lower-case character, is included
+ : in the returned value in its original form.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>Case mappings may change the length of a string. In general, the
+ : <span href="#func-upper-case"><code>fn:upper-case</code></span> and
+ : <code>fn:lower-case</code> functions are not inverses of each
+ : other: <code>fn:lower-case(fn:upper-case($arg))</code> is not
+ : guaranteed to return <code>$arg</code>, nor is <span href="#func-upper-case"><code>fn:upper-case(fn:lower-case($arg))</code></span>.
+ : The Latin small letter dotless i (as used in Turkish) is perhaps
+ : the most prominent lower-case letter which will not round-trip. The
+ : Latin capital letter i with dot above is the most prominent
+ : upper-case letter which will not round trip; there are others, such
+ : as Latin capital letter Sharp S (#1E9E) which is introduced in
+ : Unicode 5.1.</p>
+ : <p>These functions may not always be linguistically appropriate
+ : (e.g. Turkish i without dot) or appropriate for the application
+ : (e.g. titlecase). In cases such as Turkish, a simple translation
+ : should be used first.</p>
+ : <p>Because the function is not sensitive to locale, results will
+ : not always match user expectations. In Quebec, for example, the
+ : standard uppercase equivalent of "è" is "È", while in metropolitan
+ : France it is more commonly "E"; only one of these is supported by
+ : the functions as defined.</p>
+ : <p>Many characters of class Ll lack uppercase equivalents in the
+ : Unicode case mapping tables; many characters of class Lu lack
+ : lowercase equivalents.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:lower-case("ABc!D")</code> returns
+ : <code>"abc!d"</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-lower-case
+ :)
+declare function fn:lower-case($arg as xs:string?) as  xs:string external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Applies the function item <var>$f</var> to every item from the
+ : sequence <var>$seq</var> in turn, returning the concatenation of
+ : the resulting sequences in order.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:map</code>(<code class="arg">$f</code><code class="as"> as </code><code class="type">function(item()) as
+ : item()*</code>, <code class="arg">$seq</code><code class="as"> as </code><code class="type">item()*</code>)<code class="as"> as </code><code class="return-type">item()*</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The effect of the function is equivalent to the following
+ : implementation in XQuery:</p>
+ : <div class="exampleInner">
+ : <pre>
+ : declare function fn:map($f, $seq) {
+ :   if (fn:empty($seq))
+ :   then ()
+ :   else $f(fn:head($seq)), fn:map($f, fn:tail($seq))
+ : };
+ : </pre></div>
+ : <p>or its equivalent in XSLT:</p>
+ : <div class="exampleInner">
+ : <pre>
+ : &lt;xsl:function name="fn:map"&gt;
+ :   &lt;xsl:param name="f"/&gt;
+ :   &lt;xsl:param name="seq/&gt;
+ :   &lt;xsl:if test="fn:exists($seq)"&gt;
+ :     &lt;xsl:sequence select="$f(fn:head($seq)), fn:map($f, fn:tail($seq))"/&gt;
+ :   &lt;/xsl:if&gt;
+ : &lt;/xsl:function&gt;
+ :          
+ : </pre></div>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>The function call <code>fn:map($F, $SEQ)</code> is equivalent to
+ : the expression <code>for $i in $SEQ return $F($i)</code><span>,
+ : assuming that ordering mode is <code>ordered</code>.</span></p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:map(function($a) { $a * $a }, 1 to
+ : 5)</code> returns <code>(1, 4, 9, 16, 25)</code>.</p>
+ : <p>The expression <code>fn:map(fn:string-to-codepoints#1, ("john",
+ : "jane"))</code> returns <code>(106, 111, 104, 110, 106, 97, 110,
+ : 101)</code>.</p>
+ : <p>The expression <code>fn:map(xs:int#1, ("23", "29"))</code>
+ : returns <code>(23, 29)</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-map
+ :)
+declare function fn:map($f as function(item()) as item()*,  $seq as item()*) as  item()* external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Applies the function item <var>$f</var> to successive pairs of
+ : items taken one from <var>$seq1</var> and one from
+ : <var>$seq2</var>, returning the concatenation of the resulting
+ : sequences in order.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="3"><code class="function">fn:map-pairs</code>(</td>
+ : <td valign="baseline"><code class="arg">$f</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">function(item(), item()) as item()*</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$seq1</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">item()*</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$seq2</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">item()*</code>)<code class="as"> as </code><code class="return-type">item()*</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The effect of the function is equivalent to the following
+ : implementation in XQuery:</p>
+ : <div class="exampleInner">
+ : <pre>
+ : declare function fn:map-pairs($f, $seq1, $seq2)
+ : {
+ :    if(fn:exists($seq1) and fn:exists($seq2)) 
+ :    then (
+ :      $f(fn:head($seq1), fn:head($seq2)),
+ :      fn:map-pairs($f, fn:tail($seq1), fn:tail($seq2))
+ :    )
+ :    else ()
+ : };
+ : </pre></div>
+ : <p>or its equivalent in XSLT:</p>
+ : <div class="exampleInner">
+ : <pre>
+ : &lt;xsl:function name="fn:map-pairs"&gt;
+ :   &lt;xsl:param name="f"/&gt;
+ :   &lt;xsl:param name="seq1/&gt;
+ :   &lt;xsl:param name="seq2/&gt;
+ :   &lt;xsl:if test="fn:exists($seq1) and fn:exists($seq2"&gt;
+ :     &lt;xsl:sequence select="$f(fn:head($seq1), fn:head($seq2))"/&gt;
+ :     &lt;xsl:sequence select="fn:map-pairs($f, fn:tail($seq1), fn:tail($seq2))"/&gt;
+ :   &lt;/xsl:if&gt;
+ : &lt;/xsl:function&gt;
+ :          
+ : </pre></div>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:map-pairs(concat#2, ("a", "b", "c"),
+ : ("x", "y", "z"))</code> returns <code>("ax", "by",
+ : "cz")</code>.</p>
+ : <p>The expression <code>fn:map-pairs(function($a, $b){10*$a + $b},
+ : 1 to 5, 1 to 5)</code> returns <code>(11, 22, 33, 44,
+ : 55)</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-map-pairs
+ :)
+declare function fn:map-pairs( $f as function(item(), item()) as item()*,  $seq1 as item()*,  $seq2 as item()*) as  item()* external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns true if the supplied string matches a given regular
+ : expression.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:matches</code>(<code class="arg">$input</code><code class="as"> as </code><code class="type">xs:string?</code>, <code class="arg">$pattern</code><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:boolean</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="3"><code class="function">fn:matches</code>(</td>
+ : <td valign="baseline"><code class="arg">$input</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$pattern</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$flags</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:boolean</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The effect of calling the first version of this function
+ : (omitting the argument <code>$flags</code>) is the same as the
+ : effect of calling the second version with the <code>$flags</code>
+ : argument set to a zero-length string. Flags are defined in <span href="#flags"><b>5.6.1.1 Flags</b></span>.</p>
+ : <p>If <code>$input</code> is the empty sequence, it is interpreted
+ : as the zero-length string.</p>
+ : <p>The function returns <code>true</code> if <code>$input</code> or
+ : some substring of <code>$input</code> matches the regular
+ : expression supplied as <code>$pattern</code>. Otherwise, the
+ : function returns <code>false</code>. The matching rules are
+ : influenced by the value of <code>$flags</code> if present.</p>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>An error is raised [<span href="#ERRFORX0002" title="err:FORX0002">err:FORX0002</span>] if the value of
+ : <code>$pattern</code> is invalid according to the rules described
+ : in <span href="#regex-syntax"><b>5.6.1 Regular expression
+ : syntax</b></span>.</p>
+ : <p>An error is raised [<span href="#ERRFORX0001" title="err:FORX0001">err:FORX0001</span>] if the value of
+ : <code>$flags</code> is invalid according to the rules described in
+ : <span href="#flags"><b>5.6.1.1 Flags</b></span>.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>Unless the metacharacters <code>^</code> and <code>$</code> 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).</p>
+ : <p>This is different from the behavior of patterns in <span href="#xmlschema-2">[XML Schema Part 2: Datatypes Second Edition]</span>,
+ : where regular expressions are <em>implicitly</em> anchored.</p>
+ : <p>Regular expression matching is defined on the basis of Unicode
+ : code points; it takes no account of collations.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:matches("abracadabra", "bra")</code>
+ : returns <code>true()</code>.</p>
+ : <p>The expression <code>fn:matches("abracadabra", "^a.*a$")</code>
+ : returns <code>true()</code>.</p>
+ : <p>The expression <code>fn:matches("abracadabra", "^bra")</code>
+ : returns <code>false()</code>.</p>
+ : <p>Given the source document:</p>
+ : <p>let <code>$poem</code> :=</p>
+ : <div class="exampleInner">
+ : <pre>
+ : &lt;poem author="Wilhelm Busch"&gt; 
+ : Kaum hat dies der Hahn gesehen, 
+ : Fängt er auch schon an zu krähen: 
+ : Kikeriki! Kikikerikih!! 
+ : Tak, tak, tak! - da kommen sie. 
+ : &lt;/poem&gt;
+ : </pre></div>
+ : <p>the following function calls produce the following results, with
+ : the <code>poem</code> element as the context node:</p>
+ : <p>The expression <code>fn:matches($poem, "Kaum.*krähen")</code>
+ : returns <code>false()</code>.</p>
+ : <p>The expression <code>fn:matches($poem, "Kaum.*krähen",
+ : "s")</code> returns <code>true()</code>.</p>
+ : <p>The expression <code>fn:matches($poem, "^Kaum.*gesehen,$",
+ : "m")</code> returns <code>true()</code>.</p>
+ : <p>The expression <code>fn:matches($poem,
+ : "^Kaum.*gesehen,$")</code> returns <code>false()</code>.</p>
+ : <p>The expression <code>fn:matches($poem, "kiki", "i")</code>
+ : returns <code>true()</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-matches
+ :)
+declare function fn:matches($input as xs:string?,  $pattern as xs:string) as  xs:boolean external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns true if the supplied string matches a given regular
+ : expression.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:matches</code>(<code class="arg">$input</code><code class="as"> as </code><code class="type">xs:string?</code>, <code class="arg">$pattern</code><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:boolean</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="3"><code class="function">fn:matches</code>(</td>
+ : <td valign="baseline"><code class="arg">$input</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$pattern</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$flags</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:boolean</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The effect of calling the first version of this function
+ : (omitting the argument <code>$flags</code>) is the same as the
+ : effect of calling the second version with the <code>$flags</code>
+ : argument set to a zero-length string. Flags are defined in <span href="#flags"><b>5.6.1.1 Flags</b></span>.</p>
+ : <p>If <code>$input</code> is the empty sequence, it is interpreted
+ : as the zero-length string.</p>
+ : <p>The function returns <code>true</code> if <code>$input</code> or
+ : some substring of <code>$input</code> matches the regular
+ : expression supplied as <code>$pattern</code>. Otherwise, the
+ : function returns <code>false</code>. The matching rules are
+ : influenced by the value of <code>$flags</code> if present.</p>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>An error is raised [<span href="#ERRFORX0002" title="err:FORX0002">err:FORX0002</span>] if the value of
+ : <code>$pattern</code> is invalid according to the rules described
+ : in <span href="#regex-syntax"><b>5.6.1 Regular expression
+ : syntax</b></span>.</p>
+ : <p>An error is raised [<span href="#ERRFORX0001" title="err:FORX0001">err:FORX0001</span>] if the value of
+ : <code>$flags</code> is invalid according to the rules described in
+ : <span href="#flags"><b>5.6.1.1 Flags</b></span>.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>Unless the metacharacters <code>^</code> and <code>$</code> 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).</p>
+ : <p>This is different from the behavior of patterns in <span href="#xmlschema-2">[XML Schema Part 2: Datatypes Second Edition]</span>,
+ : where regular expressions are <em>implicitly</em> anchored.</p>
+ : <p>Regular expression matching is defined on the basis of Unicode
+ : code points; it takes no account of collations.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:matches("abracadabra", "bra")</code>
+ : returns <code>true()</code>.</p>
+ : <p>The expression <code>fn:matches("abracadabra", "^a.*a$")</code>
+ : returns <code>true()</code>.</p>
+ : <p>The expression <code>fn:matches("abracadabra", "^bra")</code>
+ : returns <code>false()</code>.</p>
+ : <p>Given the source document:</p>
+ : <p>let <code>$poem</code> :=</p>
+ : <div class="exampleInner">
+ : <pre>
+ : &lt;poem author="Wilhelm Busch"&gt; 
+ : Kaum hat dies der Hahn gesehen, 
+ : Fängt er auch schon an zu krähen: 
+ : Kikeriki! Kikikerikih!! 
+ : Tak, tak, tak! - da kommen sie. 
+ : &lt;/poem&gt;
+ : </pre></div>
+ : <p>the following function calls produce the following results, with
+ : the <code>poem</code> element as the context node:</p>
+ : <p>The expression <code>fn:matches($poem, "Kaum.*krähen")</code>
+ : returns <code>false()</code>.</p>
+ : <p>The expression <code>fn:matches($poem, "Kaum.*krähen",
+ : "s")</code> returns <code>true()</code>.</p>
+ : <p>The expression <code>fn:matches($poem, "^Kaum.*gesehen,$",
+ : "m")</code> returns <code>true()</code>.</p>
+ : <p>The expression <code>fn:matches($poem,
+ : "^Kaum.*gesehen,$")</code> returns <code>false()</code>.</p>
+ : <p>The expression <code>fn:matches($poem, "kiki", "i")</code>
+ : returns <code>true()</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-matches
+ :)
+declare function fn:matches( $input as xs:string?,  $pattern as xs:string,  $flags as xs:string) as  xs:boolean external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns a value that is equal to the highest value appearing in
+ : the input sequence.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:max</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:anyAtomicType*</code>)<code class="as"> as </code><code class="return-type">xs:anyAtomicType?</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:max</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:anyAtomicType*</code>,
+ : <code class="arg">$collation</code><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:anyAtomicType?</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.
+ : It depends on collations.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The following rules are applied to the input sequence
+ : <code>$arg</code>:</p>
+ : <ul>
+ : <li>
+ : <p>Values of type <code>xs:untypedAtomic</code> in
+ : <code>$arg</code> are cast to <code>xs:double</code>.</p>
+ : </li>
+ : <li>
+ : <p>Numeric and <code>xs:anyURI</code> values are converted to the
+ : least common type reachable by a combination of type promotion and
+ : subtype substitution. See <span href="http://www.w3.org/TR/xpath-30/#promotion";>Section B.1 Type
+ : Promotion</span> <sup><small>XP30</small></sup> and <span href="http://www.w3.org/TR/xpath-30/#mapping";>Section B.2 Operator
+ : Mapping</span> <sup><small>XP30</small></sup>.</p>
+ : </li>
+ : </ul>
+ : <p>The items in the resulting sequence may be reordered in an
+ : arbitrary order. The resulting sequence is referred to below as the
+ : converted sequence. The function returns an item from the converted
+ : sequence rather than the input sequence.</p>
+ : <p>If the converted sequence is empty, the function returns the
+ : empty sequence.</p>
+ : <p>All items in the <span>converted sequence must be derived</span>
+ : from a single base type for which the <code>le</code> operator is
+ : defined. In addition, the values in the sequence must have a total
+ : order. If date/time values do not have a timezone, they are
+ : considered to have the implicit timezone provided by the dynamic
+ : context for the purpose of comparison. Duration values must either
+ : all be <code>xs:yearMonthDuration</code> values or must all be
+ : <code>xs:dayTimeDuration</code> values.</p>
+ : <p>If the converted sequence contains the value <code>NaN</code>,
+ : the value <code>NaN</code> is returned.</p>
+ : <p>If the items in the <span>converted sequence</span> are of type
+ : <code>xs:string</code> or types derived by restriction from
+ : <code>xs:string</code>, then the determination of the item with the
+ : smallest value is made according to the collation that is used. If
+ : the type of the items in the <span>converted sequence</span> is not
+ : <code>xs:string</code> and <code>$collation</code> is specified,
+ : the collation is ignored.</p>
+ : <p>The collation used by this function is determined according to
+ : the rules in <span href="#choosing-a-collation"><b>5.3.3 Choosing a
+ : collation</b></span>.</p>
+ : <p>The function returns the result of the expression:</p>
+ : <div class="exampleInner">
+ : <pre>
+ :    if (every $v in $c satisfies $c[1] ge $v)
+ :    then $c[1] 
+ :    else fn:max(fn:subsequence($c, 2))
+ : </pre></div>
+ : <p>evaluated with <code>$collation</code> as the default collation
+ : if specified, and with <code>$c</code> as the converted
+ : sequence.</p>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>A type error is raised [<span href="#ERRFORG0006" title="err:FORG0006">err:FORG0006</span>] if the input sequence contains
+ : items of incompatible types, as described above.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>Because the rules allow the sequence to be reordered, if there
+ : are two or items that are "equal highest", the specific item whose
+ : value is returned is <span title="implementation dependent" class="termref" href="#implementation-dependent"><span class="arrow">·</span>implementation dependent<span class="arrow">·</span></span>. This can arise for example if two different
+ : strings compare equal under the selected collation, or if two
+ : different <code>xs:dateTime</code> values compare equal despite
+ : being in different timezones.</p>
+ : <p>If the converted sequence contains exactly one value then that
+ : value is returned.</p>
+ : <p>The default type when the <code>fn:max</code> function is
+ : applied to <code>xs:untypedAtomic</code> values is
+ : <code>xs:double</code>. This differs from the default type for
+ : operators such as <code>gt</code>, and for sorting in XQuery and
+ : XSLT, which is <code>xs:string</code>.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:max((3,4,5))</code> returns
+ : <code>5</code>.</p>
+ : <p>The expression <code>fn:max((xs:integer(5), xs:float(5.0),
+ : xs:double(0)))</code> returns <code>xs:double(5.0e0)</code>.</p>
+ : <p><code>fn:max((3,4,"Zero"))</code> raises a type error [<span href="#ERRFORG0006" title="err:FORG0006">err:FORG0006</span>].</p>
+ : <p>The expression <code>fn:max((fn:current-date(),
+ : xs:date("2100-01-01")))</code> returns
+ : <code>xs:date("2100-01-01")</code>. <em>(Assuming that the current
+ : date is during the 21st century.).</em></p>
+ : <p>The expression <code>fn:max(("a", "b", "c"))</code> returns
+ : <code>"c"</code>. <em>(Assuming a typical default
+ : collation.).</em></p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-max
+ :)
+declare function fn:max($arg as xs:anyAtomicType*) as  xs:anyAtomicType? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns a value that is equal to the highest value appearing in
+ : the input sequence.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:max</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:anyAtomicType*</code>)<code class="as"> as </code><code class="return-type">xs:anyAtomicType?</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:max</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:anyAtomicType*</code>,
+ : <code class="arg">$collation</code><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:anyAtomicType?</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.
+ : It depends on collations.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The following rules are applied to the input sequence
+ : <code>$arg</code>:</p>
+ : <ul>
+ : <li>
+ : <p>Values of type <code>xs:untypedAtomic</code> in
+ : <code>$arg</code> are cast to <code>xs:double</code>.</p>
+ : </li>
+ : <li>
+ : <p>Numeric and <code>xs:anyURI</code> values are converted to the
+ : least common type reachable by a combination of type promotion and
+ : subtype substitution. See <span href="http://www.w3.org/TR/xpath-30/#promotion";>Section B.1 Type
+ : Promotion</span> <sup><small>XP30</small></sup> and <span href="http://www.w3.org/TR/xpath-30/#mapping";>Section B.2 Operator
+ : Mapping</span> <sup><small>XP30</small></sup>.</p>
+ : </li>
+ : </ul>
+ : <p>The items in the resulting sequence may be reordered in an
+ : arbitrary order. The resulting sequence is referred to below as the
+ : converted sequence. The function returns an item from the converted
+ : sequence rather than the input sequence.</p>
+ : <p>If the converted sequence is empty, the function returns the
+ : empty sequence.</p>
+ : <p>All items in the <span>converted sequence must be derived</span>
+ : from a single base type for which the <code>le</code> operator is
+ : defined. In addition, the values in the sequence must have a total
+ : order. If date/time values do not have a timezone, they are
+ : considered to have the implicit timezone provided by the dynamic
+ : context for the purpose of comparison. Duration values must either
+ : all be <code>xs:yearMonthDuration</code> values or must all be
+ : <code>xs:dayTimeDuration</code> values.</p>
+ : <p>If the converted sequence contains the value <code>NaN</code>,
+ : the value <code>NaN</code> is returned.</p>
+ : <p>If the items in the <span>converted sequence</span> are of type
+ : <code>xs:string</code> or types derived by restriction from
+ : <code>xs:string</code>, then the determination of the item with the
+ : smallest value is made according to the collation that is used. If
+ : the type of the items in the <span>converted sequence</span> is not
+ : <code>xs:string</code> and <code>$collation</code> is specified,
+ : the collation is ignored.</p>
+ : <p>The collation used by this function is determined according to
+ : the rules in <span href="#choosing-a-collation"><b>5.3.3 Choosing a
+ : collation</b></span>.</p>
+ : <p>The function returns the result of the expression:</p>
+ : <div class="exampleInner">
+ : <pre>
+ :    if (every $v in $c satisfies $c[1] ge $v)
+ :    then $c[1] 
+ :    else fn:max(fn:subsequence($c, 2))
+ : </pre></div>
+ : <p>evaluated with <code>$collation</code> as the default collation
+ : if specified, and with <code>$c</code> as the converted
+ : sequence.</p>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>A type error is raised [<span href="#ERRFORG0006" title="err:FORG0006">err:FORG0006</span>] if the input sequence contains
+ : items of incompatible types, as described above.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>Because the rules allow the sequence to be reordered, if there
+ : are two or items that are "equal highest", the specific item whose
+ : value is returned is <span title="implementation dependent" class="termref" href="#implementation-dependent"><span class="arrow">·</span>implementation dependent<span class="arrow">·</span></span>. This can arise for example if two different
+ : strings compare equal under the selected collation, or if two
+ : different <code>xs:dateTime</code> values compare equal despite
+ : being in different timezones.</p>
+ : <p>If the converted sequence contains exactly one value then that
+ : value is returned.</p>
+ : <p>The default type when the <code>fn:max</code> function is
+ : applied to <code>xs:untypedAtomic</code> values is
+ : <code>xs:double</code>. This differs from the default type for
+ : operators such as <code>gt</code>, and for sorting in XQuery and
+ : XSLT, which is <code>xs:string</code>.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:max((3,4,5))</code> returns
+ : <code>5</code>.</p>
+ : <p>The expression <code>fn:max((xs:integer(5), xs:float(5.0),
+ : xs:double(0)))</code> returns <code>xs:double(5.0e0)</code>.</p>
+ : <p><code>fn:max((3,4,"Zero"))</code> raises a type error [<span href="#ERRFORG0006" title="err:FORG0006">err:FORG0006</span>].</p>
+ : <p>The expression <code>fn:max((fn:current-date(),
+ : xs:date("2100-01-01")))</code> returns
+ : <code>xs:date("2100-01-01")</code>. <em>(Assuming that the current
+ : date is during the 21st century.).</em></p>
+ : <p>The expression <code>fn:max(("a", "b", "c"))</code> returns
+ : <code>"c"</code>. <em>(Assuming a typical default
+ : collation.).</em></p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-max
+ :)
+declare function fn:max($arg as xs:anyAtomicType*,  $collation as xs:string) as  xs:anyAtomicType? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns a value that is equal to the lowest value appearing in
+ : the input sequence.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:min</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:anyAtomicType*</code>)<code class="as"> as </code><code class="return-type">xs:anyAtomicType?</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:min</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:anyAtomicType*</code>,
+ : <code class="arg">$collation</code><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:anyAtomicType?</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.
+ : It depends on collations.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The following rules are applied to the input sequence:</p>
+ : <ul>
+ : <li>
+ : <p>Values of type <code>xs:untypedAtomic</code> in
+ : <code>$arg</code> are cast to <code>xs:double</code>.</p>
+ : </li>
+ : <li>
+ : <p>Numeric and <code>xs:anyURI</code> values are converted to the
+ : least common type reachable by a combination of type promotion and
+ : subtype substitution. See <span href="http://www.w3.org/TR/xpath-30/#promotion";>Section B.1 Type
+ : Promotion</span> <sup><small>XP30</small></sup> and <span href="http://www.w3.org/TR/xpath-30/#mapping";>Section B.2 Operator
+ : Mapping</span> <sup><small>XP30</small></sup>.</p>
+ : </li>
+ : </ul>
+ : <p>The items in the resulting sequence may be reordered in an
+ : arbitrary order. The resulting sequence is referred to below as the
+ : converted sequence. The function returns an item from the converted
+ : sequence rather than the input sequence.</p>
+ : <p>If the converted sequence is empty, the empty sequence is
+ : returned.</p>
+ : <p>All items in the <span>converted sequence must be derived</span>
+ : from a single base type for which the <code>le</code> operator is
+ : defined. In addition, the values in the sequence must have a total
+ : order. If date/time values do not have a timezone, they are
+ : considered to have the implicit timezone provided by the dynamic
+ : context for the purpose of comparison. Duration values must either
+ : all be <code>xs:yearMonthDuration</code> values or must all be
+ : <code>xs:dayTimeDuration</code> values.</p>
+ : <p>If the converted sequence contains the value <code>NaN</code>,
+ : the value <code>NaN</code> is returned.</p>
+ : <p>If the items in the <span>converted sequence</span> are of type
+ : <code>xs:string</code> or types derived by restriction from
+ : <code>xs:string</code>, then the determination of the item with the
+ : smallest value is made according to the collation that is used. If
+ : the type of the items in the <span>converted sequence</span> is not
+ : <code>xs:string</code> and <code>$collation</code> is specified,
+ : the collation is ignored.</p>
+ : <p>The collation used by this function is determined according to
+ : the rules in <span href="#choosing-a-collation"><b>5.3.3 Choosing a
+ : collation</b></span>.</p>
+ : <p>The function returns the result of the expression:</p>
+ : <div class="exampleInner">
+ : <pre>
+ :    if (every $v in $c satisfies $c[1] le $v) 
+ :    then $c[1] 
+ :    else fn:min(fn:subsequence($c, 2))
+ : </pre></div>
+ : <p>evaluated with <code>$collation</code> as the default collation
+ : if specified, and with <code>$c</code> as the converted
+ : sequence.</p>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>A type error is raised [<span href="#ERRFORG0006" title="err:FORG0006">err:FORG0006</span>] if the input sequence contains
+ : items of incompatible types, as described above.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>Because the rules allow the sequence to be reordered, if there
+ : are two or items that are "equal lowest", the specific item whose
+ : value is returned is <span title="implementation dependent" class="termref" href="#implementation-dependent"><span class="arrow">·</span>implementation dependent<span class="arrow">·</span></span>. This can arise for example if two different
+ : strings compare equal under the selected collation, or if two
+ : different <code>xs:dateTime</code> values compare equal despite
+ : being in different timezones.</p>
+ : <p>If the converted sequence contains exactly one value then that
+ : value is returned.</p>
+ : <p>The default type when the <code>fn:min</code> function is
+ : applied to <code>xs:untypedAtomic</code> values is
+ : <code>xs:double</code>. This differs from the default type for
+ : operators such as <code>lt</code>, and for sorting in XQuery and
+ : XSLT, which is <code>xs:string</code>.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:min((3,4,5))</code> returns
+ : <code>3</code>.</p>
+ : <p>The expression <code>fn:min((xs:integer(5), xs:float(5),
+ : xs:double(10)))</code> returns <code>xs:double(5.0e0)</code>.</p>
+ : <p><code>fn:min((3,4,"Zero"))</code> raises a type error [<span href="#ERRFORG0006" title="err:FORG0006">err:FORG0006</span>].</p>
+ : <p><code>fn:min((xs:float(0.0E0), xs:float(-0.0E0)))</code> can
+ : return either positive or negative zero. <span>The two items are
+ : equal, so it is <span title="implementation dependent" class="termref" href="#implementation-dependent"><span class="arrow">·</span>implementation dependent<span class="arrow">·</span></span> which is returned.</span></p>
+ : <p>The expression <code>fn:min((fn:current-date(),
+ : xs:date("1900-01-01")))</code> returns
+ : <code>xs:date("1900-01-01")</code>. <em>(Assuming that the current
+ : date is set to a reasonable value.).</em></p>
+ : <p>The expression <code>fn:min(("a", "b", "c"))</code> returns
+ : <code>"a"</code>. <em>(Assuming a typical default
+ : collation.).</em></p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-min
+ :)
+declare function fn:min($arg as xs:anyAtomicType*) as  xs:anyAtomicType? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns a value that is equal to the lowest value appearing in
+ : the input sequence.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:min</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:anyAtomicType*</code>)<code class="as"> as </code><code class="return-type">xs:anyAtomicType?</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:min</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:anyAtomicType*</code>,
+ : <code class="arg">$collation</code><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:anyAtomicType?</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.
+ : It depends on collations.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>The following rules are applied to the input sequence:</p>
+ : <ul>
+ : <li>
+ : <p>Values of type <code>xs:untypedAtomic</code> in
+ : <code>$arg</code> are cast to <code>xs:double</code>.</p>
+ : </li>
+ : <li>
+ : <p>Numeric and <code>xs:anyURI</code> values are converted to the
+ : least common type reachable by a combination of type promotion and
+ : subtype substitution. See <span href="http://www.w3.org/TR/xpath-30/#promotion";>Section B.1 Type
+ : Promotion</span> <sup><small>XP30</small></sup> and <span href="http://www.w3.org/TR/xpath-30/#mapping";>Section B.2 Operator
+ : Mapping</span> <sup><small>XP30</small></sup>.</p>
+ : </li>
+ : </ul>
+ : <p>The items in the resulting sequence may be reordered in an
+ : arbitrary order. The resulting sequence is referred to below as the
+ : converted sequence. The function returns an item from the converted
+ : sequence rather than the input sequence.</p>
+ : <p>If the converted sequence is empty, the empty sequence is
+ : returned.</p>
+ : <p>All items in the <span>converted sequence must be derived</span>
+ : from a single base type for which the <code>le</code> operator is
+ : defined. In addition, the values in the sequence must have a total
+ : order. If date/time values do not have a timezone, they are
+ : considered to have the implicit timezone provided by the dynamic
+ : context for the purpose of comparison. Duration values must either
+ : all be <code>xs:yearMonthDuration</code> values or must all be
+ : <code>xs:dayTimeDuration</code> values.</p>
+ : <p>If the converted sequence contains the value <code>NaN</code>,
+ : the value <code>NaN</code> is returned.</p>
+ : <p>If the items in the <span>converted sequence</span> are of type
+ : <code>xs:string</code> or types derived by restriction from
+ : <code>xs:string</code>, then the determination of the item with the
+ : smallest value is made according to the collation that is used. If
+ : the type of the items in the <span>converted sequence</span> is not
+ : <code>xs:string</code> and <code>$collation</code> is specified,
+ : the collation is ignored.</p>
+ : <p>The collation used by this function is determined according to
+ : the rules in <span href="#choosing-a-collation"><b>5.3.3 Choosing a
+ : collation</b></span>.</p>
+ : <p>The function returns the result of the expression:</p>
+ : <div class="exampleInner">
+ : <pre>
+ :    if (every $v in $c satisfies $c[1] le $v) 
+ :    then $c[1] 
+ :    else fn:min(fn:subsequence($c, 2))
+ : </pre></div>
+ : <p>evaluated with <code>$collation</code> as the default collation
+ : if specified, and with <code>$c</code> as the converted
+ : sequence.</p>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>A type error is raised [<span href="#ERRFORG0006" title="err:FORG0006">err:FORG0006</span>] if the input sequence contains
+ : items of incompatible types, as described above.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>Because the rules allow the sequence to be reordered, if there
+ : are two or items that are "equal lowest", the specific item whose
+ : value is returned is <span title="implementation dependent" class="termref" href="#implementation-dependent"><span class="arrow">·</span>implementation dependent<span class="arrow">·</span></span>. This can arise for example if two different
+ : strings compare equal under the selected collation, or if two
+ : different <code>xs:dateTime</code> values compare equal despite
+ : being in different timezones.</p>
+ : <p>If the converted sequence contains exactly one value then that
+ : value is returned.</p>
+ : <p>The default type when the <code>fn:min</code> function is
+ : applied to <code>xs:untypedAtomic</code> values is
+ : <code>xs:double</code>. This differs from the default type for
+ : operators such as <code>lt</code>, and for sorting in XQuery and
+ : XSLT, which is <code>xs:string</code>.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression <code>fn:min((3,4,5))</code> returns
+ : <code>3</code>.</p>
+ : <p>The expression <code>fn:min((xs:integer(5), xs:float(5),
+ : xs:double(10)))</code> returns <code>xs:double(5.0e0)</code>.</p>
+ : <p><code>fn:min((3,4,"Zero"))</code> raises a type error [<span href="#ERRFORG0006" title="err:FORG0006">err:FORG0006</span>].</p>
+ : <p><code>fn:min((xs:float(0.0E0), xs:float(-0.0E0)))</code> can
+ : return either positive or negative zero. <span>The two items are
+ : equal, so it is <span title="implementation dependent" class="termref" href="#implementation-dependent"><span class="arrow">·</span>implementation dependent<span class="arrow">·</span></span> which is returned.</span></p>
+ : <p>The expression <code>fn:min((fn:current-date(),
+ : xs:date("1900-01-01")))</code> returns
+ : <code>xs:date("1900-01-01")</code>. <em>(Assuming that the current
+ : date is set to a reasonable value.).</em></p>
+ : <p>The expression <code>fn:min(("a", "b", "c"))</code> returns
+ : <code>"a"</code>. <em>(Assuming a typical default
+ : collation.).</em></p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-min
+ :)
+declare function fn:min($arg as xs:anyAtomicType*,  $collation as xs:string) as  xs:anyAtomicType? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns the minute component of an <code>xs:dateTime</code>.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:minutes-from-dateTime</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:dateTime?</code>)<code class="as"> as </code><code class="return-type">xs:integer?</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If <code>$arg</code> is the empty sequence, the function returns
+ : the empty sequence.</p>
+ : <p>Otherwise, the function returns an <code>xs:integer</code> value
+ : between 0 and 59, both inclusive, representing the minute component
+ : in the local value of <code>$arg</code>.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression
+ : <code>fn:minutes-from-dateTime(xs:dateTime("1999-05-31T13:20:00-05:00"))</code>
+ : returns <code>20</code>.</p>
+ : <p>The expression
+ : <code>fn:minutes-from-dateTime(xs:dateTime("1999-05-31T13:30:00+05:30"))</code>
+ : returns <code>30</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-minutes-from-dateTime
+ :)
+declare function fn:minutes-from-dateTime($arg as xs:dateTime?) as  xs:integer? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns the number of minutes in a duration.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:minutes-from-duration</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:duration?</code>)<code class="as"> as </code><code class="return-type">xs:integer?</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If <code>$arg</code> is the empty sequence, the function returns
+ : the empty sequence.</p>
+ : <p>Otherwise, the function returns an <code>xs:integer</code>
+ : representing the minutes component in the value of
+ : <code>$arg</code>. The result is obtained by casting
+ : <code>$arg</code> to an <code>xs:dayTimeDuration</code> (see
+ : <span href="#casting-to-durations"><b>18.1.3 Casting to duration
+ : types</b></span>) and then computing the minutes component as
+ : described in <span href="#canonical-dayTimeDuration"><b>8.1.2.3
+ : Canonical representation</b></span>.</p>
+ : <p>If <code>$arg</code> is a negative duration then the result will
+ : be negative..</p>
+ : <p>If <code>$arg</code> is an <code>xs:yearMonthDuration</code> the
+ : function returns 0.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression
+ : <code>fn:minutes-from-duration(xs:dayTimeDuration("P3DT10H"))</code>
+ : returns <code>0</code>.</p>
+ : <p>The expression
+ : <code>fn:minutes-from-duration(xs:dayTimeDuration("-P5DT12H30M"))</code>
+ : returns <code>-30</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-minutes-from-duration
+ :)
+declare function fn:minutes-from-duration($arg as xs:duration?) as  xs:integer? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns the minutes component of an <code>xs:time</code>.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:minutes-from-time</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:time?</code>)<code class="as"> as </code><code class="return-type">xs:integer?</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If <code>$arg</code> is the empty sequence, the function returns
+ : the empty sequence.</p>
+ : <p>Otherwise, the function returns an <code>xs:integer</code> value
+ : between 0 and 59, both inclusive, representing the value of the
+ : minutes component in the local value of <code>$arg</code>.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression
+ : <code>fn:minutes-from-time(xs:time("13:00:00Z"))</code> returns
+ : <code>0</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-minutes-from-time
+ :)
+declare function fn:minutes-from-time($arg as xs:time?) as  xs:integer? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns the month component of an <code>xs:date</code>.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:month-from-date</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:date?</code>)<code class="as"> as </code><code class="return-type">xs:integer?</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If <code>$arg</code> is the empty sequence, the function returns
+ : the empty sequence.</p>
+ : <p>Otherwise, the function returns an <code>xs:integer</code>
+ : between 1 and 12, both inclusive, representing the month component
+ : in the local value of <code>$arg</code>.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression
+ : <code>fn:month-from-date(xs:date("1999-05-31-05:00"))</code>
+ : returns <code>5</code>.</p>
+ : <p>The expression
+ : <code>fn:month-from-date(xs:date("2000-01-01+05:00"))</code>
+ : returns <code>1</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-month-from-date
+ :)
+declare function fn:month-from-date($arg as xs:date?) as  xs:integer? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns the number of months in a duration.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:months-from-duration</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:duration?</code>)<code class="as"> as </code><code class="return-type">xs:integer?</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If <code>$arg</code> is the empty sequence, the function returns
+ : the empty sequence.</p>
+ : <p>Otherwise, the function returns an <code>xs:integer</code>
+ : representing the months component in the value of
+ : <code>$arg</code>. The result is obtained by casting
+ : <code>$arg</code> to an <code>xs:yearMonthDuration</code> (see
+ : <span href="#casting-to-durations"><b>18.1.3 Casting to duration
+ : types</b></span>) and then computing the months component as described
+ : in <span href="#canonical-yearMonthDuration"><b>8.1.1.3 Canonical
+ : representation</b></span>.</p>
+ : <p>If <code>$arg</code> is a negative duration then the result will
+ : be negative..</p>
+ : <p>If <code>$arg</code> is an <code>xs:dayTimeDuration</code> the
+ : function returns 0.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression
+ : <code>fn:months-from-duration(xs:yearMonthDuration("P20Y15M"))</code>
+ : returns <code>3</code>.</p>
+ : <p>The expression
+ : <code>fn:months-from-duration(xs:yearMonthDuration("-P20Y18M"))</code>
+ : returns <code>-6</code>.</p>
+ : <p>The expression
+ : <code>fn:months-from-duration(xs:dayTimeDuration("-P2DT15H0M0S"))</code>
+ : returns <code>0</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-months-from-duration
+ :)
+declare function fn:months-from-duration($arg as xs:duration?) as  xs:integer? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns the namespace URI of one of the in-scope namespaces for
+ : <code>$element</code>, identified by its namespace prefix.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="2"><code class="function">fn:namespace-uri-for-prefix</code>(</td>
+ : <td valign="baseline"><code class="arg">$prefix</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$element</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">element()</code>)<code class="as"> as </code><code class="return-type">xs:anyURI?</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If <code>$element</code> has an in-scope namespace whose
+ : namespace prefix is equal to <code>$prefix</code>, the function
+ : returns the namespace URI of that namespace.</p>
+ : <p>If <code>$element</code> has no in-scope namespace whose
+ : namespace prefix is equal to <code>$prefix</code>, the function
+ : returns the empty sequence.</p>
+ : <p>If <code>$prefix</code> is the zero-length string or the empty
+ : sequence, then if <code>$element</code> has a default namespace
+ : (that is, a namespace node with no name), the function returns the
+ : namespace URI of the default namespace. If <code>$element</code>
+ : has no default namespace, the function returns the empty
+ : sequence.</p>
+ : <p>Prefixes are equal only if their Unicode codepoints match
+ : exactly.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>let <code>$e</code> :=</p>
+ : <div class="exampleInner">
+ : <pre>
+ : &lt;z:a xmlns="http://example.org/one"; xmlns:z="http://example.org/two"&gt;
+ :   &lt;b xmlns=""/&gt;
+ : &lt;/z:a&gt;
+ : </pre></div>
+ : <p>The expression <code>fn:namespace-uri-for-prefix("z", $e)</code>
+ : returns <code>"http://example.org/two";</code>.</p>
+ : <p>The expression <code>fn:namespace-uri-for-prefix("", $e)</code>
+ : returns <code>"http://example.org/one";</code>.</p>
+ : <p>The expression <code>fn:namespace-uri-for-prefix((), $e)</code>
+ : returns <code>"http://example.org/one";</code>.</p>
+ : <p>The expression <code>fn:namespace-uri-for-prefix("xml",
+ : $e)</code> returns
+ : <code>"http://www.w3.org/XML/1998/namespace";</code>.</p>
+ : <p>The expression <code>fn:namespace-uri-for-prefix("xml",
+ : $e)</code> returns
+ : <code>"http://www.w3.org/XML/1998/namespace";</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-namespace-uri-for-prefix
+ :)
+declare function fn:namespace-uri-for-prefix( $prefix as xs:string?,  $element as element()) as  xs:anyURI? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns the namespace URI part of the supplied QName.</p>
+ : </dd>
+ : <dt class="label">Signature</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:namespace-uri-from-QName</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:QName?</code>)<code class="as"> as </code><code class="return-type">xs:anyURI?</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If <code>$arg</code> is the empty sequence the function returns
+ : the empty sequence.</p>
+ : <p>Otherwise, the function returns an <code>xs:anyURI</code>
+ : representing the namespace URI part of <code>$arg</code>.</p>
+ : <p>If <code>$arg</code> is in no namespace, the function returns
+ : the zero-length <code>xs:anyURI</code>.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression
+ : <code>fn:namespace-uri-from-QName(fn:QName("http://www.example.com/example";,
+ : "person"))</code> returns
+ : <code>xs:anyURI("http://www.example.com/example";)</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-namespace-uri-from-QName
+ :)
+declare function fn:namespace-uri-from-QName($arg as xs:QName?) as  xs:anyURI? external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns the value of <code>$arg</code> with leading and trailing
+ : whitespace removed, and sequences of internal whitespace reduced to
+ : a single space character.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:normalize-space</code>()<code class="as"> as </code><code class="return-type">xs:string</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:normalize-space</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:string?</code>)<code class="as"> as </code><code class="return-type">xs:string</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>The zero-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-dependent"><span class="arrow">·</span>focus-dependent<span class="arrow">·</span></span>.</p>
+ : <p>The one-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If the value of <code>$arg</code> is the empty sequence, the
+ : function returns the zero-length string.</p>
+ : <p>The function returns a string constructed by stripping leading
+ : and trailing whitespace from the value of <code>$arg</code>, and
+ : replacing sequences of one or more adjacent whitespace characters
+ : with a single space, <code>#x20</code>.</p>
+ : <p>The whitespace characters are defined in the metasymbol S
+ : (Production 3) of <span href="#REC-xml">[REC-xml]</span>.</p>
+ : <p>If no argument is supplied, then <code>$arg</code> defaults to
+ : the string value (calculated using <span href="#func-string"><code>fn:string</code></span>) of the context item
+ : (<code>.</code>).</p>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>If no argument is supplied and the context item is <span href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent";>absent</span><sup><small>DM30</small></sup>
+ : then an error is raised: [<span href="http://www.w3.org/TR/xpath20/#ERRXPDY0002"; title="err:XPDY0002">err:XPDY0002</span>]<sup><small>XP</small></sup>.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>The definition of whitespace is unchanged in <span href="#xml11">[Extensible Markup Language (XML) 1.1
+ : Recommendation]</span>.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression
+ : <code>fn:normalize-space(" The    wealthy curled darlings
+ :                                         of    our    nation. ")</code>
+ : returns <code>"The wealthy curled darlings of our
+ : nation."</code>.</p>
+ : <p>The expression <code>fn:normalize-space(())</code> returns
+ : <code>""</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-normalize-space
+ :)
+declare function fn:normalize-space() as  xs:string external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns the value of <code>$arg</code> with leading and trailing
+ : whitespace removed, and sequences of internal whitespace reduced to
+ : a single space character.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:normalize-space</code>()<code class="as"> as </code><code class="return-type">xs:string</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:normalize-space</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:string?</code>)<code class="as"> as </code><code class="return-type">xs:string</code></div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>The zero-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-dependent" class="termref" href="#dt-context-dependent"><span class="arrow">·</span>context-dependent<span class="arrow">·</span></span>,
+ : and <span title="focus-dependent" class="termref" href="#dt-focus-dependent"><span class="arrow">·</span>focus-dependent<span class="arrow">·</span></span>.</p>
+ : <p>The one-argument form of this function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If the value of <code>$arg</code> is the empty sequence, the
+ : function returns the zero-length string.</p>
+ : <p>The function returns a string constructed by stripping leading
+ : and trailing whitespace from the value of <code>$arg</code>, and
+ : replacing sequences of one or more adjacent whitespace characters
+ : with a single space, <code>#x20</code>.</p>
+ : <p>The whitespace characters are defined in the metasymbol S
+ : (Production 3) of <span href="#REC-xml">[REC-xml]</span>.</p>
+ : <p>If no argument is supplied, then <code>$arg</code> defaults to
+ : the string value (calculated using <span href="#func-string"><code>fn:string</code></span>) of the context item
+ : (<code>.</code>).</p>
+ : </dd>
+ : <dt class="label">Error Conditions</dt>
+ : <dd>
+ : <p>If no argument is supplied and the context item is <span href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent";>absent</span><sup><small>DM30</small></sup>
+ : then an error is raised: [<span href="http://www.w3.org/TR/xpath20/#ERRXPDY0002"; title="err:XPDY0002">err:XPDY0002</span>]<sup><small>XP</small></sup>.</p>
+ : </dd>
+ : <dt class="label">Notes</dt>
+ : <dd>
+ : <p>The definition of whitespace is unchanged in <span href="#xml11">[Extensible Markup Language (XML) 1.1
+ : Recommendation]</span>.</p>
+ : </dd>
+ : <dt class="label">Examples</dt>
+ : <dd>
+ : <p>The expression
+ : <code>fn:normalize-space(" The    wealthy curled darlings
+ :                                         of    our    nation. ")</code>
+ : returns <code>"The wealthy curled darlings of our
+ : nation."</code>.</p>
+ : <p>The expression <code>fn:normalize-space(())</code> returns
+ : <code>""</code>.</p>
+ : </dd>
+ : </dl> 
+ :
+ : @see http://www.w3.org/TR/xpath-functions-30/#func-normalize-space
+ :)
+declare function fn:normalize-space($arg as xs:string?) as  xs:string external;
+ 
+(:~
+ : <dl xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="http://www.w3.org/1999/xhtml";>
+ : <dt class="label"/>
+ : <dd>
+ : <p>Returns the value of <code>$arg</code> after applying Unicode
+ : normalization.</p>
+ : </dd>
+ : <dt class="label">Signatures</dt>
+ : <dd>
+ : <div class="exampleInner">
+ : <div class="proto"><code class="function">fn:normalize-unicode</code>(<code class="arg">$arg</code><code class="as"> as </code><code class="type">xs:string?</code>)<code class="as"> as </code><code class="return-type">xs:string</code></div>
+ : </div>
+ : <div class="exampleInner">
+ : <div class="proto">
+ : <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
+ : <tr>
+ : <td valign="baseline" rowspan="2"><code class="function">fn:normalize-unicode</code>(</td>
+ : <td valign="baseline"><code class="arg">$arg</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string?</code>,</td>
+ : </tr>
+ : <tr>
+ : <td valign="baseline"><code class="arg">$normalizationForm</code></td>
+ : <td valign="baseline"><code class="as"> as </code><code class="type">xs:string</code>)<code class="as"> as </code><code class="return-type">xs:string</code></td>
+ : </tr>
+ : </table>
+ : </div>
+ : </div>
+ : </dd>
+ : <dt class="label">Properties</dt>
+ : <dd>
+ : <p>This function is <span title="deterministic" class="termref" href="#dt-deterministic"><span class="arrow">·</span>deterministic<span class="arrow">·</span></span>,
+ : <span title="context-independent" class="termref" href="#dt-context-independent"><span class="arrow">·</span>context-independent<span class="arrow">·</span></span>, and <span title="focus-dependent" class="termref" href="#dt-focus-independent"><span class="arrow">·</span>focus-independent<span class="arrow">·</span></span>.</p>
+ : </dd>
+ : <dt class="label">Rules</dt>
+ : <dd>
+ : <p>If the value of <code>$arg</code> is the empty sequence, the
+ : function returns the zero-length string.</p>
+ : <p>If the single-argument version of the function is used, the
+ : result is the same as calling the two-argument version with
+ : <code>$normalizationForm</code> set to the string "NFC".</p>
+ : <p>Otherwise, the function returns the value of <code>$arg</code>
+ : normalized according to the rules of the normalization form
+ : identified by the value of <code>$normalizationForm</code>.</p>
+ : <p>The effective value of <code>$normalizationForm</code> is the
+ : value of the expression <span href="#func-upper-case"><code>fn:upper-case(fn:normalize-space($normalizationForm))</code></span>.</p>
+ : <ul>
+ : <li>
+ : <p>If the effective value of <code>$normalizationForm</code> is
+ : "NFC", then the function returns the value of <code>$arg</code>
+ : converted to Unicode Normalization Form C (NFC).</p>
+ : </li>
+ : <li>
+ : <p>If the effective value of <code>$normalizationForm</code> is
+ : "NFD", then the function returns the value of <code>$arg</code>
+ : converted to Unicode Normalization Form D (NFD).</p>
+ : </li>
+ : <li>
+ : <p>If the effective value of <code>$normalizationForm</code> is
+ : "NFKC", then the function returns the value of <code>$arg</code> in
+ : Unicode Normalization Form KC (NFKC).</p>
+ : </li>
+ : <li>
+ : <p>If the effective value of <code>$normalizationForm</code> is
+ : "NFKD", then the function returns the value of <code>$arg</code>
+ : converted to Unicode Normalization Form KD (NFKD).</p>
+ : </li>
+ : <li>
+ : <p>If the effective value of <code>$normalizationForm</code> is
+ : "FULLY-NORMALIZED", then the function returns the value of
+ : <code>$arg</code> converted to fully normalized form.</p>
+ 

Follow ups