RE: [xsl] XML to Database Inserts via XSLT

Subject: RE: [xsl] XML to Database Inserts via XSLT
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 9 Mar 2005 22:40:05 -0000
> Is there a place where I can read more about this particular 
> extension

and/or extensibility of the processor in general?

> But I was thinking that perhaps placing a 'temporary 
> hierarchy' (which 
> I guess would be somewhat like a 'view'), over the relational 
> structure of the database, would allow the database to look like
> an XML/hierarchical structure?

This is akin to what some of the XQuery/relational vendors are doing: except
that they push as much of the query to the database as possible, to make
maximum use of indexes. 

In principle you could implement the XPath data model directly as a view of
the database, but relational databases are much happier doing a small number
of large queries rather than millions of small ones. (If only we still had
Codasyl databases...) Saxon's NodeInfo interface is actually slightly higher
level than the XPath data model as described in the specs (because it
supports navigation using the XPath axes) but a direct mapping of this
interface onto SQL would still be a rather significant challenge, and
wouldn't give as good performance as systems that translate whole FLWR
expressions into SQL.

Michael Kay

> I guess the idea would be to:
> a) somehow define the way that the relationships between
>   the existing entities in the database will collapse into
>   a tree structure for an application of an XSLt stylesheet.
> b) apply the stylesheet to the database... much like
>   applying it to an XML document... only with the xpath
>   expressions being evaluated by calls to the temporary
>   tree structure in the database.
> I'm not sure if this makes much sense... I do know that
> I've never had an easier time programming a web application
> than when I was able to apply a stylesheet directly to
> a database (in this case, the aforementioned libxml document
> residing in memory on an RPC server) without any sort of
> database lookups getting in the way.... so I'd be interested 
> in any ideas people have about how I could do such a thing
> with a large relational database.
> I looked at sleepycat and a couple other "XML native" 
> databases... but from what I could tell, they all pulled
> the XML document into memory in order to apply a stylesheet
> to it.  For a 20MB database, perhaps that's not a problem,
> but for a 20GB database, it definitely is.  It's possible
> my research was incomplete, but I did look for quite a
> while over the course of a couple months.
> I hope this question is reasonably clear, but it seems like
> a pretty complex and abstract subject.  I'd be glad
> to flesh out any comments that I can...
> -Brian
> Note:
> (Originally, in a design attempt, I was picking one object
> and exporting a hierarchy of objects linked to that
> object recursively... and then applying a stylesheet to
> that... but this wasn't even close to what I actually 
> wanted)

Current Thread