Subject: [xsl] format-dateTime and time zone? From: "Birnbaum, David J" <djbpitt@xxxxxxxx> Date: Thu, 14 Jul 2011 00:01:24 -0400 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] format-number/bankers' ro, David Carlisle | Thread | Re: [xsl] format-dateTime and time , Michael Kay |
Re: [xsl] why matches($title,'.*?(\, Liam R E Quin | Date | [xsl] DTD Namespaces and xslt outpu, JSRawat |
Month |