RE: [xsl] Can't use any of the xdt functions! Grrrr

Subject: RE: [xsl] Can't use any of the xdt functions! Grrrr
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 18 Mar 2005 17:40:40 -0000
> I assume, that "xs:dayTimeDuration" is typo or from an older version
> of the spec and now should be "xsd:dayTimeDuration"?

It should be xdt:....
> 
> Anyway, I've tried countless variations of the namespace (where do I
> get the 'real' xdt namespace used by saxon??? 

W3C change the namespace each time a new working draft comes out, and Saxon
follows suit. So it depends which version you're using. For 8.3 it's
http://www.w3.org/2005/02/xpath-datatypes

The simplest way to get a 100% reliable answer is to look in the source code
for net.sf.saxon.om.NamespaceConstant.

Or try this query:

java net.sf.saxon.Query -t "{<a
xmlns:j='java:net.sf.saxon.om.NamespaceConstant'>{j:XDT()}</a>}"

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

> 
> ---  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(TransformerHan
> dlerImpl.java:121)
>     at 
> org.apache.xerces.parsers.AbstractSAXParser.endDocument(Unknow
> n Source)
>     at 
> org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknow
> n 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$TrailingMiscDisp
> atcher.dispatch(Unknown
> Source)
>     at 
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocu
> ment(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!

Current Thread