473,614 Members | 2,328 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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.trans form.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.Qu ery -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.

Jul 20 '05 #1
0 1522

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2408
by: Johannes Busse | last post by:
Hello NG, I'm struggling with the following problem. I think can be solved quite easily (in fact it should be a FAQ), but it seems that I cannot solve it myself :-( my source looks like this: <?xml version="1.0" encoding="utf-8"?>
0
2168
by: Tony Lavinio | last post by:
Dear Stylus Studio Friends, The new year is scarcely one month old, but we already have lots to report! For starters, there's Stylus Studio 6 Release 2. The latest release of Stylus Studio boasts literally hundreds of product enhancements, and is available now for free trial download. We're also proud to present our interview with Dr. Daniela Florescu, editor of the XQuery specification. Read this month's Stylus Scoop and learn about...
0
2295
by: Stylus Studio | last post by:
DataDirect XQuery(TM) is the First Embeddable Component for XQuery That is Modeled after the XQuery API for Java(TM) (XQJ) BEDFORD, Mass.--Sept. 20, 2005--DataDirect Technologies (http://www.datadirect.com), the software industry leader in standards-based components for connecting applications to data and an operating unit of Progress Software Corporation, today announced the release of DataDirect XQuery(TM), the first embeddable...
1
1637
by: exemell.com user | last post by:
Does anyone know of any good resources with examples showing how to implement SAXON.NET's XQuery? Thanks Wole Posted at http://www.exemell.com/
2
1746
by: BK | last post by:
I am working on system that will have a cataloging component which would essentially be a Folder/File structure. So far I have coded the Iteration over a selected folder and am displaying the data/structure in a TreeView (VB.NET 2005). I then serialize the Treeview and store the serialized XML in a SQL 2005 XML Column. I can also retrieve an entire XML (one record, that is) and (re) rebuild the TreeView by de-serializing. Never...
5
3408
by: jhurrell | last post by:
I have been having some trouble getting my XSL style sheet to parse correctly. I have some XML outputted from an SQL-Server, that I then need to turn into multiple HTML files. This I have done with moderate success using Saxon and <xsl:result-document>, but Saxon is throwing an error and I don't know how to resolve it. Maybe someone can offer some advice? This is a long question, for which I apologise... OS= Windows XP Pro, Saxon=8.8 XML...
8
4043
by: ismailj | last post by:
Hi, I'm using Weblogic 9.2 which uses Saxon 8.1.1 as its XQuery Engine. I'm using max function and in the argument I'm passing the node which has two dateTime values. It is giving exception. Following is part of my XML Document: <effectiveTime value="2007-03-20T18:10:15"/> Following is part of my XQuery:
4
1877
by: ismailj | last post by:
Hi, I'm using Saxon v8.9 for XQuery execution. I'm using following code: XQDataSource ds = new SaxonXQDataSource(); XQConnection conn = ds.getConnection(); XQExpression exp = conn.createExpression(); XQResultSequence seq = exp.executeQuery(queryExpression); But, I can't attach XML Document to it. I want to know whether an XML Document on which XQuery is to be run can be attached to it...
0
1202
by: sudheerdb2 | last post by:
Hi, I am trying xml data processing using Xquery version 9.1 My xml file --------- <?xml version="1.0" ?> <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
0
8197
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8142
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8589
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7114
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5548
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4058
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4136
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2573
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1438
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.