XQuery (vs XPath ?)

I read articles about XQuery for some time now. In Oracle Magazine, Documentation Weblog but didn’t have time to read a real reference or big article.
In fact, I don’t like the syntax, the way it looks when you read the code, nor the procedural kind of programming, vs. “SQL like” or functionnal styles.
From the example in LEARN XQUERY IN 10 MINUTES (comments in TSS) by Michael Kay, I prefer the XPath version to the XQuery one. OK, they don’t do exactly the same, but I wouldn’t write XQuery longer than 10 or 15 lines.
To make things clear, this :
//video[actorRef=//actors/actor[ends-with(., 'Lisa')]/@id]/title
looks more obvious to me than
let $doc := .
for $v in $doc//video,
$a in $doc//actors/actor
where ends-with($a, 'Lisa')
and $v/actorRef = $a/@id
return $v/title

XQuery is great for accessing database, mixing documents, maybe to avoid too complex XPath expressions. Since there is an overlap between XQuery, XSLT and XPath, you have to do a mix that suits your needs and your taste.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: