kwic-display working?

View: New views
1 Messages — Rating Filter:   Alert me  

kwic-display working?

by Bill Beck-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hello,

I dug up and old post of W. Meier's that shows an example of
Kwic-display. I've worked that into my own example, and it does indeed
return the surrounding text for matches from the near() function. But it
is leaving out the actual matched term! Weird. Here's my code (trimmed
to show the essentials):


declare option exist:serialize "highlight-matches=elements";

declare function local:wrapHi($matchS as xs:string, $node as node(),
$thing as item()*) as xs:string {
        <b style="background: yellow">{$matchS}</b>
};

let $phrase := "country"
let $callback := util:function("local:wrapHi", 3)

for $doc  in //*[@type="docbody"][near(.,$phrase)]
return  <div>{text:kwic-display($doc//text(), 80, $callback, ()
)}<hr/></div>


Am I missing something? The documentation does explain why it is that
the callback function needs the node set if it is already simply being
passed the string, so I wonder if the callback function needs to do more.

Cheers and thanks,

````````````````````````````````
     Bill Beck, Web Developer
Massachusetts Historical Society
        www.masshist.org
````````````````````````````````

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open