[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] many-to-many


Subject: [xsl] many-to-many
From: "Brown, William S" <wsbrown@xxxxxxx>
Date: Fri, 26 Jan 2007 15:29:51 -0500

Esteemed experts,
There are a number of examples out there on the net of modelling
'many-to-many' relationship in XML.
A recent one is
http://en.wikibooks.org/wiki/XML:_Managing_Data_Exchange/The_many-to-many_rel
ationship
and it is helpful, as far is it goes.
However, Kevin Williams points out in
http://www-128.ibm.com/developerworks/xml/library/x-xdm2m.html
that the usual understanding of the 'many-to-many' relationship is that it is
a two-way street.

That is, to use an example from the first document, I can structure data about
movies and actors such that each actor's info is represented only once in the
XML but pulled out repeatedly as I generate a list of movies and the many
actors that appeared in each; same actors appear in multiple movies.
Or, to use the classic example, I can represent details for each part only
once, but re-use it as I generate invoices, each of which contains many of the
same parts.
Each of the above articles suggests an ID/IDREF approach for doing this.
However, Williams notes that in relational databases it is simple to run the
query in reverse, i.e., list the movies that each actor has appeared in, or
list the invoices on which each part appears. Since the ID/IDREF is treated as
unidirectional, he suggests a double IDREF structure - paired pointers
pointing in opposite directions.
Which brings me to my question -
has anyone seen any sample xml/xsl that actually demonstrated running the
query in forward and reverse. Everything I've seen uses ID/IDREF and xsl:key
in one direction and calls that a 'many-to-many' structure. But I'm not clever
enough to navigate back upstream (William implies it can't be done) or to
implement the XSL for the dual ID/IDREF.
The first (wiki) article contains sample xml and xsl for anyone who wants to
investigate the issue.
I hope you find this diverting (or at least can show me how to do it LOL).

Best,

William S. Brown              wsbrown@xxxxxxx
Systems Engineering and Safety Analysis Group
Brookhaven National Laboratory
Building 130                 TEL 631 344 7230
Upton, NY 11973-5000         FAX 631 344 4900


Current Thread
Keywords