RE: [xsl] Executing SQL queries - XSLT ?

Subject: RE: [xsl] Executing SQL queries - XSLT ?
From: Aitor San Juan <asanjuan@xxxxxxxxxxxxxx>
Date: Tue, 2 Mar 2004 08:53:42 +0100
There is a tutorial at
06&S_CMP=EDU which explains the way to obtain data from a data source (using
JDBC) and transform those data into an XML according to another XML file
which acts as a mapping. You can use the idea explain in the tutorial to
implement a Java class which takes as input: the XML mapping file and
produces another XML document with the structure specified by the mapping.
The data are previously obtained from a data base (the SQL query is also
specified in the mapping file).

You need registration to access the tutorial, but the registration process
is free.


-----Mensaje original-----
De: tim panton [mailto:tpanton@xxxxxxxxxxxxx]
Enviado el: sábado, 28 de febrero de 2004 13:50
Para: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Asunto: Re: [xsl] Executing SQL queries - XSLT ?

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);
             // 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

************ LEGEZKO OHARRA / AVISO LEGAL / LEGAL ADVICE *************
Mezu honek isilpeko informazioa gorde dezake, edo jabea duena, edota legez
babestuta dagoena.
Zuri zuzendua ez bada, bidali duenari esan eta ezabatu, inori berbidali
edo gorde gabe,legeak debekatzen duelako mezuak erabiltzea baimenik gabe.
Este mensaje puede contener información confidencial, en propiedad o
legalmente protegida.
Si usted no es el destinatario, le rogamos lo comunique al remitente
y proceda a borrarlo, sin reenviarlo ni conservarlo, ya que su uso no 
autorizado está prohibido legalmente.
This message may contain confidential, proprietary or legally privileged
If you are not the intended recipient of this message, please notify it to
the sender and delete without resending or backing it, as it is legally

 XSL-List info and archive:

Current Thread