From: Martin H. <mh...@uv...> - 2011-10-20 22:40:14
|
For anyone else struggling with this bug, I was able to get text-highlighting to work by using namespaces in the CSS stylesheet: /* p tag in no namespace. */ |p{ display: block; margin-bottom: 0.75em; } /* span tag with class="hi" in any/no namespace. */ *|span[class=hi]{ background-color: #ccf; color: #000; } Still, it's annoying because my search results page is invalid. I'll probably have to use XSLT to re-process the results into the correct namespace. Cheers, Martin On 11-10-20 01:51 PM, Martin Holmes wrote: > Hi there, > > I'm using exist 1.5 15314 (yes, haven't had a chance to rebuild > recently), but I don't see any mention of this issue anywhere, so I > don't think it's been raised yet. > > I'm using Lucene to do searches with ft:query, and returning the results > using kwic:get-summary. This works well, except that it returns<p> and > <span> elements in no namespace. According to the documentation: > > "By default, kwic:summarize() returns an XHTML fragment with the > following structure:<p xmlns="http://www.w3.org/1999/xhtml"> ..." > > However, in the context of my XHTML output code, which is all in the > XHTML namespace, the results appear with an empty xmlns attribute: > > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> > [...] > <div class="searchResults"> > <p xmlns=""> > <span class="previous">... the church appears on the west side of > </span> > <span class="hi">Abchurch</span> > <span class="following"> Lane , about a third of the way up. I > ...</span> > </p> > </div> > [...] > </html> > > Can anyone suggest why the namespace is being undeclared in the result > coming back from kwic:summarize()? > > This is my function. xh is the XHTML namespace, and the default ns is TEI. > > > declare function local:getContent() as element()* > { > <xh:div class="searchResults"> > { > if (string-length($inc:search) gt 2) then > let $config :=<config xmlns="" width="40"/> > for $result in collection('/db/data/')//TEI[text[ft:query(., > $inc:search)]]/kwic:expand(.) > order by count($result//exist:match) descending > return > > ( > <xh:p><xh:a > href="{$result/@xml:id}.htm?searchTerm={$inc:search}">{$result/descendant::title[1]/text()}</xh:a></xh:p>, > <xh:div class="searchHit"> > { > for $m at $pos in $result//exist:match > return > kwic:get-summary($result, $m, $config, > util:function(xs:QName("local:filter"), 2)) > } > </xh:div> > ) > else > () > } > </xh:div> > }; > > All help appreciated, > Martin > > > ------------------------------------------------------------------------------ > The demand for IT networking professionals continues to grow, and the > demand for specialized networking skills is growing even more rapidly. > Take a complimentary Learning@Cisco Self-Assessment and learn > about Cisco certifications, training, and career opportunities. > http://p.sf.net/sfu/cisco-dev2dev |