Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Saxon and XQuery : how not to repeat the XML source file name in the query ?

Reply
Thread Tools

Saxon and XQuery : how not to repeat the XML source file name in the query ?

 
 
pepin_labulle@yahoo.fr
Guest
Posts: n/a
 
      07-04-2005
I'm a newbie with XQuery and I'm trying to execute a query with Saxon.
If I don't specify the XML source file name in the query, Saxon raises
the following error :
javax.xml.transform.Transforme*rException: Finding root of tree: the
context item is not set
Even if I specified the source file name in the command line.

Here is the command line I used :
java -cp saxon8.jar net.sf.saxon.Query -s books.xml books.xq

where books.xq =

xquery version "1.0";
for $b in //BOOKS/ITEM
order by string-length($b/TITLE) return
<book>
<author> { $b/AUTHOR } </author>
<title> { $b/TITLE } </title>
</book>

I can avoid the error by using this line in the query :
for $b in doc("books.xml")//BOOKS/ITEM

But, I don't want to repeat the file name in the query. I'd like to use
the same query whatever the file name is.
Is it possible ?

Actually, Saxon behaves the same in command line or called from a java
program.
I used a utility called bumblebee to test my query with different
XQuery processors, and i get the same result with Qizx.

Thank you and excuse my english.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
obtain element name, or attribute and value of the document name itself, and some elemnts and attributes from an ancestor or the node itself using xquery Jeff Kish XML 4 10-30-2008 05:47 PM
XQuery ( XML Query ) FBS XML 1 06-08-2005 01:56 PM
[ANN] Stylus Studio 6 Adds new Support for XSLT 2.0, XPath 2.0, XQuery,XML Schema, Legacy Data Integration and XML Mapping Stylus Studio XML 0 10-05-2004 06:17 PM
ANN: Stylus Studio 5 XML IDE Adds XQuery Development Support for Saxon 7 Stylus Studio XML 0 07-21-2004 07:47 PM
XQuery APIs -- how do you identify the XML source Benjamin G. Jones XML 0 01-08-2004 05:39 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57