0

Is it possible in XSLT to search and find content, even though the content is misspelled or the words splitted up - even though it shouldn’t?

Example:

I need to find a webshop called bearshop.com, but I search it like this “bear shop”. This will end in a “no results”.

Another example:

I search “progresive” but the right word was “progressive”, and this will end in a “no result” as well.

The most important part is the first example, where the search can be written with or without white spaces and still find the content. Hope someone can help me or lead me in the right direction :)

Kind regards,

Niels

Niller2000
  • 51
  • 1
  • 9
  • If you could share an example of the kind of XML you want to search, and the output you expect from it, then it will be easier for people to offer ideas. Was your (mis)spelling of "wierd" ironic and deliberate? ;) – Ben L Oct 16 '13 at 15:49
  • Unfortunately it's my English which miss some of the colors and grammatical experience a native speaker have :) I try to give an example with an XML document. – Niller2000 Oct 17 '13 at 18:19
  • I convert the XML document to JSON, and let JavaScript solve my issues using fuse.js or list.js with the plugin fuzzy search. – Niller2000 Oct 17 '13 at 20:02

2 Answers2

0

Assuming XSLT/XPath 2.0 you can use //foo[matches(., 'bear\s*shop')].

Martin Honnen
  • 160,499
  • 6
  • 90
  • 110
0

If you are looking for a general way of matching similar words, this is often called fuzzy search and can quite easily be done with Umbraco and Examine.

There may even is a way to use this with XSLT, though I never tested that.

marapet
  • 54,856
  • 12
  • 170
  • 184
  • Hi Marapet, you actually gave me the push in the right direction with _fuzzy search_. I already taking the XML document and push through some javascript, and I looked into two JavaScript solutions: http://listjs.com/plugins/fuzzy-search and http://kiro.me/projects/fuse.html. It will actually solve both my problems with misspelling and split words. Thank you all for the help :) – Niller2000 Oct 17 '13 at 20:01