[xsl] Total occurences and ordered display of XML elements

Subject: [xsl] Total occurences and ordered display of XML elements
From: Rolando Isidoro <rli@xxxxxxxxxx>
Date: Mon, 12 Sep 2005 02:55:09 +0100
Hi, I wish to present a XML dynamic generated source, from a OAI repository, which has the following structure:

At this moment I have the following XSL file that performs some transformations and presents the data in HTML with only some of elements of each record being shown and being ordered by subject and then by title:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; exclude-result-prefixes="dc"
<xsl:output method="html" indent="yes"/>
<xsl:param name="root"/>

<xsl:template match="/">

<xhtml:div id="body">
<link rel="stylesheet" href="{$root}/css/oai.css" type="text/css"/>

<xsl:for-each select="//def:record">

                       <xsl:sort select="def:metadata//dc:subject"/>
                       <xsl:sort select="def:metadata//dc:title"/>

<xhtml:td class="entry" bgcolor="#{substring('F5F5F5FFFFFF', (position() mod 2 * 6) + 1, 6)}">
<!-- Creator data manipulation --> <xsl:for-each select="def:metadata//dc:creator">
<xsl:value-of select="."/>
</xsl:for-each> <!-- Title manipulation --> <b><i>
<xsl:value-of select="def:metadata//dc:title"/>
<!-- Publisher manipulation --> <xsl:variable name="publisher"><xsl:value-of select="def:metadata//dc:publisher"/></xsl:variable>
<xsl:if test="$publisher!=''">
<xsl:value-of select="$publisher"/>
<!-- Date manipulation --> <xsl:variable name="date"><xsl:value-of select="def:metadata//dc:date"/></xsl:variable>
<xsl:if test="$date != '' ">
<xsl:if test="$publisher!=''">
<xsl:value-of select="$date"/>





Additionally I would like to present the number of records for each different subject and display the records according to their subject, something like:

| Authored book                    | 8 |
| Chapter in book                  | 3 |
| Papers in conference proceedings | 5 |

Authored book:
book1, ....
book2, ....
book3, ....
book4, ....
book5, ....
book6, ....
book7, ....
book8, ....

Chapter in book:
chapter4, ....
chapter7, ....
chapter9, ....

Papers in conference proceedings:
paper5, ....
paper6, ....
paper7, ....
paper8, ....
paper9, ....

Can someone lead me to a solution for this problem?
If possible, I would like that each subject on the top table would point to the position where the records from that subject are being displayed, how can I do that?

Thanks in advance, regards,

Current Thread