Hi There,
I have some XML, part of which looks like:
<header>
<usage ms="Cht" code="07051000"/>
<usage ms="Ely" code="07051000"/>
<usage ms="Evm" code="07051000"/>
<usage ms="Evm" code="07053000"/>
<usage ms="Evm" code="07055000"/>
<usage ms="Glo" code="07053000"/>
<usage ms="Hyd" code="07051000"/>
<usage ms="Pet" code="07051000"/>
<usage ms="Wcb" code="07051000"/>
<usage ms="Wor" code="07051000"/>
</header>
My template for this matches the header and then for each usage element
goes and looks up the proper name of the manuscript (based on @ms) and
the proper name of the day (based on @code).
Currently the template in rough form looks like:
<xsl:template name="header">
<xsl:if test="usage">
<div class="usagefooter">
<hr />
<ul>
<xsl:for-each select="//header/usage">
<!-- Note: $mss document() declared outside this template -->
<xsl:variable name="usagemss"
select="$mss//witness[(_at_)sigil=$sigil]/@shortname"/>
<xsl:variable name="filename"
select="$mss//witness[(_at_)sigil=$sigil]/@filename"/>
<xsl:variable name="daycode" select="@code" />
<xsl:variable name="feasts" select="document('../../cantus/feast.xml')"/>
<xsl:variable name="occasion"
select="$feasts//feast[feastCode=$daycode]/occasion"/>
<xsl:variable name="sigil" select="@ms"/>
<xsl:if test="$filename != 'none'">
<li> <xsl:value-of select="$usagemss"/>
<xsl:if test="@id">(ID: <xsl:value-of select="@id"/>)</xsl:if>
gives this in full for
<a href="{concat('/cursus/ms/', substring-before($filename, '.'), '#',
$sigil, '.', @code)}">
<xsl:value-of select="$occasion"/></a>.</li>
</xsl:if>
</xsl:for-each>
</ul>
</div>
</xsl:if>
</xsl:template>
This produces output like:
<div class="usagefooter">
<hr>
<ul>
<li>Chertsey gives this in full for <a
href="/cursus/ms/chertsey#Cht.07051000">Dominica de Passione</a>.</li>
<li>Ely gives this in full for <a href="/cursus/ms/ely#Ely.07051000">Dominica
de Passione</a>.</li>
<li>Evesham gives this in full for <a
href="/cursus/ms/evesham#Evm.07051000">Dominica de Passione</a>.</li>
<li>Evesham gives this in full for <a
href="/cursus/ms/evesham#Evm.07053000">Feria 3 de Passione</a>.</li>
<li>Evesham gives this in full for <a
href="/cursus/ms/evesham#Evm.07055000">Feria 5 de Passione</a>.</li>
<li>Gloucester gives this in full for <a
href="/cursus/ms/gloucester#Glo.07053000">Feria 3 de Passione</a>.</li>
<li>Hyde gives this in full for <a href="/cursus/ms/hyde#Hyd.07051000">Dominica
de Passione</a>.</li>
<li>Peterborough gives this in full for <a
href="/cursus/ms/peterborough#Pet.07051000">Dominica de Passione</a>.</li>
<li>Winchcombe gives this in full for <a
href="/cursus/ms/winchcombe#Wcb.07051000">Dominica de Passione</a>.</li>
<li>Worcester gives this in full for <a
href="/cursus/ms/worcester#Wor.07051000">Dominica de Passione</a>.</li>
</ul>
</div>
This is fine, but as you can see the Evesham manuscript uses this
on 3 different days. What I'd prefer is instead is something like:
<li>Evesham: <a href="/cursus/ms/evesham#Evm.07051000">Dominica de Passione</a>,
<a href="/cursus/ms/evesham#Evm.07053000">Feria 3 de Passione</a>,
<a href="/cursus/ms/evesham#Evm.07055000">Feria 5 de Passione</a>.</li>
So I want to group each of those by @ms, using only xslt 1 (sadly).
Although the <usage> elements are in alphabetic order by @ms I wouldn't
want to rely on that and just test the following-sibling. If I was
to sort any order I'd want the <usage> elements as a whole sorted by
@ms and all those of the same @ms sorted by @code.
Suggestions?
-James
---
Dr James Cummings, Oxford Text Archive,
James(_dot_)Cummings(_at_)ota(_dot_)ahds(_dot_)ac(_dot_)uk
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list