You might be able to achieve this but there certainly isn't an API designed for the purpose: library modules are designed to be used only in conjunction with a main module. I may at some stage support independent compilation of modules, but there's a fair bit of work needed to achieve that.
 
You might care to look at the code for SaxonImportQuery, which makes query library modules available for calling from XSLT. This might suggest further possibilities. It does assume, though, that an Executable already exists. The Executable contains all the code for a stylesheet or query, that is, all the modules collected together.
 
Michael Kay
http://www.saxonica.com/


From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of Premal Desai
Sent: 09 October 2005 22:02
To: saxon-help@lists.sourceforge.net
Subject: [saxon] Is there a visible SAXOn API to load Library modules

I am trying to write a piece of java code that can load xquery library modules, parse it to retrieve function defintions and validate the same library modules. But I am facing issues with the Saxon library. The methods provided by Saxon are invisible (protected/package access). See description below.
 
Any help will be highly appreciated
 
I am looking for API in the SAXON 851 package that can help me do the following:
1. Load a library module - This is so that I can determine the number of functions, obtain the function finger print etc.
There is method
protected StaticQueryContext loadModule(java.lang.String namespaceURI,
                                        java.lang.String locationURI,
                                        int firstGlobalSlot)
                                 throws XPathException.Static
 
BUT  this method is protected and hence, invisible  at compile time.
 
 
2. Validate a library module while i load it -
I found a class in the saxon package called QueryParser() under net.sf.saxon.Query that has a method  parseLibraryModule(java.lang.String queryString, StaticQueryContext env, int firstSlot) but this is NOT visible as the class is visible to the package only (although the parseLibraryModule is a public method). Hence, i get a compile time error when i attempt to access it.


Yahoo! Music Unlimited - Access over 1 million songs. Try it free.