Re: How do I change a XSL style sheet to group data t
if there's no overlap in the values (i.e., when you concatenate them that they create the uniqueness you want), you can do this:
<xsl:key name="sample" match="sample" use="concat(sample_date_time, cp_name)" />
in addition, of course, you also change the key(...) functions throughout with the same as in you the use attribute.
When the values do overlap, you can make them more unique when adding a separator, like in concat(sample_date_time, ':', cp_name). Of course, you can concat as many values as you want. Make sure that the xpaths you provide are correct when seen as relative to the match attribute of the key (in this case, the sample node). And think of moving to XSLT 2.0 as soon as possible if you have more of this kind of problems. You can simply use:
<xsl:for-each-group select="sample" group-by="yourgroupbyclausehere" >....
and many other handy constructs (i.e., you can group by nodes that are separated by a node with a certain value, or that are siblings of one another by some rule etc etc). It's all possible in XSLT 1.0 too, but much harder and not with a single statement. And if you have little XSLT knowledge, it can be very hard.
Please read up on the tutorials as well, you may want to know how it all works: http://www.jenitennison.com/xslt/grouping/muenchian.html
Cheers, -- Abel Braaksma
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format