Hi, I have scoured the web for help on this and have been through the archives
and Jenis' grouping pages but I cannot work it out. So here goes.
I am using xslt 1.0 and MSXML parser
I have an xml file that has a series of notes Like so
<CourseNote>
<CourseNoteItem>
<StudyGroupName>Aboriginal or Torres Strait
Islanders</StudyGroupName>
<Year>2009</Year>
<CourseNoteText>A</CourseNoteText>
<StudyGroupOrder>2</StudyGroupOrder>
<StudyGroupCode>ATSI</StudyGroupCode>
<DisplaySequence>2</DisplaySequence>
</CourseNoteItem>
<CourseNoteItem>
<StudyGroupName>Aboriginal or Torres Strait
Islanders</StudyGroupName>
<Year>2009</Year>
<CourseNoteText>B</CourseNoteText>
<StudyGroupOrder>2</StudyGroupOrder>
<StudyGroupCode>ATSI</StudyGroupCode>
<DisplaySequence>5</DisplaySequence>
</CourseNoteItem>
<CourseNoteItem>
<StudyGroupName>Award</StudyGroupName>
<Year>2009</Year>
<CourseNoteText>A</CourseNoteText>
<StudyGroupOrder>1</StudyGroupOrder>
<StudyGroupCode>AWD</StudyGroupCode>
<DisplaySequence>2</DisplaySequence>
</CourseNoteItem>
<CourseNoteItem>
<StudyGroupName>Award</StudyGroupName>
<Year>2009</Year>
<CourseNoteText>B</CourseNoteText>
<StudyGroupOrder>1</StudyGroupOrder>
<StudyGroupCode>AWD</StudyGroupCode>
<DisplaySequence>5</DisplaySequence>
</CourseNoteItem>
<CourseNoteItem>
<StudyGroupName>Award</StudyGroupName>
<Year>2009</Year>
<CourseNoteText>C</CourseNoteText>
<StudyGroupOrder>1</StudyGroupOrder>
<StudyGroupCode>AWD</StudyGroupCode>
<DisplaySequence>7</DisplaySequence>
</CourseNoteItem>
</CourseNote>
There can be many different StudyGroupCodes, many CourseNoteTexts and many
Years. I would like to display a 'Generic' List of notes eg those that are
duplicated in every StudyGroup and then display lists of StudyGroups with the
CourseNoteTexts that are not duplicated in all other StudyGroups. I am familiar
with keys and get get lists of unigue items and group them but I cannot exclude
the items that do not appear in all StudyGroups...
Here is a fragment of my very poor solution which does not allow me to group by
StudyGroup the Notes that are not in all StudyGroups:
<ul>
<xsl:for-each select="CourseNoteItem[count(. | key('CN-T', concat(Year,
CourseNoteText))[1]) = 1]">
<xsl:if test="count(preceding-sibling::node()[name()=name(current())])=0">
<li>
<strong>Applies to all Study Groups</strong>
<br />
<xsl:copy-of select="CourseNoteText/node()" />
</li>
</xsl:if>
<xsl:if test="count(preceding-sibling::node()[name()=name(current())])!=0">
<li>
<strong>
<xsl:value-of select="StudyGroupName" />
</strong>
<br />
<xsl:copy-of select="CourseNoteText/node()" />
</li>
</xsl:if>
</xsl:for-each>
</ul>
Any help appreciated
Regards
Tim Cavanagh
Senior Technical Architect
--~------------------------------------------------------------------
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>
--~--