This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Grouping on multiple nested elements


Hello Paul :)

> I have no problem grouping by program_name using the Muenchian
> method - there is only one program_name for each story. However,
> grouping by subject has me stumped - do I need multiple keys and how
> do I keep track of the current subject?

The essential hint here is that when you use the Muenchian Method you
must have a 1:1 correspondence between the nodes that you're grouping
and the values that you're grouping by. When you're grouping stories
by program name, that's fine because each story only has one program
name. If you want to group stories by subject you have to go one
level down and actually group subject elements by their value:

<xsl:key name="bySubject" match="story/subjects/subject" use="." />

Then do the normal Muenchian Method stuff, except selecting the
subject elements and moving up the tree to their ancestor story in
order to get information about ... oh, like I see Jarno's just posted
:)

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]