Alexander Schatten wrote:
I want to be able to write an XSL Stylesheet that directly accesses Xindice Database to get data for transformation instead of accessing an XML document.
Yes, I understand that.
This is similar to the "document" XPath function. So I think a Xalan extension is definitly necessary.
Right. What I was saying is that a Xalan extension function *isn't* necessary. If you write a Xindice URIResolver, you can access document stored in Xindice using document() from within your stylesheet.
As it's name implies, URIResolver takes a URI (eg: "file:///foo/bar.xml") and resolves it to an XML document. An instance of a URIResolver is invoked by an XSLT transformer, such as Xalan, whenever you use document() in an XPath, or whenever you use an XSL import or include element in your stylesheet. Most transformers come with default URIResolver implementations which understand "file://" and maybe "http://" and "ftp://" URIs, but the javax.xml.transform APIs allow you to write your own.
So, what you want to do is write a URIResolver which understands, for example, "xindice://" URIs. When it is invoked with such a URI, it contacts the Xindice server and retreives the XML document. Then, in your stylesheet, you use the "xindice://" URI somewhere, eg:
<xsl:variable name="baz" select="document('xindice:///foo/bar.xml')"/>And assuming you told the transformer about your new URIResolver implementation, when the transformer processes your stylesheet, it will invoke your URIResolver and the XML document will be retreived for use in the transformation.
Take a look at the javax.xml.transform APIs (Javadoc for them are included with modern versions of Xalan), they are quite useful.
Mike.
-- Mike Gratton <[EMAIL PROTECTED]> "Every motive escalate." Blatant self-promotion: <http://web.vee.net/>
