Re: [xsl] Find/replace algorithm

Subject: Re: [xsl] Find/replace algorithm
From: "rick@xxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 25 Mar 2021 16:28:33 -0000
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: [xsl] 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