source: BOOK/stylesheets/lfs-xsl/docbook-xsl-snapshot/xhtml/autoidx-kosek.xsl@ a7f7b63

systemd
Last change on this file since a7f7b63 was f8c4e94, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Added LFS XSL Stylesheets.

  • Property mode set to 100644
File size: 5.5 KB
Line 
1<?xml version="1.0" encoding="ASCII"?>
2<!--This file was created automatically by html2xhtml-->
3<!--from the HTML stylesheets.-->
4<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:i="urn:cz-kosek:functions:index" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:func="http://exslt.org/functions" xmlns:k="http://www.isogen.com/functions/com.isogen.saxoni18n.Saxoni18nService" xmlns:exslt="http://exslt.org/common" xmlns="http://www.w3.org/1999/xhtml" extension-element-prefixes="func exslt" exclude-result-prefixes="func exslt i l k" version="1.0">
5
6<!-- ********************************************************************
7 $Id$
8 ********************************************************************
9
10 This file is part of the XSL DocBook Stylesheet distribution.
11 See ../README or http://docbook.sf.net/release/xsl/current/ for
12 copyright and other information.
13
14 ******************************************************************** -->
15
16<!-- ==================================================================== -->
17<!-- The "kosek" method contributed by Jirka Kosek. -->
18
19<xsl:include href="../common/autoidx-kosek.xsl"/>
20
21<xsl:template name="generate-kosek-index">
22 <xsl:param name="scope" select="(ancestor::book|/)[last()]"/>
23
24 <xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
25 <xsl:if test="contains($vendor, 'libxslt')">
26 <xsl:message terminate="yes">
27 <xsl:text>ERROR: the 'kosek' index method does not </xsl:text>
28 <xsl:text>work with the xsltproc XSLT processor.</xsl:text>
29 </xsl:message>
30 </xsl:if>
31
32 <xsl:if test="contains($vendor, 'Saxonica')">
33 <xsl:message terminate="yes">
34 <xsl:text>ERROR: the 'kosek' index method does not </xsl:text>
35 <xsl:text>work with the Saxon 8 XSLT processor.</xsl:text>
36 </xsl:message>
37 </xsl:if>
38
39 <xsl:if test="not(function-available('exslt:node-set') or function-available('exslt:nodeSet'))">
40 <xsl:message terminate="yes">
41 <xsl:text>ERROR: the 'kosek' index method requires the </xsl:text>
42 <xsl:text>exslt:node-set() function. Use a processor that </xsl:text>
43 <xsl:text>has it, or use a different index method.</xsl:text>
44 </xsl:message>
45 </xsl:if>
46
47 <xsl:if test="not(function-available('i:group-index'))">
48 <xsl:message terminate="yes">
49 <xsl:text>ERROR: the 'kosek' index method requires the
50</xsl:text>
51 <xsl:text>index extension functions be imported:
52</xsl:text>
53 <xsl:text> xsl:import href="common/autoidx-kosek.xsl"</xsl:text>
54 </xsl:message>
55 </xsl:if>
56
57 <xsl:variable name="role">
58 <xsl:if test="$index.on.role != 0">
59 <xsl:value-of select="@role"/>
60 </xsl:if>
61 </xsl:variable>
62
63 <xsl:variable name="type">
64 <xsl:if test="$index.on.type != 0">
65 <xsl:value-of select="@type"/>
66 </xsl:if>
67 </xsl:variable>
68
69 <xsl:variable name="terms" select="//indexterm[count(.|key('group-code', i:group-index(normalize-space(concat(primary/@sortas, primary[not(@sortas) or @sortas = &quot;&quot;]))))[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))][1]) = 1 and not(@class = 'endofrange')]"/>
70
71 <div class="index">
72 <xsl:apply-templates select="$terms" mode="index-div-kosek">
73 <xsl:with-param name="scope" select="$scope"/>
74 <xsl:with-param name="role" select="$role"/>
75 <xsl:with-param name="type" select="$type"/>
76 <xsl:sort select="i:group-index(normalize-space(concat(primary/@sortas, primary[not(@sortas) or @sortas = &quot;&quot;])))" data-type="number"/>
77 </xsl:apply-templates>
78 </div>
79</xsl:template>
80
81<xsl:template match="indexterm" mode="index-div-kosek">
82 <xsl:param name="scope" select="."/>
83 <xsl:param name="role" select="''"/>
84 <xsl:param name="type" select="''"/>
85
86 <xsl:variable name="key" select="i:group-index(normalize-space(concat(primary/@sortas, primary[not(@sortas) or @sortas = &quot;&quot;])))"/>
87
88 <xsl:variable name="lang">
89 <xsl:call-template name="l10n.language"/>
90 </xsl:variable>
91
92 <xsl:if test="key('group-code', $key)[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))][count(.|key('primary', normalize-space(concat(primary/@sortas, primary[not(@sortas) or @sortas = &quot;&quot;])))[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))][1]) = 1]">
93 <div class="indexdiv">
94 <h3>
95 <xsl:value-of select="i:group-letter($key)"/>
96 </h3>
97 <dl>
98 <xsl:apply-templates select="key('group-code', $key)[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))][count(.|key('primary', normalize-space(concat(primary/@sortas, primary[not(@sortas) or @sortas = &quot;&quot;])))[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))][1])=1]" mode="index-primary">
99 <xsl:sort select="normalize-space(concat(primary/@sortas, primary[not(@sortas) or @sortas = &quot;&quot;]))" lang="{$lang}"/>
100 <xsl:with-param name="scope" select="$scope"/>
101 <xsl:with-param name="role" select="$role"/>
102 <xsl:with-param name="type" select="$type"/>
103 </xsl:apply-templates>
104 </dl>
105 </div>
106 </xsl:if>
107</xsl:template>
108
109</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.