[xsl] Meunchen Grouping - How to combine two specific 'unique' group types?

Subject: [xsl] Meunchen Grouping - How to combine two specific 'unique' group types?
From: "Karlmarx Rajangam" <karlmarx.rajangam@xxxxxxxxxxxxxxxxxx>
Date: Tue, 8 May 2007 12:23:33 -0400
Hello,

I am using Muenchen group method for a specific case and have a
requirement of combining / merging two specific group types. Basically
the xml [stripped down] is like

<somenodes>
            <activeSchedule>
                        <assessmentType>Exam</assessmentType>
                        <assessmentName></assessmentName>
                        <scheduleName>Exam All QTypes</scheduleName>
                        <monitor>..</monitor>
                        List of few other nodes
            </activeSchedule>
            <activeSchedule>
                        <assessmentType>Quiz</assessmentType>
                        <assessmentName>Quiz 1</assessmentName>
                        <scheduleName>Quiz 1, unlimited</scheduleName>
                        List of few other nodes
            </activeSchedule>
            <activeSchedule/>
            <activeSchedule/>

The <assessmentType>'s are Exam, NOTSET, Quiz etc and I am grouping them
based on <assessmentType> using Muenchen method. My striped down xslt
code [pls ignore any spell and case mistakes and missing node values if
any]

Seting the key
  <xsl:key name="schedule-by-assessmentType" match="activeSchedule"
use="assessmentType"/>

and then from the main template
  <xsl:apply-templates select="//activeSchedule[generate-id(.) =
generate-id(key('schedule-by-assessmentType', assessmentType)[1])]"/>

and then
  <xsl:template match="activeSchedule">
         <table> blah blah..to display those grouped <assessmentType>
values in a table.

The current html output will look like:

Exam (total  = 3)
    <assessmentName>     <scheduleName>     <EndDate> [& few other field
columns not shown in the xml]
     [3 rows of values]

NOTSET*** (total  = 2)
     <assessmentName>      <scheduleName>       <EndDate>

Quiz (total = 6)
    <assessmentName>      <scheduleName>       <EndDate>


But in our requirement, we must treat 'NOTSET'*** as 'Exam' and combine
them together. i.e., to show something like

Exam (total  = 5)
    <assessmentName>      <scheduleName>     <EndDate>
    [5 rows of values - 3 from Exam + 2 from NOTSET]

I am not sure whether it is possible to achieve that? Pls suggest ways
and means to achieve i.e., combine NOTSET and Exam, without affecting
the rest of the grouping. We use XSLT 1.


Thanks in adv,
Karl

Current Thread