[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Find/replace algorithm

Subject: Re: Find/replace algorithm
From: "Paul Tyson phtyson@xxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 25 Mar 2021 03:03:27 -0000
Re:  Find/replace algorithm
Is it coincidence that your examples are all approximate string matches? 
If not, an alternate multi-stage approach might be to check all 
non-words for approximate match to target list, followed by find and 
replace operation. Open-source libraries are available for approximate 
string matching.

https://en.wikipedia.org/wiki/Approximate_string_matching

Regards,

--Paul

On 3/24/21 3:28 PM, rick@xxxxxxxxxxxxxx wrote:
>
> Hello All,
>
> I have a fairly large XML file similar to this:
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <products>
>
> o?=o?=o?= <product>ACME Wid Assbly</product>
>
> o?=o?=o?= <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>
>
> o?=o?=o?= <entry find="\bWid\b" replace="Widget"/>
>
> o?=o?=o?= <entry find="\bAssbly\b" replace="Assembly"/>
>
> o?=o?=o?= <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 <mailto:rick@xxxxxxxxxxxxxxx>
>
> http://www.frameexpert.com/store <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/1043515> 
> (by email <>)

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.