You might want to move to XSLT 2.0 with nested for-each-group where
these kind of problems don't occur, in your case you have defined the
key for any elements but only want to apply it with Muenchian grouping
for a subtree, therefore you have to use a key concatenating the id of
the parent node and the value you want to use:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:fox="http://xml.apache.org/fop/extensions" version="1.1"
exclude-result-prefixes="fo">
<xsl:output method="html" indent="yes"/>
<xsl:key name="idxaut"
match="datafield[@tag=100]|datafield[@tag=700]|datafield[@tag=710]"
use="."/>
<xsl:key name="idxtit" match="indexsort"
use="concat(generate-id(..), '|', .)"/>
<xsl:template name="AUTHOR" match="collection">
<xsl:for-each
select="level_1/record/datafield[@tag=100]|level_1/record/datafield[@tag=700]|level_1/record/datafield[@tag=710]">
<xsl:sort select="normalize-space(.)" lang="de-CH"/>
<xsl:sort select="../indexsort"/>
<!-- on affiche l'auteur -->
<xsl:for-each select="current()[count(. | key('idxaut',
.)[1]) = 1]">
<b>
<xsl:value-of select="."/>
</b>
<br/>
<xsl:for-each select="key('idxaut', .)">
<xsl:sort select="../indexsort"/>
<xsl:for-each select="../indexsort[count(. |
key('idxtit', concat(generate-id(..), '|', .))[1]) = 1]">
<xsl:for-each select="key('idxtit',
concat(generate-id(..), '|', .))">
<!--<xsl:if test="position()=1"> -->
<xsl:for-each select="../datafield[@tag=245]">
<xsl:value-of select="."/>
</xsl:for-each>
<xsl:value-of select="concat(' | ',../recno)"/>
<br/>
<!--</xsl:if> -->
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
<xsl:template match="collection">
<html>
<xsl:call-template name="AUTHOR"/>
</html>
</xsl:template>
</xsl:stylesheet>
Am 26.05.2017 um 22:58 schrieb Jean-Pierre Lamon gipi(_at_)ngscan(_dot_)com:
For a bibliographic list, I'm trying to display author/title index
entries. I'm using the Muenchain method to group books by author/titles.
There's an index for author and titles. Titles are generated from the
indexsort XML node.
Could you try to generate this list with the attached files and see
the result :
The problem :
*Affentranger, Urban 1944- (DE-588)1072229609
*Die Renovation der Klosterkirche Disentis im 19. und 20. Jahrhundert
/ Urban Affentranger | 6
Turnen und Sport an der katholischen Kantonsschule Disentis
1833-1842 / Urban Affentranger | 5
Turnen und Sport an der katholischen Kantonsschule Disentis
1833-1842 / Urban Affentranger | 7
*Blum, Roger 1945- (DE-588)131690035*
Alfred Oberer - Steuermann im Hintergrund / Roger Blum | 3
Die Mechanik der Politik in Baselland / Roger Blum | 2
*Czouz-Tornare, Alain-Jacques 1957- (DE-588)158860152*
*Pavillon, Olivier*
Introduction / Olivier Pavillon | 1
* -->*/Introduction / Alain-Jacques Czouz-Tornare | 4 *--> should be
under Czouz-Tornare*/
*//*
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--