Re: [xsl] many-to-many

Subject: Re: [xsl] many-to-many
From: Ronan Klyne <ronan.klyne@xxxxxxxxxxx>
Date: Tue, 30 Jan 2007 08:16:50 +0000
Brown, William S wrote:
> Quite a bit cleaner than any example I was able to find on the web
> (but maybe I was looking in the wrong places).

I've always found it difficult to find the right search terms to find
what you want when dealing with XSL...

> I haven't figured out yet how the 'part' template works yet

What it does is give a list of invoices on which a particular part appears.
How it does it is by use of the 'p-i' key, which matches each invoice,
keyed by the part ids of all parts on that invoice (use='part/@id')
Is this clear?

> I don't see how I would output elements (e.g., partLoc below) along with the part id.
> It's simple, right? (ducking qand running)

It could be done easily with a second key to map from part id to part:
<xsl:key name="pid-p" match="/doc/parts/part" use="@id"/>

Then instead of using key('i-p', @id) to in the loop in the invoice
template, get only the part id, you can use key('pid-p', key('i-p',
@id)/@id) to get the part, which you can then do what you like with,
including get the child nodes (partLoc).

This is just one solution, and almost certainly not the best; I could
not figure out a way of having the key 'i-p' give the fuller part
details. Ideas anyone?


-- 
Ronan Klyne
Business Collaborator Developer
Tel: +44 (0)870 163 2555
ronan.klyne@xxxxxxxxxxx
www.groupbc.com

Current Thread