xsl-list
[Top] [All Lists]

[xsl] many-to-many

2007-01-26 13:30:24
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_relationship
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(_at_)bnl(_dot_)gov
Systems Engineering and Safety Analysis Group
Brookhaven National Laboratory 
Building 130                 TEL 631 344 7230
Upton, NY 11973-5000         FAX 631 344 4900

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>