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(_at_)saxonica(_dot_)com
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com>
Sent: Wednesday, March 24, 2021 7:48 PM
To: xsl-list <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
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 <> )
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--