- Returns the position of the last node in the context list
+ This function tests whether the language of $node, or the context item if the second argument is omitted, as specified by xml:lang attributes is the same as, or is a sublanguage of, the language specified by $testlang. The behavior of the function if the second argument is omitted is exactly the same as if the context item (.) had been passed as the second argument. The language of the argument node, or the context item if the second argument is omitted, is determined by the value of the xml:lang attribute on the node, or, if the node has no such attribute, by the value of the xml:lang attribute on the nearest ancestor of the node that has an xml:lang attribute. If there is no such ancestor, then the function returns false
+
+
Arguments:
+
+
+ | Type |
+ Description |
+
+
+ | xs:string? |
+ $testlang |
+
+
+ | node() |
+ $node (Optional) |
+
+
+
Return type: xs:boolean?
+
Examples: Look W3C documentation below.
-
W3C Documentation reference: Node-Set-Functions
+
+
W3C Documentation reference
+
+ Returns the root of the tree to which $arg belongs. This will usually, but not necessarily, be a document node.
-
+ If $arg is the empty sequence, the empty sequence is returned.
+
+ If $arg is a document node, $arg is returned.
+
+ If the function is called without an argument, the context item (.) is used as the default argument. 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.
+
+ The following errors may be raised: if the context item is undefined [err:XPDY0002]; if the context item is not a node [err:XPTY0004].
+
+
Arguments:
+
+
+ | Type |
+ Description |
+
+
+ | node() |
+ $arg (Optional) |
+
+
+
Return type: node()?
+
Examples:
+
+
+ | Query |
+ Result |
+
+
+ | root() |
+ <l:library>[...]</l:library> |
+
+
+ | document-uri(/library/fiction:book[1]) |
+ http://example.com/library.xml (assuming the document URI of the first fiction:book element is "http://example.com/library.xml") |
+
+
+ | document-uri(/library) |
+ http://example.com/library.xml (assuming the document URI of the library element is "http://example.com/library.xml") |
+
+
+
+
W3C Documentation reference
+
@@ -2215,41 +2286,947 @@
-
fn:adjust-date-to-timezone(date,timezone)
-
- If the timezone argument is empty, it returns a date without a timezone. Otherwise,
- it returns a date with a timezone
-
Arguments and return type:
-
-
- | Type |
- Description |
-
-
- | date |
- date to be adjusted |
-
-
- | timezone |
- timezone to be imposed into date |
-
-
Examples:
-
-
- | Expression |
- Result |
-
-
- | adjust-date-to-timezone(xs:date('2011-11-15'),
- xs:dayTimeDuration("PT10H")) |
- 2011-11-15+10:00 |
-
-
-
W3C Documentation reference: #func-adjust-date-to-timezone
-
-
+
fn:years-from-duration()
+
+ Returns an xs:integer representing the years component in the value of $arg. The result is obtained by casting $arg to an xs:yearMonthDuration (see 17.1.4 Casting to duration types) and then computing the years component as described in 10.3.1.3 Canonical representation.
+
+ The result may be negative.
+
+ If $arg is an xs:dayTimeDuration returns 0.
+
+ If $arg is the empty sequence, returns the empty sequence.
+
Arguments and return type:
+
+
+ | Type |
+ Description |
+
+
+ | xs:duration? |
+ $arg |
+
+
+
Return type: xs:integer?
+
Examples:
+
+
+ | Expression |
+ Result |
+
+
+ | years-from-duration(xs:yearMonthDuration("P20Y15M")) |
+ 21 |
+
+
+ | years-from-duration(xs:yearMonthDuration("-P15M")) |
+ -1 |
+
+
+ | years-from-duration(xs:dayTimeDuration("-P2DT15H")) |
+ 0 |
+
+
+
W3C Documentation reference
+
+
+
fn:months-from-duration()
+
+ Returns an xs:integer representing the months component in the value of $arg. The result is obtained by casting $arg to an xs:yearMonthDuration (see 17.1.4 Casting to duration types) and then computing the months component as described in 10.3.1.3 Canonical representation.
+
+ The result may be negative.
+
+ If $arg is an xs:dayTimeDuration returns 0.
+
+ If $arg is the empty sequence, returns the empty sequence.
+
Arguments and return type:
+
+
+ | Type |
+ Description |
+
+
+ | xs:duration? |
+ $arg |
+
+
+
Return type: xs:integer?
+
Examples:
+
+
+ | Expression |
+ Result |
+
+
+ | months-from-duration(xs:yearMonthDuration("P20Y15M")) |
+ 3 |
+
+
+ | months-from-duration(xs:yearMonthDuration("-P20Y18M")) |
+ -6 |
+
+
+ | months-from-duration(xs:dayTimeDuration("-P2DT15H0M0S")) |
+ 0 |
+
+
+
W3C Documentation reference
+
+
+
fn:days-from-duration()
+
+ Returns an xs:integer representing the days component in the value of $arg. The result is obtained by casting $arg to an xs:dayTimeDuration (see 17.1.4 Casting to duration types) and then computing the days component as described in 10.3.2.3 Canonical representation.
+
+ The result may be negative.
+
+ If $arg is an xs:yearMonthDuration returns 0.
+
+ If $arg is the empty sequence, returns the empty sequence.
+
Arguments and return type:
+
+
+ | Type |
+ Description |
+
+
+ | xs:duration? |
+ $arg |
+
+
+
Return type: xs:integer?
+
Examples:
+
+
+ | Expression |
+ Result |
+
+
+ | days-from-duration(xs:dayTimeDuration("P3DT10H")) |
+ 3 |
+
+
+ | days-from-duration(xs:dayTimeDuration("P3DT55H")) |
+ 5 |
+
+
+ | days-from-duration(xs:yearMonthDuration("P3Y5M")) |
+ 0 |
+
+
+
W3C Documentation reference
+
+
+
fn:hours-from-duration()
+
+ Returns an xs:integer representing the hours component in the value of $arg. The result is obtained by casting $arg to an xs:dayTimeDuration (see 17.1.4 Casting to duration types) and then computing the hours component as described in 10.3.2.3 Canonical representation.
+
+ The result may be negative.
+
+ If $arg is an xs:yearMonthDuration returns 0.
+
+ If $arg is the empty sequence, returns the empty sequence.
+
Arguments and return type:
+
+
+ | Type |
+ Description |
+
+
+ | xs:duration? |
+ $arg |
+
+
+
Return type: xs:integer?
+
Examples:
+
+
+ | Expression |
+ Result |
+
+
+ | hours-from-duration(xs:dayTimeDuration("P3DT10H")) |
+ 10 |
+
+
+ | hours-from-duration(xs:dayTimeDuration("P3DT12H32M12S")) |
+ 12 |
+
+
+ | hours-from-duration(xs:dayTimeDuration("PT123H")) |
+ 0 |
+
+
+
W3C Documentation reference
+
+
+
+
fn:minutes-from-duration()
+
+ Returns an xs:integer representing the minutes component in the value of $arg. The result is obtained by casting $arg to an xs:dayTimeDuration (see 17.1.4 Casting to duration types) and then computing the minutes component as described in 10.3.2.3 Canonical representation.
+
+ The result may be negative.
+
+ If $arg is an xs:yearMonthDuration returns 0.
+
+ If $arg is the empty sequence, returns the empty sequence.
+
Arguments and return type:
+
+
+ | Type |
+ Description |
+
+
+ | xs:duration? |
+ $arg |
+
+
+
Return type: xs:integer?
+
Examples:
+
+
+ | Expression |
+ Result |
+
+
+ | minutes-from-duration(xs:dayTimeDuration("P3DT10H")) |
+ 0 |
+
+
+ | minutes-from-duration(xs:dayTimeDuration("-P5DT12H30M")) |
+ -30 |
+
+
+
W3C Documentation reference
+
+
+
fn:seconds-from-duration()
+
+ Returns an xs:decimal representing the seconds component in the value of $arg. The result is obtained by casting $arg to an xs:dayTimeDuration (see 17.1.4 Casting to duration types) and then computing the seconds component as described in 10.3.2.3 Canonical representation.
+
+ The result may be negative.
+
+ If $arg is an xs:yearMonthDuration returns 0.
+
+ If $arg is the empty sequence, returns the empty sequence.
+
Arguments and return type:
+
+
+ | Type |
+ Description |
+
+
+ | xs:duration? |
+ $arg |
+
+
+
Return type: xs:decimal?
+
Examples:
+
+
+ | Expression |
+ Result |
+
+
+ | seconds-from-duration(xs:dayTimeDuration("P3DT10H12.5S")) |
+ 12.5 |
+
+
+ | seconds-from-duration(xs:dayTimeDuration("-PT256S")) |
+ -16.0 |
+
+
+
W3C Documentation reference
+
+
+
+
fn:year-from-dateTime()
+
+ Returns an xs:integer representing the year component in the localized value of $arg. The result may be negative.
+
+ If $arg is the empty sequence, returns the empty sequence.
+
Arguments and return type:
+
+
+ | Type |
+ Description |
+
+
+ | xs:dateTime? |
+ $arg |
+
+
+
Return type: xs:integer?
+
Examples:
+
+
+ | Expression |
+ Result |
+
+
+ | year-from-dateTime(xs:dateTime("1999-05-31T13:20:00-05:00")) |
+ 1999 |
+
+
+ | year-from-dateTime(xs:dateTime("1999-12-31T19:20:00")) |
+ 1999 |
+
+
+ | year-from-dateTime(xs:dateTime("1999-12-31T24:00:00")) |
+ 2000 |
+
+
+
W3C Documentation reference
+
+
+
+
fn:month-from-dateTime()
+
+ Returns an xs:integer between 1 and 12, both inclusive, representing the month component in the localized value of $arg.
+
+ If $arg is the empty sequence, returns the empty sequence.
+
Arguments and return type:
+
+
+ | Type |
+ Description |
+
+
+ | xs:dateTime? |
+ $arg |
+
+
+
Return type: xs:integer?
+
Examples:
+
+
+ | Expression |
+ Result |
+
+
+ | month-from-dateTime(xs:dateTime("1999-05-31T13:20:00-05:00")) |
+ 5 |
+
+
+ | month-from-dateTime(xs:dateTime("1999-12-31T19:20:00")) |
+ 12 |
+
+
+ | month-from-dateTime(xs:dateTime("1999-12-31T24:00:00")) |
+ 1 |
+
+
+
W3C Documentation reference
+
+
+
fn:day-from-dateTime()
+
+ Returns an xs:integer between 1 and 31, both inclusive, representing the day component in the localized value of $arg.
+
+ If $arg is the empty sequence, returns the empty sequence.
+
Arguments and return type:
+
+
+ | Type |
+ Description |
+
+
+ | xs:dateTime? |
+ $arg |
+
+
+
Return type: xs:integer?
+
Examples:
+
+
+ | Expression |
+ Result |
+
+
+ | day-from-dateTime(xs:dateTime("1999-05-31T13:20:00-05:00")) |
+ 31 |
+
+
+ | day-from-dateTime(xs:dateTime("1999-12-31T19:20:00")) |
+ 31 |
+
+
+ | day-from-dateTime(xs:dateTime("1999-12-31T24:00:00")) |
+ 1 |
+
+
+
W3C Documentation reference
+
+
+
+
fn:hours-from-dateTime()
+
+ Returns an xs:integer between 0 and 23, both inclusive, representing the hours component in the localized value of $arg.
+
+ If $arg is the empty sequence, returns the empty sequence.
+
Arguments and return type:
+
+
+ | Type |
+ Description |
+
+
+ | xs:dateTime? |
+ $arg |
+
+
+
Return type: xs:integer?
+
Examples:
+
+
+ | Expression |
+ Result |
+
+
+ | hours-from-dateTime(xs:dateTime("1999-05-31T13:20:00-05:00")) |
+ 13 |
+
+
+ | hours-from-dateTime(xs:dateTime("1999-12-31T19:20:00")) |
+ 19 |
+
+
+ | hours-from-dateTime(xs:dateTime("1999-12-31T24:00:00")) |
+ 0 |
+
+
+
W3C Documentation reference
+
+
+
+
fn:minutes-from-dateTime()
+
+ Returns an xs:integer value between 0 and 59, both inclusive, representing the minute component in the localized value of $arg.
+
+ If $arg is the empty sequence, returns the empty sequence.
+
Arguments and return type:
+
+
+ | Type |
+ Description |
+
+
+ | xs:dateTime? |
+ $arg |
+
+
+
Return type: xs:integer?
+
Examples:
+
+
+ | Expression |
+ Result |
+
+
+ | minutes-from-dateTime(xs:dateTime("1999-05-31T13:20:00-05:00")) |
+ 20 |
+
+
+ | minutes-from-dateTime(xs:dateTime("1999-05-31T13:30:00+05:30")) |
+ 30 |
+
+
+
W3C Documentation reference
+
+
+
fn:seconds-from-dateTime()
+
+ Returns an xs:decimal value greater than or equal to zero and less than 60, representing the seconds and fractional seconds in the localized value of $arg.
+
+ If $arg is the empty sequence, returns the empty sequence.
+
Arguments and return type:
+
+
+ | Type |
+ Description |
+
+
+ | xs:dateTime? |
+ $arg |
+
+
+
Return type: xs:decimal?
+
Examples:
+
+
+ | Expression |
+ Result |
+
+
+ | seconds-from-dateTime(xs:dateTime("1999-05-31T13:20:00-05:00")) |
+ 0 |
+
+
+
W3C Documentation reference
+
+
+
fn:timezone-from-dateTime()
+
+ Returns an xs:decimal value greater than or equal to zero and less than 60, representing the seconds and fractional seconds in the localized value of $arg.
+
+ If $arg is the empty sequence, returns the empty sequence.
+
Arguments and return type:
+
+
+ | Type |
+ Description |
+
+
+ | xs:dateTime? |
+ $arg |
+
+
+
Return type: xs:dayTimeDuration?
+
Examples:
+
+
+ | Expression |
+ Result |
+
+
+ | timezone-from-dateTime(xs:dateTime("1999-05-31T13:20:00-05:00")) |
+ -PT5H |
+
+
+ | timezone-from-dateTime(xs:dateTime("2000-06-12T13:20:00Z")) |
+ PT0S |
+
+
+ | timezone-from-dateTime(xs:dateTime("2004-08-27T00:00:00")) |
+ () |
+
+
+
W3C Documentation reference
+
+
+
+
fn:year-from-date()
+
+ Returns an xs:integer representing the year in the localized value of $arg. The value may be negative.
+
+ If $arg is the empty sequence, returns the empty sequence.
+
Arguments and return type:
+
+
+ | Type |
+ Description |
+
+
+ | xs:date? |
+ $arg |
+
+
+
Return type: xs:integer?
+
Examples:
+
+
+ | Expression |
+ Result |
+
+
+ | year-from-date(xs:date("1999-05-31")) |
+ 1999 |
+
+
+ | year-from-date(xs:date("2000-01-01+05:00")) |
+ 2000 |
+
+
+
W3C Documentation reference
+
+
+
fn:month-from-date()
+
+ Returns an xs:integer between 1 and 12, both inclusive, representing the month component in the localized value of $arg.
+
+ If $arg is the empty sequence, returns the empty sequence.
+
Arguments and return type:
+
+
+ | Type |
+ Description |
+
+
+ | xs:date? |
+ $arg |
+
+
+
Return type: xs:integer?
+
Examples:
+
+
+ | Expression |
+ Result |
+
+
+ | month-from-date(xs:date("1999-05-31-05:00")) |
+ 5 |
+
+
+ | month-from-date(xs:date("2000-01-01+05:00")) |
+ 1 |
+
+
+
W3C Documentation reference
+
+
+
fn:day-from-date()
+
+ Returns an xs:integer between 1 and 31, both inclusive, representing the day component in the localized value of $arg.
+
+ If $arg is the empty sequence, returns the empty sequence.
+
Arguments and return type:
+
+
+ | Type |
+ Description |
+
+
+ | xs:date? |
+ $arg |
+
+
+
Return type: xs:integer?
+
Examples:
+
+
+ | Expression |
+ Result |
+
+
+ | day-from-date(xs:date("1999-05-31-05:00")) |
+ 31 |
+
+
+ | day-from-date(xs:date("2000-01-01+05:00")) |
+ 1 |
+
+
+
W3C Documentation reference
+
+
+
+
fn:timezone-from-date()
+
+ Returns the timezone component of $arg if any. If $arg has a timezone component, then the result is an xs:dayTimeDuration that indicates deviation from UTC; its value may range from +14:00 to -14:00 hours, both inclusive. Otherwise, the result is the empty sequence.
+
+ If $arg is the empty sequence, returns the empty sequence.
+
Arguments and return type:
+
+
+ | Type |
+ Description |
+
+
+ | xs:date? |
+ $arg |
+
+
+
Return type: xs:dayTimeDuration?
+
Examples:
+
+
+ | Expression |
+ Result |
+
+
+ | timezone-from-date(xs:date("1999-05-31-05:00")) |
+ -PT5H |
+
+
+ | timezone-from-date(xs:date("2000-06-12Z")) |
+ PT0S |
+
+
+
W3C Documentation reference
+
+
+
+
fn:hours-from-time()
+
+ Returns an xs:integer between 0 and 23, both inclusive, representing the value of the hours component in the localized value of $arg.
+
+ If $arg is the empty sequence, returns the empty sequence.
+
Arguments and return type:
+
+
+ | Type |
+ Description |
+
+
+ | xs:time? |
+ $arg |
+
+
+
Return type: xs:integer?
+
Examples:
+
+
+ | Expression |
+ Result |
+
+
+ | hours-from-time(xs:time("11:23:00")) |
+ 11 |
+
+
+ | hours-from-time(xs:time("24:00:00")) |
+ 0 |
+
+
+
W3C Documentation reference
+
+
+
+
fn:minutes-from-time()
+
+ Returns an xs:integer between 0 and 23, both inclusive, representing the value of the hours component in the localized value of $arg.
+
+ If $arg is the empty sequence, returns the empty sequence.
+
Arguments and return type:
+
+
+ | Type |
+ Description |
+
+
+ | xs:time? |
+ $arg |
+
+
+
Return type: xs:integer?
+
Examples:
+
+
+ | Expression |
+ Result |
+
+
+ | hours-from-time(xs:time("11:23:00")) |
+ 11 |
+
+
+ | hours-from-time(xs:time("24:00:00")) |
+ 0 |
+
+
+
W3C Documentation reference
+
+
+
fn:seconds-from-time()
+
+ Returns an xs:decimal value greater than or equal to zero and less than 60, representing the seconds and fractional seconds in the localized value of $arg.
+
+ If $arg is the empty sequence, returns the empty sequence.
+
Arguments and return type:
+
+
+ | Type |
+ Description |
+
+
+ | xs:time? |
+ $arg |
+
+
+
Return type: xs:decimal?
+
Examples:
+
+
+ | Expression |
+ Result |
+
+
+ | seconds-from-time(xs:time("13:20:10.5")) |
+ 10.5 |
+
+
+
+
W3C Documentation reference
+
+
+
+
fn:timezone-from-time()
+
+ Returns an xs:decimal value greater than or equal to zero and less than 60, representing the seconds and fractional seconds in the localized value of $arg.
+
+ If $arg is the empty sequence, returns the empty sequence.
+
Arguments and return type:
+
+
+ | Type |
+ Description |
+
+
+ | xs:time? |
+ $arg |
+
+
+
Return type: xs:dayTimeDuration?
+
Examples:
+
+
+ | Expression |
+ Result |
+
+
+ | timezone-from-time(xs:time("13:20:00-05:00")) |
+ -PT5H |
+
+
+ | timezone-from-time(xs:time("13:20:00")) |
+ () |
+
+
+
+
W3C Documentation reference
+
+
+
+
fn:adjust-date-to-timezone()
+
+ Adjusts an xs:date value to a specific timezone, or to no timezone at all. If $timezone is the empty sequence, returns an xs:date without a timezone. Otherwise, returns an xs:date with a timezone. For purposes of timezone adjustment, an xs:date is treated as an xs:dateTime with time 00:00:00.
+
+ If $timezone is not specified, then $timezone is the value of the implicit timezone in the dynamic context.
+
+ If $arg is the empty sequence, then the result is the empty sequence.
+
+ A dynamic error is raised [err:FODT0003] if $timezone is less than -PT14H or greater than PT14H or if does not contain an integral number of minutes.
+
+ If $arg does not have a timezone component and $timezone is the empty sequence, then the result is the value of $arg.
+
+ If $arg does not have a timezone component and $timezone is not the empty sequence, then the result is $arg with $timezone as the timezone component.
+
+ If $arg has a timezone component and $timezone is the empty sequence, then the result is the localized value of $arg without its timezone component.
+
+ If $arg has a timezone component and $timezone is not the empty sequence, then:
+
+ - Let $srcdt be an xs:dateTime value, with 00:00:00 for the time component and date and timezone components that are the same as the date and timezone components of $arg.
+ - Let $r be the result of evaluating fn:adjust-dateTime-to-timezone($srcdt, $timezone)
+ - The result of this function will be a date value that has date and timezone components that are the same as the date and timezone components of $r.
+
+
+
+
Arguments and return type:
+
+
+ | Type |
+ Description |
+
+
+ | xs:date? |
+ $arg |
+
+
+ | xs:dayTimeDuration? |
+ $timezone |
+
+
+
Return type: xs:date?
+
Examples:
+
+
+ | Expression |
+ Result |
+
+
+ | adjust-date-to-timezone(xs:date("2002-03-07")) |
+ 2002-03-07-05:00 |
+
+
+ | adjust-date-to-timezone(xs:date("2002-03-07"), xs:dayTimeDuration("-PT10H")) |
+ 2002-03-07-10:00 |
+
+
+
+
W3C Documentation reference
+
+
+
fn:adjust-time-to-timezone()
+
+ Adjusts an xs:time value to a specific timezone, or to no timezone at all. If $timezone is the empty sequence, returns an xs:time without a timezone. Otherwise, returns an xs:time with a timezone.
+
+ If $timezone is not specified, then $timezone is the value of the implicit timezone in the dynamic context.
+
+ If $arg is the empty sequence, then the result is the empty sequence.
+
+ A dynamic error is raised [err:FODT0003] if $timezone is less than -PT14H or greater than PT14H or if does not contain an integral number of minutes.
+
+ If $arg does not have a timezone component and $timezone is the empty sequence, then the result is $arg.
+
+ If $arg does not have a timezone component and $timezone is not the empty sequence, then the result is $arg with $timezone as the timezone component.
+
+ If $arg has a timezone component and $timezone is the empty sequence, then the result is the localized value of $arg without its timezone component.
+
+ If $arg has a timezone component and $timezone is not the empty sequence, then:
+
+ - Let $srcdt be an xs:dateTime value, with an arbitrary date for the date component and time and timezone components that are the same as the time and timezone components of $arg.
+ - Let $r be the result of evaluating fn:adjust-dateTime-to-timezone($srcdt, $timezone)
+ - The result of this function will be a time value that has time and timezone components that are the same as the time and timezone components of $r.
+
+
+
+
Arguments and return type:
+
+
+ | Type |
+ Description |
+
+
+ | xs:time? |
+ $arg |
+
+
+ | xs:dayTimeDuration? |
+ $timezone |
+
+
+
Return type: xs:time?
+
Examples:
+
+
+ | Expression |
+ Result |
+
+
+ | adjust-time-to-timezone(xs:time("10:00:00")) |
+ 10:00:00-05:00 |
+
+
+ | adjust-time-to-timezone(xs:time("10:00:00"), xs:dayTimeDuration("-PT10H")) |
+ 10:00:00-10:00 |
+
+
+
+
W3C Documentation reference
+