source: stylesheets/pdf/lfs-index.xsl@ aaeb190

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 6.1 6.1.1 6.3 6.4 6.5 6.6 6.7 6.8 7.0 7.1 7.2 7.3 7.4 7.5 7.5-systemd 7.6 7.6-systemd 7.7 7.7-systemd 7.8 7.8-systemd 7.9 7.9-systemd 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since aaeb190 was f7bd105, checked in by Manuel Canales Esparcia <manuel@…>, 19 years ago

Updated the stylesheets and Makefile.
Removed contrib/, index-pdf.xml and goTidy.

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@4428 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 5.9 KB
Line 
1<?xml version='1.0' encoding='ISO-8859-1'?>
2<!DOCTYPE xsl:stylesheet [
3<!ENTITY lowercase "'abcdefghijklmnopqrstuvwxyz'">
4<!ENTITY uppercase "'ABCDEFGHIJKLMNOPQRSTUVWXYZ'">
5<!ENTITY primary 'normalize-space(concat(primary/@sortas, primary[not(@sortas)]))'>
6<!ENTITY scope 'count(ancestor::node()|$scope) = count(ancestor::node())'>
7]>
8
9<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
10 xmlns:fo="http://www.w3.org/1999/XSL/Format"
11 version="1.0">
12
13 <!--Title-->
14 <xsl:template match="index" mode="title.markup">
15 <xsl:param name="allow-anchors" select="0"/>
16 <xsl:call-template name="gentext">
17 <xsl:with-param name="key">Index</xsl:with-param>
18 </xsl:call-template>
19 </xsl:template>
20
21 <!-- Divisions-->
22 <xsl:template match="indexterm" mode="index-div">
23 <xsl:param name="scope" select="."/>
24 <xsl:variable name="key"
25 select="translate(substring(&primary;, 1, 1),&lowercase;,&uppercase;)"/>
26 <xsl:variable name="divtitle" select="translate($key, &lowercase;, &uppercase;)"/>
27 <xsl:if test="key('letter', $key)[&scope;]
28 [count(.|key('primary', &primary;)[&scope;][1]) = 1]">
29 <fo:block>
30 <xsl:if test="contains(concat(&lowercase;, &uppercase;), $key)">
31 <xsl:call-template name="indexdiv.title">
32 <xsl:with-param name="titlecontent">
33 <xsl:choose>
34 <xsl:when test="$divtitle = 'A'">
35 <xsl:call-template name="gentext">
36 <xsl:with-param name="key">Packages</xsl:with-param>
37 </xsl:call-template>
38 </xsl:when>
39 <xsl:when test="$divtitle = 'B'">
40 <xsl:call-template name="gentext">
41 <xsl:with-param name="key">Programs</xsl:with-param>
42 </xsl:call-template>
43 </xsl:when>
44 <xsl:when test="$divtitle = 'C'">
45 <xsl:call-template name="gentext">
46 <xsl:with-param name="key">Libraries</xsl:with-param>
47 </xsl:call-template>
48 </xsl:when>
49 <xsl:when test="$divtitle = 'D'">
50 <xsl:call-template name="gentext">
51 <xsl:with-param name="key">Scripts</xsl:with-param>
52 </xsl:call-template>
53 </xsl:when>
54 <xsl:when test="$divtitle = 'E'">
55 <xsl:call-template name="gentext">
56 <xsl:with-param name="key">Others</xsl:with-param>
57 </xsl:call-template>
58 </xsl:when>
59 <xsl:otherwise>
60 <xsl:value-of select="$divtitle"/>
61 </xsl:otherwise>
62 </xsl:choose>
63 </xsl:with-param>
64 </xsl:call-template>
65 </xsl:if>
66 <fo:block>
67 <xsl:apply-templates select="key('letter', $key)[&scope;]
68 [count(.|key('primary', &primary;)[&scope;][1])=1]"
69 mode="index-primary">
70 <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
71 <xsl:with-param name="scope" select="$scope"/>
72 </xsl:apply-templates>
73 </fo:block>
74 </fo:block>
75 </xsl:if>
76 </xsl:template>
77
78 <!-- The separator -->
79 <xsl:template match="indexterm" mode="reference">
80 <xsl:param name="scope" select="."/>
81 <xsl:text>: </xsl:text>
82 <xsl:call-template name="reference">
83 <xsl:with-param name="zones" select="normalize-space(@zone)"/>
84 <xsl:with-param name="scope" select="$scope"/>
85 </xsl:call-template>
86 </xsl:template>
87
88 <!--Bookmarks-->
89 <xsl:template name="reference">
90 <xsl:param name="scope" select="."/>
91 <xsl:param name="zones"/>
92 <xsl:choose>
93 <xsl:when test="contains($zones, ' ')">
94 <xsl:variable name="zone" select="substring-before($zones, ' ')"/>
95 <xsl:variable name="zone2" select="substring-after($zones, ' ')"/>
96 <xsl:variable name="target" select="key('id', $zone)[&scope;]"/>
97 <xsl:variable name="target2" select="key('id', $zone2)[&scope;]"/>
98 <xsl:variable name="id">
99 <xsl:call-template name="object.id">
100 <xsl:with-param name="object" select="$target[1]"/>
101 </xsl:call-template>
102 </xsl:variable>
103 <xsl:variable name="id2">
104 <xsl:call-template name="object.id">
105 <xsl:with-param name="object" select="$target2[1]"/>
106 </xsl:call-template>
107 </xsl:variable>
108 <fo:basic-link internal-destination="{$id}">
109 <xsl:apply-templates select="$target" mode="page.citation">
110 <xsl:with-param name="id" select="$id"/>
111 </xsl:apply-templates>
112 </fo:basic-link>
113 <xsl:text> , </xsl:text>
114 <fo:basic-link internal-destination="{$id2}">
115 <xsl:apply-templates select="$target2" mode="page.citation">
116 <xsl:with-param name="id" select="$id2"/>
117 </xsl:apply-templates>
118 </fo:basic-link>
119 </xsl:when>
120 <xsl:otherwise>
121 <xsl:variable name="zone" select="$zones"/>
122 <xsl:variable name="target" select="key('id', $zone)[&scope;]"/>
123 <xsl:variable name="id">
124 <xsl:call-template name="object.id">
125 <xsl:with-param name="object" select="$target[1]"/>
126 </xsl:call-template>
127 </xsl:variable>
128 <fo:basic-link internal-destination="{$id}">
129 <xsl:apply-templates select="$target" mode="page.citation">
130 <xsl:with-param name="id" select="$id"/>
131 </xsl:apply-templates>
132 </fo:basic-link>
133 </xsl:otherwise>
134 </xsl:choose>
135 </xsl:template>
136
137 <!-- Page number in Index-->
138 <xsl:template match="*" mode="page.citation">
139 <xsl:param name="id" select="'???'"/>
140 <fo:inline keep-together.within-line="always">
141 <!--<xsl:text>[p</xsl:text>-->
142 <fo:page-number-citation ref-id="{$id}"/>
143 <!--<xsl:text>]</xsl:text>-->
144 </fo:inline>
145 </xsl:template>
146
147</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.