Subject: [xsl] modeling relationships for efficent XSL processing From: "James A. Robinson" <jimr@xxxxxxxxxxxxxxxxxxxxx> Date: Thu, 26 Feb 2004 07:13:20 -0800 |
Hello, 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: <example_config_datastore> <dbservers> <dbserver name="oracle1"> <hostname>oracle1.wsj.com</hostname> <port>1234</port> <dbname name="wsj_subscribers"> <schema name="subscriber_db" version="3.4"/> </dbname> <dbname name="barrons_subscribers"> <schema name="subscriber_db" version="2.5"/> </dbname> </dbserver> </dbservers> <features> <feature name="read_article"> <require_db schema="subscriber_db"/> <configuration class="SomeConfig"> <map> <entry name="dbserver"> <lookup node="dbserver" element="hostname"/> </entry> <entry name="dbport"> <lookup node="dbserver" element="port"/> </entry> </map> </configuration> </feature> </features> <sites> <site name="wsj_online"> <ref_feature name="read_article"> <ref_database dbserver="oracle1" dbname="wsj_subscribers"/> </ref_feature> </site> <site name="barrons_online"> <ref_feature name="read_article"> <ref_database dbserver="oracle1" dbname="barrons_subscribers"/> </ref_feature> </site> </sites> </example_config_datastore> 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] using variable in xsl:inc, Andrew Welch | Thread | Re: [xsl] modeling relationships fo, G. Ken Holman |
RE: [xsl] using variable in xsl:inc, Michael Kay | Date | Re: [xsl] XPATH: get not repeated n, aaa bbb |
Month |