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

RE: Convert milliseconds into date

Subject: RE: Convert milliseconds into date
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 13 Apr 2006 23:41:21 +0100
java convert milliseconds to date
> The $in which is in milliseconds is an external parameter declared on
> the stylesheet using <xsl:param>

The actual type of $in depends on whether you have declared the type in the
xsl:param declaration (I suspect you haven't, or you would have told us) and
on the object supplied in the invocation of the stylesheet. If you are
running from the command line, then the value will be untypedAtomic. If you
are running from a Java application, then it depends on what you supply in
the call: if you supply a Long, the value will be an xs:integer; if you
supply a String, it will be an xs:string.

Michael Kay
http://www.saxonica.com/

> --------------------------------------------------------------
> -------------------------------------------------------
> 
> You've confirmed that version="1.0", and I suspect despite 
> what you say
> that
> $in is untypedAtomic rather than xs:long. In the calculation, try
> wrapping
> it as xs:integer($in).
> 
> Michael Kay
> http://www.saxonica.com/
> 
> > -----Original Message-----
> > From: xslt xslfo [mailto:xslt.techie@xxxxxxxxx]
> > Sent: 13 April 2006 17:52
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: RE:  Convert milliseconds into date
> >
> > This is what I am using;
> >
> > <xsl:stylesheet version="1.0"
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> > xmlns:fo="http://www.w3.org/1999/XSL/Format"
> > xmlns:xdt="http://www.w3.org/2005/02/xpath-datatypes"
> > xmlns:xs="http://www.w3.org/2001/XMLSchema">
> >
> > <xsl:value-of select="xs:dateTime('1970-01-01T00:00:00') + $in *
> > xs:dayTimeDuration('PT0.001S')"/>
> >
> > The $in is date in "long" format which is passed as a 
> paramter to the
> > XSL:FO. For testing, I have hardcoded the value to 1143230642199.
> >
> > Does this help?
> >
> > --------------------------------------------------------------
> > ------------------------
> >
> > I think this is what you would get if
> >
> > (a) the stylesheet specifies version="1.0"
> >
> > and
> >
> > (b) the value of $in is untypedAtomic.
> >
> > Since you haven't shown us the xsl:stylesheet element or the
> > declaration of
> > $in, this is just a hypothesis.
> >
> > Michael Kay
> > http://www.saxonica.com/
> >
> >
> > Delete Reply Forward Spam Move...
> > Previous | Next | Back to Messages

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.