[xquery-talk] Use Saxon Proccessor to Process XQuery

Alice Wei ajwei at indiana.edu
Fri Dec 28 11:37:41 PST 2007


  I wonder if there are any of you on this list use Saxon (Java) to 
process XQuery files. I currently process my XQuery files with a XML 
editor to parse the XQuery. Since I have external variables in
my files, I wonder if it is possible to generated it using the command prompt.

For my XQuery file, it calls the external file instead of a database, 
as shown in the following:

declare boundary-space preserve;
declare variable $text external;

for $project in doc("resume_2.xml")//projection,
$content in $project/descrip,
$title in $project/project_title,
$url in $project/link_2/extras_1/@url
    where contains($content, $text)
<extras_1 url="{data($url)}"/>

The query works, without a terminal prompt, that is. What I want to do 
is to call it with a command prompt so I can change my variable from 
case to case. According to Dr. Kay's article in Learn XQuery in 10 
minutes, the prompt is as follows:

  java net.sf.saxon.Query sample.xquery firstName=Lisa

I tried implementing it on my server, which my saxon8.jar file is on 
the same path as my to be parsed files, but the prompt result is as 

java saxon8.jar question_8.xquery text=SLIS
Exception in thread "main" java.lang.NoClassDefFoundError: saxon8/jar

I then added -jar to make the prompt look like:

java -jar saxon8.jar question_8.xquery text=SLIS
Stylesheet file text=SLIS does not exist

Is there something I did wrong?

Thanks for your help.

Alice Wei
MIS 2008
School of Library and Information Science
Indiana University Bloomington
ajwei at indiana.edu

More information about the talk mailing list