[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SQL extensions to XPath/XSLT - why we need them ?



Hi,

1. Can you explain the need in SQL extensions ?
I'm against this.
Use SQL when you query relational data, and XPath when you query native
XML documents.

XPath also will allow us to migrate to future W3C Query Language (XQL
?), which for sure will be XPath++

For your legacy relational data use utilities like Oracle XSQL or
Cocoon's SQL Processor,
we can convert one of this to Stored Procedure / Server Extension.

2. Stored Procedures

Look at eXcelon Java Server Extensions API.
There few types of extensions: Get/Run/Query/Update etc...

    1. GetExtension:                   Retrieve XML data
    2. GetSchemaExtension:      Retrieve the schema for an XML document
    3. QueryExtension:              Query XML data stored
    4. UpdateExtension:             Update XML data
    5. RunExtension:                 Any operation that does not fall
into one of the other categories. This might be a combination of
operations.

Extensions run in it's own read-only or update transactions.

So, before reinvent the wheel ...

3. How to apply XSLT stylesheets
Stylesheets is stored in XML repository in PDOM form, exactly as any
other XML document.
Then in Java extension pseudo-code:

    Database db=Database.open("ozone.xml.com", 9999);

    Document doc=db.getDocumet("books.xml");
    Document queryResult=XPathProcessor.query(doc,
"//book[author=\'Daniel Defo\']");
    Document stylesheet=db.getDocument("books.xsl");

    Hashtable params= ... // this <xsl:param/> parameters

    Document result=XSLTProcessor.transform(queryResult, stylesheet,
params);
or
    // if we know that output is text
    XSLTProcessor.transform(queryResult, stylesheet, writer);

    The next step will be ability to compile XSLT stylesheets into Java
Stored Procedure,
Some XSLT processors allow this.

4. XML Update Language
There is no standards in this field still,

eXcelon uses it's proprietary XML Update language,
again I propose reuse their DTD:

There is simple example (namespace is omitted):

<update select="/bookstore/book[0]">
      <element location="lastchild">
            <copyright></copyright>
      </element>
</update>

Zvi
Best Regards