xsl-list
[Top] [All Lists]

Re: [xsl] Does 'Lec?ur' occur in $text? Do you have a multi-fa ctor XPath solution?

2013-01-18 16:17:33
At 2013-01-18 22:12 +0000, Costello, Roger L. wrote:
I want to determine if 'Lec?ur' occurs in $text.

A naïve solution is this XPath expression:

      contains($text, 'Lec?ur')

However, that does not take into account many important factors:

1. Perhaps 'Lec?ur' occurs, but in $text it is in uppercase

Use lower-case() or upper-case() on both operands.

2. Perhaps instead of the '?' ligature, $text uses 'oe'

Use normalize-unicode() on both operands.

3. Perhaps in $text 'Lec?ur' is split over two lines and thus is hyphenated

Use translate() to remove any hyphens.

4. Perhaps 'Lec?ur' is slightly misspelled in $text and therefore requires fuzzy matching

I can't help you there, sorry.

And there are many other important factors.

Not sure what you are thinking of there.

Do you have an XPath solution to this problem that takes into account the many important factors?

A nested combination of the above function calls. Left as an exercise for the reader.

I hope this helps.

. . . . . . . Ken


--
Contact us for world-wide XML consulting and instructor-led training
Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm
Crane Softwrights Ltd.            http://www.CraneSoftwrights.com/s/
G. Ken Holman                   mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Google+ profile: https://plus.google.com/116832879756988317389/about
Legal business disclaimers:    http://www.CraneSoftwrights.com/legal


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--