ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> xsl-list
xsl-list
Re: [xsl] Stylesheet Optimization -- How to Make It Faster
by David Carlisle other posts by this author
Nov 28 2006 6:04AM messages near this date
RE: [xsl] Stylesheet Optimization -- How to Make It Faster | Re: [xsl] Stylesheet Optimization -- How to Make It Faster
& XSLT 

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@[...].com> 
--~--
Thread:
Jeff Sese
Michael Kay
David Carlisle
Jeff Sese

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved