[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

External Variable on AltovaXML 2007

Gerald Sheehan gerald.sheehan at altova.com
Wed Aug 15 13:13:34 PDT 2007


  External Variable on AltovaXML 2007
Hi Timothy,

To solve the problem I'd use a tokenize on a external parameters list
XQuery:

<result>
{
for $a in tokenize($try, "\s+")
return
<erg>{document($a)/root/chil/text()}</erg>
}
</result>
	


Calling Code should use AddExternalVariable("try", "file1.xml file2.xml
file3.xml")



Best regards,

Jerry

... Jerry Sheehan
... Pre-Sales Engineer
... Altova, Inc.

Look into  www.altova.com today!



-----Original Message-----
From: http://x-query.com/mailman/listinfo/talk [mailto:http://x-query.com/mailman/listinfo/talk] On
Behalf Of Timothy Marc
Sent: 24 June 2007 15:27
To: http://x-query.com/mailman/listinfo/talk
Subject:  External Variable on AltovaXML 2007

Hello,
I want to pass an XML-String to the AltovaXML 2007 XQuery engine as
external variable. Inside of the xquery, i want to iterate over the
given variable with the for-expression. But, how do i convert the
external XML-String into a xml-document for processing? In saxon or
xalan it is possible to pass the external variables as InputSources, but
how should this be done in AltovaXML? Is there anyone, who had made some
experiences with AltovaXML? It seems to be quiet easy.

My Code looks like this:

IXQuery q = AltovaXMLFactory.getInstance().getXQueryInstance();
q.addExternalVariable("try", "<root><chil>Ich</chil></root>");
q.setOutputEncoding("UTF-8"); q.setXQueryFileName("d:\\test.xq");
String resultString = q.executeAndGetResultAsString(); if (resultString
== null ) { System.out.println("XQuery error : "
+ q.getLastErrorMessage());
}
else{
System.out.println("Transform contents>>" + resultString ); }

My XQuery like this:
declare variable $try external;
<result>
{
for $a in $try
return
<erg>{$a/root/chil/text()}</erg>
}
</result>

Thx in advance.
Timothy
_______________________________________________
http://x-query.com/mailman/listinfo/talk
http://x-query.com/mailman/listinfo/talk




PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Cast Your Vote

We need your help – Vote for DataDirect XML Products!

  • Best SOA or XML site

Winners and finalists announced at SOA World Conference in November.

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.