[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

format-dateTime and time zone?

Subject: format-dateTime and time zone?
From: "Birnbaum, David J" <djbpitt@xxxxxxxx>
Date: Thu, 14 Jul 2011 00:01:24 -0400
 format-dateTime and time zone?
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@xxxxxxxxx

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.