[xsl] modeling relationships for efficent XSL processing

Subject: [xsl] modeling relationships for efficent XSL processing
From: "James A. Robinson" <jimr@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 26 Feb 2004 07:13:20 -0800

I do hope this isn't a stupid question I have. If it is, please point
me toward the appropriate FM.

I am working to model some data in XML which, up to now, has never had
it's relationships formally defined.  We found it hard to model the data
in a relational database, and I thought XML+XSLT might be a better option
than RDBM+SQL.

Say you have three sets of data with an inter-relationship: A server, a
set of configurations, and many sites which uses those configurations,
each paired with a  specific server.  Is there an accepted norm to
modeling this kind of relationship?

An example is below. What I'd like to do is be able to write in some sort
of XML where I could then come up with XSLT to apply to XML to end up
with site information which joins against a generic feature and a
specific database to give me a complete piece of information:

        site wsj_online
                uses feature read_article
                        read_article dbserver is oracle1.wsj.com
                        read_article dbport is 1234
                        read_article dbname is wsj_subscribers

        site barrons_online
                uses feature read_article
                        read_article dbserver is oracle1.wsj.com
                        read_article dbport is 1234
                        read_article dbname is barrons_subscribers

The question in my mind is how to properly point at other node sets
in the tree:

        <dbserver name="oracle1">
            <dbname name="wsj_subscribers">
                <schema name="subscriber_db" version="3.4"/>
            <dbname name="barrons_subscribers">
                <schema name="subscriber_db" version="2.5"/>
       <feature name="read_article">
            <require_db schema="subscriber_db"/>
            <configuration class="SomeConfig">
                    <entry name="dbserver">
                        <lookup node="dbserver" element="hostname"/>
                    <entry name="dbport">
                        <lookup node="dbserver" element="port"/>
        <site name="wsj_online">
            <ref_feature name="read_article">
                <ref_database dbserver="oracle1" dbname="wsj_subscribers"/>
        <site name="barrons_online">
            <ref_feature name="read_article">
                <ref_database dbserver="oracle1" dbname="barrons_subscribers"/>

This example uses elements ref_feature and ref_database in an attempt
to model that, when I'm processing <site name="wsj_online"> or <site
name="barrons_online"> I'm using one feature (read_article), but I'm
pointing at different databases.  The read_article feature only cares
that it's pointing at a subscriber_db type of database, not that it's
wsj_subscribers or barrons_subscribers.

So I've got databases which don't depend on anything, features which
depend on a database type, and sites which depend on features and the
specific database of the type required by the each feature. I find myself
wanting to model things using XPATH notation:

    <require_db xpath="/dbservers/dbserver/dbname/schema[@name='subscriber_db']"
    <ref_database xpath="/dbservers/dbserver[@name='oracle1']/dbname[@name='wsj_subscribers']"/>

which of course I cannot dynamically evaluate with XSLT proper (as opposed
to using an extension to XSLT, like Saxon's evaluation function). Also,
using XPATH seems to sidesteps the fact that I need to model the
relationship.  I can't help think embedding XPATH would be

My current thoughts are that for every <ref_xyz> and <require_xyz>
type node, I'll need to create a named template which can, feed the
node, return the proper node set (using, saying xsl:key() lookups),
or evaluate that the node set exists.

I hope I've explained the issues I'm struggling with clearly.  Any advice
or pointers to discussions of such would be most appreciated.

Thank you,

Jim Robinson

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
James A. Robinson                       jimr@xxxxxxxxxxxxxxxxxxxxx
Stanford University HighWire Press      http://highwire.stanford.edu/
650-723-7294 (W) 650-725-9335 (F)   

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

Current Thread