What is wrong with my XQuery?

I just started learning about XQuery and am trying to play with it a little. Now, iv’e built what i think is a simple query and a correct one (a much as i can see) but SQL Manger prints me the error:
XQuery [query()]: “=” was expected.
I looked back at the code but i cant understand how to fix it… here is my code:

<book category="cooking">
<title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author>
<book category="children">
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>
<book category="web">
<title lang="en">XQuery Kick Start</title>
<author>James McGovern</author>
<author>Per Bothner</author>
<author>Kurt Cagle</author>
<author>James Linn</author>
<author>Vaidyanathan Nagarajan</author>
<book category="web" cover="paperback">
<title lang="en">Learning XML</title>
<author>Erik T. Ray</author>

SELECT @x.query('for $i in bookstore/book
    let $a := $i/author
    let $t := $i/title
    let $p := $i/price
    where $i/@price < 40
    <This is a test>
    </This is a test>')
AS [I hope this works]

thanks in advance :slight_smile:

well for starters, tags cant be multiple words…

Do you mean <This is a test>. This could be the tag and the other words can be valueless attributes. They’re not, but technically they could be. So I don’t think that’s what tripping up this query.

Oh i doubt it is too, but this statement:

is only true of the opening tag. You don’t put attributes in the closing tag :wink:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.