Subject: Re: using EXSLT {RE: [xsl] date calculation from Excel 1900 Format} From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx> Date: Wed, 13 Jun 2001 10:10:59 +0100 |
Hi Xiaocun, > A. when import function-level packages: > <xsl:import href="date.add.xsl" /> > <xsl:import href="date.duration.xsl" /> > Run Saxon and got the error: > Error at func:script on line 5 of > file:/C:/test/date.add.xsl: > Unknown Saxon extension element > Transformation failed > The line it complains about is: > <func:script language="exslt:javascript" > implements-prefix="date" src="date.js"/> > > From Saxon's webpage, Saxon 6.3 supports only func:function and > func:result, therefore func:script is not recognized. Yes, Saxon seems to be very picky when it comes to top-level elements. Unfortunately, top-level elements like func:script or msxsl:script aren't counted as extension elements, so you can't use things like xsl:fallback within them to stop Saxon complaining. In my opinion, if Saxon doesn't recognise a top-level element, even if it's labelled as being in an extension namespace, then it should just ignore it. Either Mike has a different opinion, or it's a bug in Saxon ;) > B. when import just the functions: > <xsl:import href="date.add.function.xsl"/> > <xsl:import href="date.duration.function.xsl" /> > Try to use function <func:function name="date:add">, > run Saxon and got the error: > Error at xsl:value-of on line 24 of > file:/C:/test/test1.xsl: > javax.xml.transform.TransformerException: Cannot > write to result tree while executing a function: > Cannot write to result tree while executing a function > Transformation failed > The line it complains about is: > <xsl:value-of select="date:add('1900-01-01T00:00:00', > date:duration(37257.041667 * 60 *60 *24))"/> I don't know exactly what's causing that, but it will either be a bug in the implementation of one of the functions or a bug in the func:function implementation in Saxon. I'll take this up on the EXSLT list. > C. when import just the templates: > <xsl:import href="date.add.template.xsl"/> > <xsl:import href="date.duration.template.xsl" /> > Uses xsl:call-template and run Saxon, it works and > outputs "2002-01-03T01:00:00". Cool. Note, as I said, that the date is off by 2 days, because Excel starts the count at 1 and because it thinks that 1900 is a leap year. > The good news is I found a way that works. The questions I have > though is, how to get approach B to work? Come over to the EXSLT list (http://www.exslt.org/list) and we'll see if we can work out what's going wrong. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: using EXSLT {RE: [xsl] date cal, Xiaocun Xu | Thread | RE: [exslt] Re: using EXSLT {RE: [x, Michael Kay |
[xsl] XSLT Stylesheet for HTML elem, Alan Kennedy | Date | RE: [xsl] HTML in CDATA, Peter Flynn |
Month |