Pragya,
If you want full phrase matches where longest string match wins then you will
probably want to sort each term in length order and iterate over each phrase or
word and highlight like noted except with may just constructed elements. But
he order in which you execute them will be the difference. So if you highlight
terms longest to shortest then you have better chance to match longer terms
over shorter terms.
In your highlight function you may want to check if the node you are
highlighting has already been highlighted by looking at the cts:node variable
and stepping up the ancestor path like below.
if(fn:exists($cts:node/ancestor-or-self::html:span)) then
<html:span>{$cts:text}</html:span> else $cts:text
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general