[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Muenchain method

Subject: Re: Muenchain method
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 27 May 2017 08:33:32 -0000
Re:  Muenchain method
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@xxxxxxxxxx:
>
> 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*/
> *//*

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.