Subject: RE: XSLT function optimization - datetime comparisons?
From: cknell@xxxxxxxxxx
Date: Wed, 21 Sep 2005 16:38:25 -0400
|
xsl:function doesn't exist in XSLT 1.0, but it does exist in XSLT 2.0. Xalan is a version 1.0 processor, while Saxon 8.x is a version 2.0 processor. That's why it works with Saxon but not with Xalan.
===================================================================
I'm using Saxon - I found that Xalan (2.7) just couldn't do this sort of thing for reasons I don't understand to this day.
<xsl:function name="my:compDate" as="xs:boolean">
<xsl:param name="dt_a" as="xs:string" />
<xsl:param name="dt_b" as="xs:string" />
<xsl:choose>
<xsl:when test="
xs:integer(translate(translate(translate($dt_a,'-',''),'T',''),':','')) gt xs:integer(translate(translate(translate($dt_b,'-',''),'T',''),':',''))">
<xsl:copy-of select="true()"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="false()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:function>
--
Charles Knell
cknell@xxxxxxxxxx - email
|