eXist: kwic:summarize() and default namespaces
Posted by jamie on 10 May 2011 in Notes
If you want to use the KWIC module and specifically the kwic:summarize() function when performing full-text queries on your eXist databases, ensure that, if you have a default namespace declared, you negate that namespace in your <config> element:
declare default element namespace "http://www.tei-c.org/ns/1.0";
import module namespace kwic="http://exist-db.org/xquery/kwic";
for $result in collection('/db/francotoile/data')//tei:TEI/tei:text/tei:body[ft:query(.,"francophone")]
order by ft:score($result) descending
return
kwic:summarize($result, <config xmlns="" width="40"/>)
Note the xmlns="" attribute on the config element. Otherwise, kwic:summarize interprets the element as tei:config and throws an error.