xsl-list
[Top] [All Lists]

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

2006-11-28 07:04:47


I think you are doing 

concat('(^|\W)(',ati:escape(.),')($|\W)'))]

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
(aaa)|(bbb)|(ccc)
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:matching-substring>
      <xsl:sequence select="key('abbrev',.,$abbreviations)"/>
              </xsl:matching-substring>

David

--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>