xsl-list
[Top] [All Lists]

Re: Executing SQL queries - XSLT ?

2004-02-28 05:49:55
Manish Rambabu wrote:
Hi All,

I have an application written in Java which accepts an XML file (data) as input transforms it using a XSL file. I am using Xalan as my parser to do the transformation. As part of the transforming logic I am grouping the data and also performing some basic math operations to result in sub-totals for each of the grouping categories. Is it possible to execute SQL queries from the XSL file against a database so I can store these values in a table?

I have taken a look at Oracle's xsql utility and standalone (command line/ servlet) Im able to fire select/insert queries using the tool. Is it possible to do this programmatically while performing the transformation.


Dunno about _during_ the transformation. If you have a DOM in memory with the results in it that you want to insert in the db you can use
something like:


import oracle.xml.xsql.*;
.....
            URL xsqlsheetURL = this.getClass().getResource(xsqlFile);
            // build an xsql request using it
            XSQLRequest req = new XSQLRequest(xcmf, xsqlsheetURL);
            req.setPostedDocument(rows);
            // invoke xsql
            Document res = req.processToXML();


The problems with this are:
1) it is Oracle only - and they keep changing the spec
2) I don't think it works if you use a DOM produced
by a parser other than oracle's to produce 'rows' above.

However it works for me.

(Blush, my first posting to this list, and it's Off Topic....)


Any help is greatly appreciated.
Thanks much
M




XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>