This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
numbering - counting - grouping
- To: "'XSL-List at mulberrytech dot com'" <XSL-List at mulberrytech dot com>
- Subject: numbering - counting - grouping
- From: "Sellmer-Brüls, Barbara" <B dot Sellmer-Bruels at klopotek dot de>
- Date: Wed, 8 Nov 2000 14:52:36 +0100
- Reply-To: xsl-list at mulberrytech dot com
Hi,
I've got a problem with numbering (or counting ? or grouping?), and I don't
know how to solve it with a (for some reasons given) stylesheet structure.
The XML is as follows:
- contains different books
- each book can have different contributors
- each contributor has a type
My stylesheet applies templates for <book>.
Within <book> it applies templates to contributors depending on their type.
<xsl:apply-templates select="contributor [type='AU']">
some sorting of all contributors = AU based on an element I have not
listed here
</xsl:apply-templates>
<xsl:apply-templates select="contributor [type='ED']">
some sorting of all contributors = ED based on an element I have not
listed here
</xsl:apply-templates>
The contributor template states that
- some output is generated only for the first occurance of a set of
'AUcontributors' or 'ED contributors', and
- then that all names from the selected contributors nodes are to be listed:
<xsl:template match="contributor">
<xsl:if test="position()='1'">
<xsl:value-of select="type"/><xsl:text>:</xsl:text><br/>
</xsl:if>
<xsl:value-of select="name"/><br/>
</xsl:template>
What I need to add to the output a numbering of the contributors 'header'
data, so that the output looks like:
book 1
1. type is AU
Anna
2. type is ED
Ernst
Elisabeth
book2
1. type is AU
Andrew
2. type is CON
Cindy
I tried it with variables and parameters but it does not work.
Has anybody any Idea?
This is the XML document:
<?xml version="1.0" encoding="ISO-8859-1"?>
<list>
<book>
<id>1</id>
<contributor>
<type>AU</type>
<name>Anna</name>
</contributor>
<contributor>
<type>ED</type>
<name>Ernst</name>
</contributor>
<contributor>
<type>ED</type>
<name>Elisabeth</name>
</contributor>
</book>
<book>
<id>2</id>
<contributor>
<type>AU</type>
<name>Andrew</name>
</contributor>
<contributor>
<type>CON</type>
<name>Cindy</name>
</contributor>
</book>
</list>
Sorry for this lengthy email - but thanks in advance!
Barbara
---
Barbara Sellmer-Bruels
b.sellmer-bruels@klopotek.de
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list