Hi,

I am trying to bind the string as you suggested with

expr.bindString(new QName("labelLinkUri"),
"file:///c:/Users/A/Documents/
Sweta..../xyz.xml", null).

But it is not accepting null as XQItemType parameter.
Please tell where I am going wrong.

Thanks.
With Regards
Sweta





Message: 3
Date: Thu, 11 Feb 2010 08:37:45 -0000
From: "Michael Kay" <mike@saxonica.com>
Subject: Re: [saxon] How can I dynamically pass filename to xquery
       Files.
To: "'Mailing list for the SAXON XSLT and XQuery processor'"
       <saxon-help@lists.sourceforge.net>
Message-ID: <
112FDF0C698A41F1AB95CDE008B5C10B@Sealion>
Content-Type: text/plain; charset="us-ascii"

You can declare an external variable in your query like this:

declare variable $labelLinkUri as xs:string external;

You can then reference the variable like this:

let $x := doc($labelLinkUri) return ...

And then you can bind a value to the variable in your XQJ application code
as:

expr.bindString(new QName("labelLinkUri"),
"file:///c:/Users/A/Documents/Sweta..../xyz.xml", null)

Note that XQuery expects to deal with URIs, not file names.

Regards,

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




Message: 2
Date: Thu, 11 Feb 2010 10:42:34 +0530
From: Sweta Kedia <swetakedia@gmail.com>
Subject: [saxon] How can I dynamically pass filename to xquery Files.
To: saxon-help@lists.sourceforge.net
Message-ID:
       <5cd259e51002102112n1289fa4cpcc6af77e9c34de6f@mail.gmail.com
>
Content-Type: text/plain; charset="iso-8859-1"

Hi,

I have a separate xquery file which I am calling through java as follows:

rule2= new
FileInputStream("C:/Users/A/workspace/Validator/xqFiles/Rule2.xq");
 SaxonXQPreparedExpression expr = (SaxonXQPreparedExpression)
con.prepareExpression(rule2);

 In Rule2.xq I have some filepaths as:


let
$labelLinkFile:="C:/Users/A/Documents/Sweta/users/sweta231119791251796126671/Other/2008/Quarterly/2nd
Quarterly/bvf-20081231/bvf-20081231_lab.xml"
let $x:=
fn:doc("C:/Users/A/Documents/Sweta/users/sweta231119791251796126671/Other/2008/Quarterly/2nd
Quarterly/bvf-20081231/bvf-20081231.xml")//*[@contextRef and @unitRef]
let $pre:=
fn:doc("C:/Users/A/Documents/Sweta/users/sweta231119791251796126671/Other/2008/Quarterly/2nd
Quarterly/bvf-20081231/bvf-20081231_pre.xml")/linkbase/presentationLink

I want that these filepath should be dynamically passed through java.
Please tell me how can this be done.

With Regards

Sweta.
-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------