| Newsgroups |
gmane.text.xml.xsl.general.mulberrytech |
| Message-ID |
<[email protected]> |
This is a multipart message in MIME format.
------=_NextPart_000_0326_01D72172.54745F20
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
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 [email protected]
<[email protected]>
Sent: Wednesday, March 24, 2021 7:48 PM
To: xsl-list <[email protected]>
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/3329386
or by email: [email protected]
--~--
------=_NextPart_000_0326_01D72172.54745F20
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40"><head><meta http-equiv=3DContent-Type content=
=3D"text/html; charset=3Dus-ascii"><meta name=3DGenerator content=3D"Micros=
oft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]--></head><body lang=3DEN-US link=3Dblue vli=
nk=3Dpurple style=3D'word-wrap:break-word'><div class=3DWordSection1><p cla=
ss=3DMsoNormal>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 m=
ay still have to loop through the lookup structure.<o:p></o:p></p><p class=
=3DMsoNormal><o:p> </o:p></p><div><div style=3D'border:none;border-top=
:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in'><p class=3DMsoNormal><b>Fro=
m:</b> Michael Kay [email protected] <[email protected]=
h.com> <br><b>Sent:</b> Wednesday, March 24, 2021 7:48 PM<br><b>To:</b> =
xsl-list <[email protected]><br><b>Subject:</b> Re: [xs=
l] Find/replace algorithm<o:p></o:p></p></div></div><p class=3DMsoNormal><o=
:p> </o:p></p><p class=3DMsoNormal>My instinct would be <o:p></o:=
p></p><div><p class=3DMsoNormal><o:p> </o:p></p></div><div><p class=3D=
MsoNormal>(a) build a map containing the replacements<o:p></o:p></p></div><=
div><p class=3DMsoNormal><o:p> </o:p></p></div><div><p class=3DMsoNorm=
al>(b) for each text node, tokenize the content, then scan the tokens looki=
ng each one up in the map.<o:p></o:p></p></div><div><p class=3DMsoNormal><o=
:p> </o:p></p></div><div><p class=3DMsoNormal>The big advantage of thi=
s approach is that the cost is constant regardless how many substitutions t=
here are, whereas most other approaches have a cost that increases linearly=
with the number of substitutions.<o:p></o:p></p></div><div><p class=3DMsoN=
ormal><o:p> </o:p></p></div><div><p class=3DMsoNormal>Michael Kay<o:p>=
</o:p></p></div><div><p class=3DMsoNormal>Saxonica<o:p></o:p></p></div><div=
><div style=3D'border:none;border-top:solid black 1.0pt;padding:4.0pt 0in 0=
in 0in;margin-top:5.0pt;margin-bottom:5.0pt'><p class=3DMsoNormal align=3Dc=
enter style=3D'text-align:center;background:#DDDDDD'><span style=3D'font-si=
ze:7.5pt;font-family:"Arial",sans-serif;color:#888888'><a href=3D"http://li=
sts.mulberrytech.com/unsub/xsl-list/612310">EasyUnsubscribe</a> (<a href=3D=
"">by email</a>) <o:p></o:p></span></p></div></div></div></body></html>
<div><!-- begin bl.html.trailer -->
<div style=3D"border-top:1px solid black; background-color: #dddddd;
color: #888888; font-size: smaller; padding: 5px; text-align: center;
font-family: arial,verdana,arial,sans-serif; margin-top:1em; clear:
both; margin: auto">
<a href=3D"http://www.mulberrytech.com/xsl/xsl-list">
XSL-List info and archive</a>
<div style=3D"text-align:center;">
<a style=3D"color: blue;"
href=3D"http://lists.mulberrytech.com/unsub/xsl-list/3329386"
>EasyUnsubscribe</a>
(<a style=3D"color: blue;"
href=3D"mailto:[email protected]?subject=3Dremove"
>by email</a>)
</div>
</div>
<!-- end bl.html.trailer --></div>
------=_NextPart_000_0326_01D72172.54745F20--