Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 16th, 2006, 02:13 AM
Authorized User
 
Join Date: Sep 2006
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default Database Connectivity

Hallo everyone,

At the moment I provide XML data with XSL stylesheets for the users to browse reporting data. This works fine both/either accessed from a file-server location or via a web-server (without the active involvement of the web-server).

This is the way that we would like to keep it but now I have a question about a 'nice-to-have' feature:

I notice that XSL can use extensions to actively access a database. For example ...

import java.sql.Connection;
import jave.sql.DriverManager;
etc ...

It would be great to incorporate direct sql access to our Oracle database (to retrieve detail data alongside the consolidated XML data) but before I start investigating this further, I wanted to check a couple of basic questions:

- Does such database/sql access require the involvement/setting of the web-server? Or will the XSL engine fire up this functionality independently? Is this the case even if the location of the XML/XSL is a drive on a file-server (rather than on a web-server)?

- Where are these (SQL) extension files/programs stored/installed? And can I run a simple check to see if they are installed/working?

Any tips about database access (via XSL) would be a great help.

Regards and thanks,
Alan Searle.

 
Old October 16th, 2006, 02:32 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

>I notice that XSL can use extensions to actively access a database.

There's nothing in the XSLT language to allow SQL access. There are extensions available with some products, e.g. Saxon and Xalan. Any questions about the functionality are therefore product-specific.

>Does such database/sql access require the involvement/setting of the web-server?

In the case of the Saxon and Xalan extensions, it relies on the JDBC support in the Java VM, which in turn depends on the availability of JDBC drivers for your chosen database. I've always done this myself through the generic JDBC/ODBC driver on Windows; details for other platforms may vary.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old October 16th, 2006, 02:45 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

In my opinion connecting directly to a databse from within XSLT is a poor design. Far more flexible to create some sort of RESTful web service whereby you can access information via a construct such as document('http://myDomain.com/myServices/Customers/123456'). You can build the URL dynamically at runtime based on other data and global parameters etc.

--

Joe (Microsoft MVP - XML)
 
Old October 16th, 2006, 06:32 AM
Authorized User
 
Join Date: Sep 2006
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default


> In my opinion connecting directly to a databse from within XSLT is
> a poor design.

I agree: My main push is to get as much (consolidated) data as possible stored in XML and presented through XSLT. Data access would only be a nice-to-have.

> Far more flexible to create some sort of RESTful web service
> whereby you can access information via a construct such as document
> ('http://myDomain.com/myServices/Customers/123456'). You can build
> the URL dynamically at runtime based on other data and global
> parameters etc.

The problem that I have with externally linked XML files and the document() command is that this rules out lots of 'key' and grouping functionality which I use quite intensively (consolidation reports).

At the moment, I am trying to get all my data into one (period-based) XML file so that I can use 'key' commands.

Anyway, thanks for your tips: I will be googling on the keywords to see what I turn up.

Regards,
Alan.

 
Old October 16th, 2006, 06:41 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

I don't see why external documents should necessarily rule out the use of keys. A key is evaluated against the document that owns the context node, or in XSLT 2.0 you can pass a context node, so you change to the external document using xsl:for-each and use your key.

I can see there might be a problem if you want to aggregate across many documents but that's going to be the case using direct database access as well.

--

Joe (Microsoft MVP - XML)





Similar Threads
Thread Thread Starter Forum Replies Last Post
database connectivity singh.mandeep82 Struts 0 December 29th, 2007 05:22 PM
Database Connectivity cnkumar74 VB Databases Basics 13 May 23rd, 2007 10:26 AM
Database Connectivity pageturner71 Access 1 September 8th, 2004 05:13 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.