Re: [xsl] Stylesheet Optimization -- How to Make It Faster

Subject: Re: [xsl] Stylesheet Optimization -- How to Make It Faster
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 28 Nov 2006 14:04:27 GMT
I think you are doing 


on every element of $abbreviations twice for each text node in teh
document, once in the match pattern to see if it matches, and once again
if it does match to build search-str (saxon may optimise away some of
the repeated, code, you never can tell:-)

But anyway you could, when building   <xsl:variable name="abbreviations"
stick the escaped, concatenated regexp into an attribute on the element
somewhere so that you didn't to do this each time.

You are building up a big regexp of the form
and then if it matches looping through all the regex-group() to see
which has a non empty match, I don't think you need to do that, just
use the key that represents the replacement, and look up the replacement
by name not by number

something like
    <xsl:analyze-string select="$input" regex="{$regex}">
      <xsl:sequence select="key('abbrev',.,$abbreviations)"/>


Current Thread