xsl-list
[Top] [All Lists]

[xsl] format-dateTime and time zone?

2011-07-13 23:01:40
Dear xsl-list,

I'm trying to produce a formatted date with time zone (as a signed numerical 
value). Here's a stripped-down example:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:xs="http://www.w3.org/2001/XMLSchema"; exclude-result-prefixes="xs" 
version="2.0">
    <xsl:template match="/">
        <root>
            <xsl:value-of
                select="format-dateTime(current-dateTime(),
                '[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01][Z]')"
            />
        </root>
    </xsl:template>
</xsl:stylesheet>

When I run this in Saxon 9.3 against an arbitrary xml document, it produces a 
raw "Z" character at the end, instead of the time zone:

[djb@obdurodon tmp]$ saxon -s:Untitled1.xsl -xsl:Untitled1.xsl -t
Saxon-HE 9.3.0.5J from Saxonica
Java version 1.6.0_26
Stylesheet compilation time: 371 milliseconds
Processing file:/tmp/Untitled1.xsl
Using parser com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser
Building tree for file:/tmp/Untitled1.xsl using class 
net.sf.saxon.tree.tiny.TinyBuilder
Tree built in 3 milliseconds
Tree size: 12 nodes, 0 characters, 4 attributes
<?xml version="1.0" 
encoding="UTF-8"?><root>2011-07-14T03:53:38Z</root>Execution time: 49ms
Memory used: 5553816
NamePool contents: 7 entries in 7 chains. 6 prefixes, 6 URIs

I'm running on Centos 5.5 with the system clock set to UTC:

[djb@obdurodon tmp]$ date
Thu Jul 14 03:54:16 UTC 2011

I thought the xslt would produce "+0000" at the end of the dateTime instead of 
"Z". Is that assumption wrong? 

Thanks,

David
djbpitt(_at_)gmail(_dot_)com


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>