Hello! I am doing text retrieval and encountered the following problem:
The xml source has the following part:
<TEI.2>
.......
<p>
The Situation of this place which we Call
<hi rend="italic">Council Bluff</hi>
which is handsom ellevated a Spot well Calculated for a Tradeing establishment
</p>
.......
</TEI.2>
I used different approaches to retrieve the text “Call Council Bluff” . Xquery 1:
let $keyword := "Call Council Bluff"
for $d in input()/p//text()
let $ref := tf:createTextReference($d, $keyword)
for $refeach in $ref
return substring($d, $refeach/@ino:start, string-length($keyword))
From Xquery1 I get empty result, because “Call” and “Council Bluff” are contained in two text nodes and none of the two text nodes contain the keyword.
Second approach:
let $keyword := "Call Council Bluff"
for $d in input()/p
let $ref := tf:createTextReference($d, $keyword)
for $refeach in $ref
return substring($d//text(), $refeach/@ino:start, string-length($keyword))
From the second query, I got the following error:
Runtime type exception: sequence occurred where atomic value required.
I think it is because $d//text() is not atomic. So I tried the last Xquery:
let $keyword := "Call Council Bluff"
for $d in input()/p
let $ref := tf:createTextReference($d, $keyword)
for $refeach in $ref
for $a in $d//text()
return substring($a, $refeach/@ino:start, string-length($keyword))
Then I get empty result. What shall I do? I have been working on this for two weeks now!! BTW, from the second and third Xquery, I can get the correct reference descriptions (i.e., tf:createTextReference works).
thanks a lot.