Subject: Re: [xsl] Find/replace algorithm From: "David Carlisle d.p.carlisle@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Wed, 24 Mar 2021 20:56:29 -0000 |
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, rick@xxxxxxxxxxxxxx < xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> 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 > > rick@xxxxxxxxxxxxxxx > > 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 <>)
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Find/replace algorithm, Martin Honnen martin | Thread | Re: [xsl] Find/replace algorithm, Michael Kay mike@xxx |
Re: [xsl] Find/replace algorithm, Martin Honnen martin | Date | Re: [xsl] Find/replace algorithm, Michael Kay mike@xxx |
Month |