Hi,
I'm primarily using Saxon 8, but I've also tried this in XML Spy 2005,
and can't get it to work in either so i must be doing something wrong.
I originally started this by looking for how to convert milliseconds
into a date. I came across....
http://www.xslt.com/html/xsl-list/2005-02/msg00499.html
where Michael Kay gives this formula:
xs:dateTime("1970-01-01T00:00:00") + $in * xs:dayTimeDuration("PT0.001S")
I assume, that "xs:dayTimeDuration" is typo or from an older version
of the spec and now should be "xsd:dayTimeDuration"?
Anyway, I've tried countless variations of the namespace (where do I
get the 'real' xdt namespace used by saxon??? I've just been
extracting them from various online examples) and cannot get
'dayTimeDuration' (or anything using xdt) to do anything for me.
--- here's one of the many iterations of stylesheet I've used ---------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2004/07/xpath-functions"
xmlns:xdt="http://www.w3.org/2004/07/xpath-datatypes"
xmlns:rs="http://java.sun.com/xml/ns/jdbc">
<xsl:output method="html" omit-xml-declaration="yes"/>
<xsl:template match="/">
<xsl:value-of select=" (current-date() +
xdt:yearMonthDuration('P1Y')) + xdt:dayTimeDuration('P1D')"/>
</xsl:template>
</xsl:stylesheet>
---------------- Here's the stack trace-------------------
javax.xml.transform.TransformerException: No function found matching
xdt:yearMonthDuration with one argument
at
net.sf.saxon.TransformerHandlerImpl.endDocument(TransformerHandlerImpl.java:121)
at org.apache.xerces.parsers.AbstractSAXParser.endDocument(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
at org.apache.xerces.impl.XMLEntityScanner.skipSpaces(Unknown Source)
at
org.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.dispatch(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
--------------------------------------------------------
Ideas??? Thanks!
--~------------------------------------------------------------------
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>
--~--