| Newsgroups |
gmane.text.xml.xsl.general.mulberrytech |
| Message-ID |
<[email protected]> |
--000000000000c1f8a705be4e8748
Content-Type: text/plain; charset="UTF-8"
I know this is xsl-list but have you considered
$ sed -e 's/\bWid\b/Widget/g' -e 's/\bAssbly\b/Assembly/g' -e
's/\bEng\b/Engine/g' zz1.xml
<?xml version="1.0" encoding="UTF-8"?>
<products>
<product>ACME Widget Assembly</product>
<product>Ford Engine Rebuild Kit</product>
</products>
On Wed, 24 Mar 2021 at 20:28, [email protected] <
[email protected]> wrote:
> Hello All,
>
>
>
> I have a fairly large XML file similar to this:
>
>
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <products>
>
> <product>ACME Wid Assbly</product>
>
> <product>Ford Eng Rebuild Kit</product>
>
> </products>
>
>
>
> I want to do an identity transform except that I want to do some find and
> replace on some of the words. For example
>
>
>
> Wid = Widget
>
> Assbly = Assembly
>
> Eng = Engine
>
>
>
> I am thinking of creating a lookup XML file to drive the find/replace
> actions:
>
>
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <lookup>
>
> <entry find="\bWid\b" replace="Widget"/>
>
> <entry find="\bAssbly\b" replace="Assembly"/>
>
> <entry find="\bEng\b" replace="Engine"/>
>
> </lookup>
>
>
>
> I am having trouble figuring out a good XSLT 2 or 3 algorithm for actually
> doing the replacements. Any suggestions or pointers would be appreciated.
> Thank you very much.
>
>
>
> Rick
>
>
>
> Rick Quatro
>
> Carmen Publishing Inc.
>
> 585-729-6746
>
> [email protected]
>
> http://www.frameexpert.com/store
>
>
>
>
> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/2739265> (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]
--~--
--000000000000c1f8a705be4e8748
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>I know this is xsl-list but have you considered</div>=
<div><br></div><div>$ sed -e 's/\bWid\b/Widget/g' -e 's/\bAssbl=
y\b/Assembly/g' -e 's/\bEng\b/Engine/g' zz1.xml<br><?xml ver=
sion=3D"1.0" encoding=3D"UTF-8"?><br><br><product=
s><br><br>=C2=A0 =C2=A0 <product>ACME Widget Assembly</product&=
gt;<br><br>=C2=A0 =C2=A0 <product>Ford Engine Rebuild Kit</product=
><br><br></products></div></div><br><div class=3D"gmail_quote"><di=
v dir=3D"ltr" class=3D"gmail_attr">On Wed, 24 Mar 2021 at 20:28, <a href=3D=
"mailto:[email protected]">[email protected]</a> <<a href=3D"mailto:=
[email protected]">[email protected]=
h.com</a>> wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"ma=
rgin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:=
1ex"><div style=3D"overflow-wrap: break-word;" lang=3D"EN-US"><div class=3D=
"gmail-m_8054368320538244912WordSection1"><p class=3D"MsoNormal">Hello All,=
<u></u><u></u></p><p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p><p class=
=3D"MsoNormal">I have a fairly large XML file similar to this:<u></u><u></u=
></p><p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p><p class=3D"MsoNormal">=
<?xml version=3D"1.0" encoding=3D"UTF-8"?><u></u>=
<u></u></p><p class=3D"MsoNormal"><products><u></u><u></u></p><p clas=
s=3D"MsoNormal">=C2=A0=C2=A0=C2=A0 <product>ACME Wid Assbly</produ=
ct><u></u><u></u></p><p class=3D"MsoNormal">=C2=A0=C2=A0=C2=A0 <produ=
ct>Ford Eng Rebuild Kit</product><u></u><u></u></p><p class=3D"Mso=
Normal"></products><u></u><u></u></p><p class=3D"MsoNormal"><u></u>=
=C2=A0<u></u></p><p class=3D"MsoNormal">I want to do an identity transform =
except that I want to do some find and replace on some of the words. For ex=
ample<u></u><u></u></p><p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p><p cl=
ass=3D"MsoNormal">Wid =3D Widget<u></u><u></u></p><p class=3D"MsoNormal">As=
sbly =3D Assembly<u></u><u></u></p><p class=3D"MsoNormal">Eng =3D Engine<u>=
</u><u></u></p><p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p><p class=3D"M=
soNormal">I am thinking of creating a lookup XML file to drive the find/rep=
lace actions:<u></u><u></u></p><p class=3D"MsoNormal"><u></u>=C2=A0<u></u><=
/p><p class=3D"MsoNormal"><?xml version=3D"1.0" encoding=3D&qu=
ot;UTF-8"?><u></u><u></u></p><p class=3D"MsoNormal"><lookup><=
u></u><u></u></p><p class=3D"MsoNormal">=C2=A0=C2=A0=C2=A0 <entry find=
=3D"\bWid\b" replace=3D"Widget"/><u></u><u></u></p><=
p class=3D"MsoNormal">=C2=A0=C2=A0=C2=A0 <entry find=3D"\bAssbly\b&=
quot; replace=3D"Assembly"/><u></u><u></u></p><p class=3D"MsoN=
ormal">=C2=A0=C2=A0=C2=A0 <entry find=3D"\bEng\b" replace=3D&q=
uot;Engine"/><u></u><u></u></p><p class=3D"MsoNormal"></lookup&g=
t;<u></u><u></u></p><p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p><p class=
=3D"MsoNormal">I am having trouble figuring out a good XSLT 2 or 3 algorith=
m for actually doing the replacements. Any suggestions or pointers would be=
appreciated. Thank you very much.<u></u><u></u></p><p class=3D"MsoNormal">=
<u></u>=C2=A0<u></u></p><p class=3D"MsoNormal">Rick<u></u><u></u></p><p cla=
ss=3D"MsoNormal"><u></u>=C2=A0<u></u></p><p class=3D"MsoNormal">Rick Quatro=
<u></u><u></u></p><p class=3D"MsoNormal">Carmen Publishing Inc.<u></u><u></=
u></p><p class=3D"MsoNormal">585-729-6746<u></u><u></u></p><p class=3D"MsoN=
ormal"><a href=3D"mailto:[email protected]" target=3D"_blank">rick@frame=
expert.com</a><u></u><u></u></p><p class=3D"MsoNormal"><a href=3D"http://ww=
w.frameexpert.com/store" target=3D"_blank">http://www.frameexpert.com/store=
</a><u></u><u></u></p><p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p><p cla=
ss=3D"MsoNormal"><u></u>=C2=A0<u></u></p></div></div>
<div>
<div style=3D"border-top:1px solid black;background-color:rgb(221,221,221);=
color:rgb(136,136,136);font-size:smaller;padding:5px;text-align:center;font=
-family:arial,verdana,arial,sans-serif;clear:both;margin:auto">
<a href=3D"http://www.mulberrytech.com/xsl/xsl-list" target=3D"_blank">
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-lis=
t/2739265" target=3D"_blank">EasyUnsubscribe</a>
(<a style=3D"color:blue" href=3D"" target=3D"_blank">by email</a>)
</div>
</div>
</div>
</blockquote></div>
<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>
--000000000000c1f8a705be4e8748--