Subject:Xquery Author:nido abu Date:25 Oct 2005 06:46 AM
Hi
I have problem with the following xquery
<books>
{
for $d in //td[contains(b/a/text(),"The Year of Magical Thinking")]
for $row in $d/parent::tr/parent::tbody/tr
where contains($d/b/a/text(),"The Year of Magical Thinking")
return
<book>
<probe name= "{($row/td[3]/text())}"></probe>
<Author>{substring-before(($row/td[3]/text()),':')} </Author>
<booktitile>{data($row/td[3]/b/a)} </booktitile>
</book>
I became this error:
A sequence of more than one item is not allowed as the first argument of
substring-before().
Is here anybody who can help me
thanks a lot
Subject:Xquery Author:nido abu Date:26 Oct 2005 05:17 AM
I tried the following (without substring-before):
<books>
{
for $d in //td[contains(b/a/text(),"The Year of Magical Thinking")]
for $row in $d/parent::tr/parent::tbody/tr
where contains($d/b/a/text(),"The Year of Magical Thinking")
return
<book>
<booktitle>{data($row/td[3]/b/a)} </booktitle>
<Author>{($row/td[3]/text())} </Author>
</book>
}
</books>
the result was like this:
.
.
<book>
<booktitle>A Million Little Pieces </booktitle>
<Author>James Frey Average Customer Review</Author>
</book>
.
.
.
but what I realy need, only the name of the Author. so i thought that substring-before function will be helpful (all the text before 'Average')