Hello everyone,

 

I'm running into a problem that I'm having a brain freeze on, and I
could use some help thinking through this one:

 

How can I display the text in its original form when dealing with nested
nodes?

Some Background: These results are shown as results in a search engine
which are shown to the users.

 

XML node from /kn:object/kn:content/kn:page:

<Lookup gate:gateId="1982" majorType="organisation"
minorType="company"><Company gate:gateId="2518" rule="Preprocess5"><Keys
gate:gateId="2542">JBS</Keys></Company></Lookup> are the <Keys
gate:gateId="2543">initials</Keys> of a <Lookup gate:gateId="1983"
majorType="country_adj"><Keys
gate:gateId="2544">Brazilian</Keys></Lookup><Keys
gate:gateId="2545">man</Keys> in a <Keys
gate:gateId="2546">hurry</Keys>.  <Lookup gate:gateId="1984"
majorType="organisation" minorType="company"><Company gate:gateId="2519"
rule="Preprocess5"><Keys
gate:gateId="2547">JBS</Keys></Company></Lookup>, the <Lookup
gate:gateId="1985" majorType="tags"
minorType="topPoultryAndSwineCompaniesTags">company</Lookup>, sprang
from obscurity to become the world   s largest <Lookup
gate:gateId="1986" majorType="tags" minorType="foodTags"><Lookup
gate:gateId="1987" majorType="indust" minorType="foodIndust"><Lookup
gate:gateId="1988" majorType="indust"
minorType="meatIndust">meat</Lookup></Lookup></Lookup><Lookup
gate:gateId="1989" majorType="tags"
minorType="topPoultryAndSwineCompaniesTags">company</Lookup> in just the
<Date gate:gateId="2400" rule1="ModifierDate" kind="date"
rule2="DateOnlyFinal"><Lookup gate:gateId="1990"
majorType="time_modifier">last</Lookup><Lookup gate:gateId="1991"
majorType="time" minorType="hour"><Lookup gate:gateId="1992"
majorType="number">five</Lookup></Lookup><Lookup gate:gateId="1993"
majorType="date_unit">years</Lookup></Date>.

 

 

The xquery used:

fn:normalize-space(data(doc()[1]/kn:object/kn:content//kn:page))

 

The sentence generated:

"JBS are the initials of a Brazilianman in a hurry. JBS, the company,
sprang from obscurity to become the world s largest meatcompany in just
the lastfiveyears."

 

The sentence should be:

"JBS are the initials of a Brazilian man in a hurry. JBS, the company,
sprang from obscurity to become the world s largest meat company in just
the last five years."

 

 

The spaces seem not to be respected in a nested node in the case of
further enrichment on a node, and I'm trying to find the best way to
approach this problem.

 

We are using java to enrich this document inside the marklogic system
too, so we are willing to use any tools that could help in this area
(JAXP,etc)

 

How can I achieve the above sentence in the way that I want when nested
nodes are involved and spaces are not kept?

How can I enforce spaces on nodes inside of nested nodes?

 

I've tried adding a space after the opening tag and before the enriched
words (<company> JBS</company>), but that messed up the element ranges
in the Marklogic database (extra spaces made it hard to find values upon
exact matches).

 

 

Any ideas are appreciated!

Thanks

Dj

_______________________________________________
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to