[xsl] Re: Efficient dictionary lookup

Subject: [xsl] Re: Efficient dictionary lookup
From: Martin Holmes <mholmes@xxxxxxx>
Date: Thu, 22 Mar 2012 17:49:20 -0700
On 12-03-22 02:44 PM, David Carlisle wrote:
On 22/03/2012 21:39, Martin Holmes wrote:
 > HI all,
 > As part of a small pilot project, I'm implementing a set of spelling
 > normalization rules applied through XSLT 2.0 using Saxon 9. One
 > operation that happens extremely frequently is a dictionary lookup;

sounds like you want to use a key then the processor will almost certainly create an efficient lookup index.

If your dictionary is in a file say dict.xml


<xsl:key name="w" match="word" use="."/>

declares the index and


will return the word if it is in the dictionary.

That is much faster, indeed. It's still not fast -- the spellcheck dictionary is big -- but it's interesting to see that processing it as an XML structure with <xsl:key> is so much faster than processing it as a string.


Current Thread