2 <!DOCTYPE xsl:stylesheet [
3 <!ENTITY % common.entities SYSTEM "../common/entities.ent">
6 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
7 xmlns:fo="http://www.w3.org/1999/XSL/Format"
8 xmlns:rx="http://www.renderx.com/XSL/Extensions"
9 xmlns:axf="http://www.antennahouse.com/names/XSL/Extensions"
10 xmlns:i="urn:cz-kosek:functions:index"
11 xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0"
12 xmlns:func="http://exslt.org/functions"
13 xmlns:exslt="http://exslt.org/common"
14 extension-element-prefixes="func exslt"
15 exclude-result-prefixes="func exslt i l"
18 <!-- ********************************************************************
19 $Id: autoidx-kosek.xsl 8725 2010-07-15 08:08:04Z kosek $
20 ********************************************************************
22 This file is part of the DocBook XSL Stylesheet distribution.
23 See ../README or http://docbook.sf.net/ for copyright
24 copyright and other information.
26 ******************************************************************** -->
28 <!-- ==================================================================== -->
29 <!-- The "kosek" method contributed by Jirka Kosek. -->
31 <xsl:include href="../common/autoidx-kosek.xsl"/>
33 <xsl:template name="generate-kosek-index">
34 <xsl:param name="scope" select="NOTANODE"/>
36 <xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
37 <xsl:if test="contains($vendor, 'libxslt')">
38 <xsl:message terminate="yes">
39 <xsl:text>ERROR: the 'kosek' index method does not </xsl:text>
40 <xsl:text>work with the xsltproc XSLT processor.</xsl:text>
44 <xsl:if test="contains($vendor, 'Saxonica')">
45 <xsl:message terminate="yes">
46 <xsl:text>ERROR: the 'kosek' index method does not </xsl:text>
47 <xsl:text>work with the Saxon 8 XSLT processor.</xsl:text>
52 <xsl:if test="$exsl.node.set.available = 0">
53 <xsl:message terminate="yes">
54 <xsl:text>ERROR: the 'kosek' index method requires the </xsl:text>
55 <xsl:text>exslt:node-set() function. Use a processor that </xsl:text>
56 <xsl:text>has it, or use a different index method.</xsl:text>
60 <xsl:if test="not(function-available('i:group-index'))">
61 <xsl:message terminate="yes">
62 <xsl:text>ERROR: the 'kosek' index method requires the
</xsl:text>
63 <xsl:text>index extension functions be imported:
</xsl:text>
64 <xsl:text> xsl:import href="common/autoidx-kosek.xsl"</xsl:text>
68 <xsl:variable name="role">
69 <xsl:if test="$index.on.role != 0">
70 <xsl:value-of select="@role"/>
74 <xsl:variable name="type">
75 <xsl:if test="$index.on.type != 0">
76 <xsl:value-of select="@type"/>
80 <xsl:variable name="terms"
81 select="//indexterm[count(.|key('group-code',
82 i:group-index(&primary;))
84 and not(@class = 'endofrange')]"/>
86 <xsl:apply-templates select="$terms" mode="index-div-kosek">
87 <xsl:with-param name="scope" select="$scope"/>
88 <xsl:with-param name="role" select="$role"/>
89 <xsl:with-param name="type" select="$type"/>
90 <xsl:sort select="i:group-index(&primary;)" data-type="number"/>
91 </xsl:apply-templates>
95 <xsl:template match="indexterm" mode="index-div-kosek">
96 <xsl:param name="scope" select="."/>
97 <xsl:param name="role" select="''"/>
98 <xsl:param name="type" select="''"/>
100 <xsl:variable name="key"
101 select="i:group-index(&primary;)"/>
103 <xsl:variable name="lang">
104 <xsl:call-template name="l10n.language"/>
107 <xsl:if test="key('group-code', $key)[&scope;]
108 [count(.|key('primary', &primary;)[&scope;][1]) = 1]">
110 <xsl:call-template name="indexdiv.title">
111 <xsl:with-param name="titlecontent">
113 <xsl:when test="$key = 0">
114 <xsl:call-template name="gentext">
115 <xsl:with-param name="key" select="'index symbols'"/>
119 <xsl:value-of select="i:group-letter($key)"/>
125 <xsl:apply-templates select="key('group-code', $key)[&scope;]
126 [count(.|key('primary', &primary;)
128 mode="index-primary">
129 <xsl:sort select="&primary;" lang="{$lang}"/>
130 <xsl:with-param name="scope" select="$scope"/>
131 <xsl:with-param name="role" select="$role"/>
132 <xsl:with-param name="type" select="$type"/>
133 </xsl:apply-templates>