RE: [xsl] XSLT 2.0 function - fastest node comparison

Subject: RE: [xsl] XSLT 2.0 function - fastest node comparison
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 10 Mar 2005 16:21:12 -0000
> Interestingly, using 'cast as' on $middle to narrow it to an integer
> causes the execution time to increase by 250ms, so I've left 
> them all as
> doubles (the positional predicate in $currentNode doesn't 
> appear to mind
> using a double).  

That makes me realise that it would actually avoid many string->number
conversions if you extracted the ranges as two sequences of integers in
global variables:

<xsl:variable name="lows" select="$ranges/*/@from/xs:integer(.)"
<xsl:variable name="highs" select="$ranges/*/@to/xs:integer(.)"
<xsl:variable name="n" select="count($lows)" as="xs:integer"/>

test="some $i in 1 to $n satisfies ($highs[$i] ge $test and $lows[$i] le

Michael Kay

Current Thread