Subject: [xsl] Creating a Place index From: "Netsonic" <kaarle.kaila@xxxxxx> Date: Mon, 24 Nov 2003 17:23:52 +0200 |
hello there, I did get help from here earlier on creating an index from my report xml-file. Now I would need some more help on the matter. My xml-file looks like this: <?xml version="1.0" encoding="UTF-8"?> <raport> <tables> <table number="1"> <section gen="0" type="PARE"> <person> <name><givenname>Lars </givenname><surname>Schalin</surname></name> <notices> <notice tag="BIRT">Syntynyt <date value="17540101">01.01.1754</date> <place name="Hanebo">Hanebo</place>. </notice> <notice tag="DEAT">Kuollut <date value="18081010">10.10.1808</date> <place name="Vaasa">Vaasa</place>. </notice> </notices> </person> </section> ............. <section gen="1" type="PARE"><person> ..... </person> </section> </table> </tables> </raport> I am now trying to create a place index from this data. place elements are located inside table elements and it is possible that there are more than one place index in the same table. e.g. person was born and he died in the same place. In the place index I want each table number where it is found only once. I have succeeded with the xslt-file below to create a place index but I have not succeeded to remove the double table references. I assume it should be done by grouping using the muenchian method the same way as I grouped the places as I have tried here. Can anybody help me with this? ---------------------- <xsl:stylesheet version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' > <xsl:key name="contacts-by-place" match="//place" use="@name" /> <xsl:key name="index-by-table" match="ancestor::table" use="@number" /> <xsl:template match="raport"> <html> <head> <title>suku-testiraportti</title> </head> <body> <h1>Paikkahakemisto (fi)</h1> <table border="1"> <tr><td align="left">Place</td><td align="left">Table</td></tr> <xsl:for-each select="//place[count(. | key('contacts-by-place', @name)[1]) = 1]"> <xsl:sort select="@name" lang="fi"/> <tr><td align="left"><xsl:value-of select="@name" />: <xsl:value-of select="key('contacts-by-place', @name)" />:</td><td> <xsl:for-each select="key('contacts-by-place',@name)"> <xsl:for-each select="ancestor::table[count(. | key('index-by-table', @number)[1]) = 1]"> <xsl:sort select="ancestor::table/@number" /> <xsl:value-of select="@number" /> </xsl:for-each> </xsl:for-each> </td></tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] SAXON and heavy xml doc, Tomas Salkauskas | Thread | [xsl] parsing post script, Karthikeyan Ramnath |
RE: [xsl] SAXON and heavy xml doc, SHEIKH Sajjad | Date | [xsl] parsing post script, Karthikeyan Ramnath |
Month |