[xquery-talk] Use Saxon Proccessor to Process XQuery

Michael Kay mike at saxonica.com
Fri Dec 28 18:47:56 PST 2007


The default entry point in saxon8.jar (and indeed saxon9.jar) is the XSLT
processor, so if you use the -jar option then you need to supply parameters
for XSLT processing. For XQuery processing, use

java net.sf.saxon.Query sample.xquery text=SLIS 

This is documented at

http://www.saxonica.com/documentation/using-xquery/commandline.html

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: talk-bounces at x-query.com 
> [mailto:talk-bounces at x-query.com] On Behalf Of Alice Wei
> Sent: 28 December 2007 16:38
> To: talk at x-query.com
> Subject: [xquery-talk] Use Saxon Proccessor to Process XQuery
> 
> Hi,
> 
>   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;
> 
> <project>
> {
> 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)
> return
> <projection>
> <project_title>{data($title)}</project_title>
> <descrip>{data($content)}</descrip>
> <link_2>
> <extras_1 url="{data($url)}"/>
> </link_2>
> </projection>
> }
> </project>
> 
> 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
> follows:
> 
> 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
> 812-856-2659
> 
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk



More information about the talk mailing list