This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Summarizing repeating values
- To: "Xsl-List at Lists dot Mulberrytech. Com" <xsl-list at lists dot mulberrytech dot com>
- Subject: [xsl] Summarizing repeating values
- From: "Brent Kobayashi" <brent at kobayashi dot ca>
- Date: Sun, 18 Mar 2001 10:57:24 -0500
- Reply-To: xsl-list at lists dot mulberrytech dot com
Summary:
With an XML source of items, each item having one or more categories, I
output all items with a particular category child. This works fine.
I would then like to summarize all the categories for the filtered items.
(ie; display each category value only once, even if repeated in the source).
XML:
*****************************
<items>
<item>
<title>Agora</title>
<description/>
<URL>http://www.agora.co.uk/groove/</URL>
<category>Company</category>
</item>
<item>
<title>Red/Amber/Green status tracker</title>
<description>The RAG tool's grid shows team members against a list of
items. Each person's status on each item can be Red, Amber or
Green</description>
<URL>http://www.agora.co.uk/groove/RAGTool.htm</URL>
<category>Tools</category>
</item>
<item>
<title>Mind-Map brainstorm outliner</title>
<description>A flexible brainstorming outline tool, which you can share
with your friends. It's easy to add new items and edit them; then you can
drag items around the screen to arrange your thoughts and connect them in
different ways.</description>
<URL>http://www.agora.co.uk/groove/MMTool.htm</URL>
<category>Tools</category>
<category>Outliners</category>
<category>Brainstorming</category>
</item>
<item>
<title>Agora Mindmap Experimental Discussion</title>
<description>For users of the Agora mindmap tool</description>
<category>Brainstorming</category>
<category>Tools</category>
<category>Discussion Forums</category>
</item>
<item>
<title>GNOME</title>
<description>(Groove Network Of Many Enthusiasts), a general developers
& enthusiasts discussion</description>
<URL>http://www.agora.co.uk/groove/various/GNOME.grv</URL>
<category>Discussion Forums</category>
<category>Public Shared Spaces</category>
</item>
<item>
<title>Groove and Userland discn space</title>
<description>Talking about groove and userland integration
ideas</description>
<URL>http://www.agora.co.uk/groove/various/GUspace.grv</URL>
<category>Web Integration</category>
<category>Discussion Forums</category>
<category>Public Shared Spaces</category>
</item>
</items>
***************************
XSL:
***************************
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="/">
<html>
<head>
<title>groove - tools</title>
</head>
<body>
<h1>groove - tools</h1>
<xsl:for-each select="items/item[category='Tools']">
<h3><xsl:value-of select="title"/></h3>
<p><i><xsl:value-of select="description"/></i></p>
<p><b><xsl:value-of select="URL"/></b></p>
</xsl:for-each>
<xsl:apply-templates select="items/item[category='Tools']/category"/>
</body>
</html>
</xsl:template>
<xsl:template match="category">
<p>
<xsl:apply-templates/>
</p>
</xsl:template>
</xsl:stylesheet>
********************************
Output:
groove - tools
Red/Amber/Green status tracker
The RAG tool's grid shows team members against a list of items. Each
person's status on each item can be Red, Amber or Green
http://www.agora.co.uk/groove/RAGTool.htm
Mind-Map brainstorm outliner
A flexible brainstorming outline tool, which you can share with your
friends. It's easy to add new items and edit them; then you can drag items
around the screen to arrange your thoughts and connect them in different
ways.
http://www.agora.co.uk/groove/MMTool.htm
Agora Mindmap Experimental Discussion
For users of the Agora mindmap tool
>>> Successful, up until this point, then:
Tools
Tools
Outliners
Brainstorming
Brainstorming
Tools
Discussion Forums
>>> Partially succesful. I'm trying to have this display only:
Tools
Outliners
Brainstorming
Discussion Forums
Cheers,
Brent
Kobayashi Technology - High quality computer training, development and
support
http://www.kobayashi.ca/
MEDUSA creative e-services
http://www.medusacreative.com/
2889A Danforth Ave
Toronto, Ontario M4C 1M3
Phone: 416 410-3266
Fax: 416 694-5495
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list