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 | <!-- Version 0.8.0 - Manuel Canales Esparcia <macana@lfs-es.org> -->
|
---|
10 |
|
---|
11 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
12 | xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
---|
13 | version="1.0">
|
---|
14 |
|
---|
15 | <!--Index Stuff-->
|
---|
16 |
|
---|
17 | <!--Only one column to fit the targets titles-->
|
---|
18 | <xsl:param name="column.count.index" select="1"></xsl:param>
|
---|
19 |
|
---|
20 | <!--Title-->
|
---|
21 | <xsl:template match="index" mode="title.markup">
|
---|
22 | <xsl:param name="allow-anchors" select="0"/>
|
---|
23 | <xsl:text>Index of packages and important installed files</xsl:text>
|
---|
24 | </xsl:template>
|
---|
25 |
|
---|
26 | <!-- Divisions-->
|
---|
27 | <xsl:template match="indexterm" mode="index-div">
|
---|
28 | <xsl:param name="scope" select="."/>
|
---|
29 | <xsl:variable name="key"
|
---|
30 | select="translate(substring(&primary;, 1, 1),&lowercase;,&uppercase;)"/>
|
---|
31 | <xsl:variable name="divtitle" select="translate($key, &lowercase;, &uppercase;)"/>
|
---|
32 | <xsl:if test="key('letter', $key)[&scope;]
|
---|
33 | [count(.|key('primary', &primary;)[&scope;][1]) = 1]">
|
---|
34 | <fo:block>
|
---|
35 | <xsl:if test="contains(concat(&lowercase;, &uppercase;), $key)">
|
---|
36 | <xsl:call-template name="indexdiv.title">
|
---|
37 | <xsl:with-param name="titlecontent">
|
---|
38 | <xsl:choose>
|
---|
39 | <xsl:when test="$divtitle = 'A'">
|
---|
40 | <xsl:text>Packages</xsl:text>
|
---|
41 | </xsl:when>
|
---|
42 | <xsl:when test="$divtitle = 'B'">
|
---|
43 | <xsl:text>Programs</xsl:text>
|
---|
44 | </xsl:when>
|
---|
45 | <xsl:when test="$divtitle = 'C'">
|
---|
46 | <xsl:text>Libraries</xsl:text>
|
---|
47 | </xsl:when>
|
---|
48 | <xsl:when test="$divtitle = 'D'">
|
---|
49 | <xsl:text>Scripts</xsl:text>
|
---|
50 | </xsl:when>
|
---|
51 | <xsl:when test="$divtitle = 'E'">
|
---|
52 | <xsl:text>Others</xsl:text>
|
---|
53 | </xsl:when>
|
---|
54 | <xsl:otherwise>
|
---|
55 | <xsl:value-of select="$divtitle"/>
|
---|
56 | </xsl:otherwise>
|
---|
57 | </xsl:choose>
|
---|
58 | </xsl:with-param>
|
---|
59 | </xsl:call-template>
|
---|
60 | </xsl:if>
|
---|
61 | <fo:block>
|
---|
62 | <xsl:apply-templates select="key('letter', $key)[&scope;]
|
---|
63 | [count(.|key('primary', &primary;)[&scope;][1])=1]"
|
---|
64 | mode="index-primary">
|
---|
65 | <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
|
---|
66 | <xsl:with-param name="scope" select="$scope"/>
|
---|
67 | </xsl:apply-templates>
|
---|
68 | </fo:block>
|
---|
69 | </fo:block>
|
---|
70 | </xsl:if>
|
---|
71 | </xsl:template>
|
---|
72 |
|
---|
73 | <!-- The separator -->
|
---|
74 | <xsl:template match="indexterm" mode="reference">
|
---|
75 | <xsl:param name="scope" select="."/>
|
---|
76 | <xsl:text>: </xsl:text>
|
---|
77 | <xsl:call-template name="reference">
|
---|
78 | <xsl:with-param name="zones" select="normalize-space(@zone)"/>
|
---|
79 | <xsl:with-param name="scope" select="$scope"/>
|
---|
80 | </xsl:call-template>
|
---|
81 | </xsl:template>
|
---|
82 |
|
---|
83 | <!-- Targets titles and bookmarks-->
|
---|
84 | <xsl:template name="reference">
|
---|
85 | <xsl:param name="scope" select="."/>
|
---|
86 | <xsl:param name="zones"/>
|
---|
87 | <xsl:choose>
|
---|
88 | <xsl:when test="contains($zones, ' ')">
|
---|
89 | <xsl:variable name="zone" select="substring-before($zones, ' ')"/>
|
---|
90 | <xsl:variable name="zone2" select="substring-after($zones, ' ')"/>
|
---|
91 | <xsl:variable name="target" select="key('id', $zone)[&scope;]"/>
|
---|
92 | <xsl:variable name="target2" select="key('id', $zone2)[&scope;]"/>
|
---|
93 | <xsl:variable name="id">
|
---|
94 | <xsl:call-template name="object.id">
|
---|
95 | <xsl:with-param name="object" select="$target[1]"/>
|
---|
96 | </xsl:call-template>
|
---|
97 | </xsl:variable>
|
---|
98 | <xsl:variable name="id2">
|
---|
99 | <xsl:call-template name="object.id">
|
---|
100 | <xsl:with-param name="object" select="$target2[1]"/>
|
---|
101 | </xsl:call-template>
|
---|
102 | </xsl:variable>
|
---|
103 | <fo:basic-link internal-destination="{$id}">
|
---|
104 | <xsl:value-of select="$target/title"/>
|
---|
105 | <xsl:apply-templates select="$target" mode="page.citation">
|
---|
106 | <xsl:with-param name="id" select="$id"/>
|
---|
107 | </xsl:apply-templates>
|
---|
108 | </fo:basic-link>
|
---|
109 | <xsl:text>, </xsl:text>
|
---|
110 | <fo:basic-link internal-destination="{$id2}">
|
---|
111 | <xsl:text>description</xsl:text>
|
---|
112 | <xsl:apply-templates select="$target2" mode="page.citation">
|
---|
113 | <xsl:with-param name="id" select="$id2"/>
|
---|
114 | </xsl:apply-templates>
|
---|
115 | </fo:basic-link>
|
---|
116 | </xsl:when>
|
---|
117 | <xsl:otherwise>
|
---|
118 | <xsl:variable name="zone" select="$zones"/>
|
---|
119 | <xsl:variable name="target" select="key('id', $zone)[&scope;]"/>
|
---|
120 | <xsl:variable name="id">
|
---|
121 | <xsl:call-template name="object.id">
|
---|
122 | <xsl:with-param name="object" select="$target[1]"/>
|
---|
123 | </xsl:call-template>
|
---|
124 | </xsl:variable>
|
---|
125 | <fo:basic-link internal-destination="{$id}">
|
---|
126 | <xsl:value-of select="$target/title"/>
|
---|
127 | <xsl:apply-templates select="$target" mode="page.citation">
|
---|
128 | <xsl:with-param name="id" select="$id"/>
|
---|
129 | </xsl:apply-templates>
|
---|
130 | </fo:basic-link>
|
---|
131 | </xsl:otherwise>
|
---|
132 | </xsl:choose>
|
---|
133 | </xsl:template>
|
---|
134 |
|
---|
135 | </xsl:stylesheet>
|
---|