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

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 afa7fb1 was 6872957, checked in by Manuel Canales Esparcia <manuel@…>, 20 years ago

Renamed the print stylesheets to pdf.

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

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