Name
[2.0]
adjust-time-to-timezone()
Adjusts an xs:time
value to a particular
timezone.
Syntax
xs:time?adjust-time-to-timezone(
xs:time?
)
xs:time?adjust-time-to-timezone(
xs:time?
,$timezone as xs:dayTimeDuration?
)
Input
An optional xs:time
value
and an optional xs:dayTimeDuration
. If no xs:date
is provided, the empty sequence
is returned. If an xs:dayTimeDuration
is provided, the
xs:time
value is adjusted to
the timezone contained in the xs:dayTimeDuration
; otherwise, the XSLT
processor uses the default timezone as returned by [2.0]
implicit-timezone()
. Finally, if the timezone
provided by the xs:dayTimeDuration
is the empty
sequence, the function returns the xs:time
with the timezone information
removed.
Output
The given xs:time
value
adjusted to the appropriate timezone.
Defined in
XQuery 1.0 and XPath 2.0 Functions and Operators section 10.7, “Timezone Adjustment Functions on Dates and Time Values.”
Example
The following stylesheet tests the
adjust-time-to-timezone()
function:
<?xml version="1.0"?>
<!-- adjust-time-to-timezone.xsl --> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xsl:output method="text"/> <xsl:template match="/"> <xsl:variable name="gmt" select="xs:dayTimeDuration('PT0H')"/> <xsl:variable name="est" select="xs:dayTimeDuration('-PT5H')"/> <xsl:variable name="cst" select="xs:dayTimeDuration('-PT6H')"/> <xsl:variable name="minusTen" select="xs:dayTimeDuration('-PT10H')"/> <xsl:variable name="LilysBirthday" ...
Get XSLT, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.