OK, I've installed 8.7.1 and I've solved the issue. Here is what I've got.
First the namespace issues:
"ck" is bound to a URL I own (xmlns:ck="http://www.surreylane.net").
"xs" is bound as you would expect (xmlns:xs="http://www.w3.org/2001/XMLSchema")
Both are in my opening stylesheet tag to give them scope over the whole
stylesheet.
I munged the original parameter with substring() and concat() into the format
"YYYY-MM-DD" as is required by xs:date (e.g., "2006-05-18") so that it is
correct when I pass it to the function.
The function:
<xsl:function name="ck:subtract-a-day" as="xs:string">
<xsl:param name="input-date" as="xs:string" />
<xsl:sequence select="xs:string(xs:date($input-date) -
xs:dayTimeDuration('P1D'))" />
</xsl:function>
I don't know what you call the string 'P1D', but in the original example given
by Mike Kay, the string read 'PT1D' and Saxon complained about it. I put on my
thinking cap (i.e., I made an educated guess as I couldn't figure out how to
Google for what to call the thing and then my internet connection went down
four about a half-hour.) and came up with 'P1D', which worked.
Thanks to all who contributed. I think I'm going to like XSLT 2.0.
--
Charles Knell
cknell(_at_)onebox(_dot_)com - email
-----Original Message-----
From: cknell(_at_)onebox(_dot_)com
Sent: Thu, 18 May 2006 11:13:39 -0400
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: Re: [xsl] XSLT 2.0/XPath 2.0 Date arithmetic
My copy reports itself to be 8.7J. I'll look for a later version, thanks.
--
Charles Knell
cknell(_at_)onebox(_dot_)com - email
-----Original Message-----
From: David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk>
Sent: Thu, 18 May 2006 16:06:33 +0100
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] XSLT 2.0/XPath 2.0 Date arithmetic
What am I missing? Thanks for your help.
in the public drafts dayTimeDuration is in Xquery's own xdt namespace
(the URI for which depends on exactly which draft you look at)
a bug entry in bugzilla confirms that this is finally going to move to
the schema namespace and I think saxon implements that from 8.7.1
onwards. Do you have an older implementation?
David
--~------------------------------------------------------------------
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>
--~--