[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Find/replace algorithm

Subject: Re: Find/replace algorithm
From: "rick@xxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 25 Mar 2021 16:28:33 -0000
Re:  Find/replace algorithm
Thank you Michael. I like the idea of keeping the processing cost constant
but I was going to use regular expressions in my map, so I may still have to
loop through the lookup structure.

 

From: Michael Kay mike@xxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> 
Sent: Wednesday, March 24, 2021 7:48 PM
To: xsl-list <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re:  Find/replace algorithm

 

My instinct would be 

 

(a) build a map containing the replacements

 

(b) for each text node, tokenize the content, then scan the tokens looking
each one up in the map.

 

The big advantage of this approach is that the cost is constant regardless
how many substitutions there are, whereas most other approaches have a cost
that increases linearly with the number of substitutions.

 

Michael Kay

Saxonica

EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/612310>  (by
email <> ) 

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.