Changeset b1a51ac1 for stylesheets/lfs-xsl/xhtml
- Timestamp:
- 12/10/2013 11:37:38 PM (11 years ago)
- Branches:
- 7.5-systemd, 7.6-systemd, 7.7-systemd, 7.8-systemd, 7.9-systemd
- Children:
- 112db9d
- Parents:
- f2a5108
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
stylesheets/lfs-xsl/xhtml/lfs-index.xsl
rf2a5108 rb1a51ac1 1 <?xml version= '1.0' encoding='ISO-8859-1'?>1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 2 3 3 <!-- … … 21 21 version="1.0"> 22 22 23 <!-- This stylesheet controls how the Index is generated. 24 Due how they are created, the original XHTML stylesheets don't make 25 use of the entities from {docbook-xsl}/common/entities.ent. 26 We add the relevant ones in the DOCTYPE to have more readable templates. 27 Also, we remove support for @role and @type based Index due that it is 28 broken when used with @zone based cross-references. --> 29 30 <!-- The file name of the Index page. 31 There is no upstream template with match="index", only a global 32 match="*", thus the next template is enought to force the Index 33 filename. --> 23 <!-- Change the file name of the index page from the default ix01.html. 24 There is no upstream template with match="index", only a global 25 match="*", thus the following is enough to override the index 26 filename. --> 27 34 28 <xsl:template match="index" mode="recursive-chunk-filename"> 35 29 <xsl:text>longindex.html</xsl:text> 36 30 </xsl:template> 37 31 38 <!-- The Index title in the longindex.html page: 39 Removed a lot of code not useful for us. 40 Forced h1 title size. --> 41 <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl --> 42 <xsl:template name="index.titlepage"> 43 <h1 class="index"> 44 <xsl:call-template name="gentext"> 45 <xsl:with-param name="key" select="$index-title"/> 46 </xsl:call-template> 47 </h1> 48 </xsl:template> 49 50 <!--Divisions: 51 Translate alphabetical divisions titles to by-type titles. 52 Added gentext support to divisions titles. 53 Using h2 for divisions titles. 54 Changed output from dl format to ul format. --> 55 <!-- The original template is in {docbook-xsl}/xhtml/autoidx.xsl --> 32 <!-- Divisions: 33 Override the default division titles, translating them from the default 34 'A', 'B', etc. to 'Packages', 'Programs', etc. 35 Add gentext support to division titles. 36 Use h2 for division titles instead of the default h3. 37 Change main listings from dl to ul format. 38 The original template is in {docbook-xsl}/xhtml/autoidx.xsl --> 39 56 40 <xsl:template match="indexterm" mode="index-div-basic"> 57 41 <xsl:param name="scope" select="."/> 58 42 <xsl:variable name="key" select="translate(substring(&primary;, 1, 1),&lowercase;,&uppercase;)"/> 59 43 <xsl:variable name="divtitle" select="translate($key, &lowercase;, &uppercase;)"/> 60 <!-- Make sure that we don't generate a div if there are no terms in scope --> 44 <!-- Make sure that we don't generate a div if there are no terms in scope 45 --> 61 46 <xsl:if test="key('letter', $key)[&scope;] [count(.|key('primary', &primary;)[&scope;][1]) = 1]"> 62 47 <xsl:if test="contains(concat(&lowercase;, &uppercase;), $key)"> … … 132 117 </xsl:if> 133 118 <ul> 134 <xsl:apply-templates select="key('letter', $key)[&scope;] [count(.|key('primary', &primary;)[&scope;][1])=1]" 135 mode="index-primary"> 136 <xsl:with-param name="scope" select="$scope"/> 137 <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/> 138 </xsl:apply-templates> 119 <xsl:apply-templates select="key('letter', $key)[count(ancestor::node()|$scope) = count(ancestor::node())][count(.|key('primary', normalize-space(concat(primary/@sortas, " ", primary)))[count(ancestor::node()|$scope) = count(ancestor::node())][1])=1]" mode="index-primary"> 120 <xsl:with-param name="scope" select="$scope"/> 121 <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/> 122 </xsl:apply-templates> 139 123 </ul> 140 124 </xsl:if> 141 125 </xsl:template> 142 126 143 <!-- Dropping $term.separator and $number.separator from here. 144 We add our customized ones in the output flow. 145 As all our indexterm have @zone attributes, removed a lot of 146 unused code. --> 147 <!-- The original template is in {docbook-xsl}/xhtml/autoidx.xsl --> 148 <xsl:template match="indexterm" mode="reference"> 149 <xsl:param name="scope" select="."/> 150 <xsl:call-template name="reference"> 151 <xsl:with-param name="zones" select="normalize-space(@zone)"/> 152 <xsl:with-param name="scope" select="$scope"/> 153 </xsl:call-template> 154 </xsl:template> 155 156 <!-- Primary items: 157 Changed the output format from dl to ul. 158 Placed the term and separator into strong tags. 159 Placed the target links into a div. 160 Removed code for unused see and sealso childs. --> 161 <!-- The original template is in {docbook-xsl}/xhtml/autoidx.xsl --> 127 <!-- Primary items: 128 Place term and separator into strong tags. 129 Place target links into a div. 130 Change main listings from dl to ul format. 131 Removed code for unused see and sealso children. 132 The original template is in {docbook-xsl}/xhtml/autoidx.xsl --> 162 133 <xsl:template match="indexterm" mode="index-primary"> 163 134 <xsl:param name="scope" select="."/> 164 <xsl:variable name="key" select=" &primary;"/>165 <xsl:variable name="refs" select="key('primary', $key)[ &scope;]"/>135 <xsl:variable name="key" select="normalize-space(concat(primary/@sortas, " ", primary))"/> 136 <xsl:variable name="refs" select="key('primary', $key)[count(ancestor::node()|$scope) = count(ancestor::node())]"/> 166 137 <li> 167 138 <strong class="item"> … … 171 142 <span class='indexref'> 172 143 <xsl:for-each select="$refs[generate-id() = generate-id(key('primary-section',concat($key, &sep;, §ion.id;))[&scope;][1])]"> 144 <!--<xsl:for-each select="$refs[not(see) and not(secondary)][count(ancestor::node()|$scope) = count(ancestor::node()) = 0]">--> 173 145 <xsl:apply-templates select="." mode="reference"> 174 146 <xsl:with-param name="scope" select="$scope"/> … … 178 150 <xsl:if test="$refs/secondary"> 179 151 <ul> 180 <xsl:apply-templates select="$refs[secondary and count(.|key('secondary', concat($key, &sep;, &secondary;))[&scope;][1]) = 1]" 181 mode="index-secondary"> 152 <xsl:apply-templates select="$refs[secondary and count(.|key('secondary', concat($key, " ", normalize-space(concat(secondary/@sortas, " ", secondary))))[count(ancestor::node()|$scope) = count(ancestor::node()) ][1]) = 1]" mode="index-secondary"> 182 153 <xsl:with-param name="scope" select="$scope"/> 183 154 <xsl:sort select="translate(&secondary;, &lowercase;, &uppercase;)"/> … … 188 159 </xsl:template> 189 160 190 191 Changed the output format from dl to ul.192 Placed the term and separator into strong tags.193 Placed the target links into a div.194 Removed code for unused tertiary, see, and sealso childs. -->195 <!--The original template is in {docbook-xsl}/xhtml/autoidx.xsl -->161 <!-- Secondary items: 162 Place term and separator into strong tags. 163 Place target links into a div. 164 Change main listings from dl to ul format. 165 Removed code for unused tertiary, see and sealso children. 166 The original template is in {docbook-xsl}/xhtml/autoidx.xsl --> 196 167 <xsl:template match="indexterm" mode="index-secondary"> 197 168 <xsl:param name="scope" select="."/> 198 <xsl:variable name="key" select="concat( &primary;, &sep;, &secondary;)"/>199 <xsl:variable name="refs" select="key('secondary', $key)[ &scope;]"/>169 <xsl:variable name="key" select="concat(normalize-space(concat(primary/@sortas, " ", primary)), " ", normalize-space(concat(secondary/@sortas, " ", secondary)))"/> 170 <xsl:variable name="refs" select="key('secondary', $key)[count(ancestor::node()|$scope) = count(ancestor::node())]"/> 200 171 <li> 201 172 <strong class="secitem"> … … 213 184 </xsl:template> 214 185 215 <!-- The target links: 216 Changed links separator. 217 On the second @zone link, we use a fixed string for the text 218 with gentext support. 219 Assume that there is no more than 2 @zone in a indexterm. 220 Use href.target.uri named template to resolve the links. It is faster 221 than the default href.target named template. --> 222 <!-- The original template is in {docbook-xsl}/xhtml/autoidx.xsl --> 186 <!-- Drop $term.separator and $number.separator from here as customized ones 187 are added in the output flow. 188 As all the indexterms in the book have @zone attributes, removed a lot of 189 unused code. 190 The original template is in {docbook-xsl}/xhtml/autoidx.xsl --> 191 <xsl:template match="indexterm" mode="reference"> 192 <xsl:param name="scope" select="."/> 193 <xsl:call-template name="reference"> 194 <xsl:with-param name="zones" select="normalize-space(@zone)"/> 195 <xsl:with-param name="scope" select="$scope"/> 196 </xsl:call-template> 197 </xsl:template> 198 199 <!-- The target links: 200 Changed link separator 201 On the second @zone link, we use a fixed string for the text with gentext 202 support. 203 Assume that there are no more than 2 @zone in a indexterm. 204 Use href.target.uri named template to resolve the links. It is faster 205 than the default href.target named template. 206 The original template is in {docbook-xsl}/xhtml/autoidx.xsl --> 223 207 <xsl:template name="reference"> 224 208 <xsl:param name="scope" select="."/>
Note:
See TracChangeset
for help on using the changeset viewer.