<!-- Integer compare -->
<xsl:function name="d:int-cmp" as="xs:boolean">
<xsl:param name="n1" as="xs:integer"/>
<xsl:param name="n2" as="xs:integer"/>
<xsl:choose>
<xsl:when test="$n1 = $n2">
<xsl:value-of select="true()"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="false()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:function>
Out of interest, why would you want to use a function... what does
d:int-cmp($int1, $int2) give you over "$int1 eq $int2" ?
That aside, it's also worth using xsl:sequence rather than value-of to
return an atomic, to avoid the text node creation and atomisation.
And the choose can be compacted down to xsl:sequence select="$n1 eq
$n2".
--
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/
--~------------------------------------------------------------------
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>
--~--