Sfoglia il codice sorgente

Placed common params and templates onto a separate file.

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/new-xsl@8028 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
Manuel Canales Esparcia 18 anni fa
parent
commit
9bf87fa622

+ 1 - 1
lfs-chunked.xsl

@@ -18,8 +18,8 @@
   <xsl:include href="docbook-xsl-snapshot/xhtml/profile-chunk-code.xsl"/>
 
     <!-- Including our customized chunks templates -->
-  <xsl:include href="xhtml/lfs-legalnotice.xsl"/>
   <xsl:include href="xhtml/lfs-index.xsl"/>
+  <xsl:include href="xhtml/lfs-legalnotice.xsl"/>
   <xsl:include href="xhtml/lfs-navigational.xsl"/>
 
 </xsl:stylesheet>

+ 2 - 4
lfs-chunked2.xsl

@@ -14,16 +14,14 @@
   <xsl:param name="chunker.output.encoding" select="'ISO-8859-1'"/>
 
     <!-- Including our customized elements templates -->
+  <xsl:include href="lfs-common.xsl"/>
   <xsl:include href="xhtml/lfs-admon.xsl"/>
-  <xsl:include href="xhtml/lfs-sections.xsl"/>
   <xsl:include href="xhtml/lfs-mixed.xsl"/>
+  <xsl:include href="xhtml/lfs-sections.xsl"/>
   <xsl:include href="xhtml/lfs-titles.xsl"/>
   <xsl:include href="xhtml/lfs-toc.xsl"/>
   <xsl:include href="xhtml/lfs-xref.xsl"/>
 
-    <!-- This file contains our localization strings (for internationalization) -->
-  <xsl:param name="local.l10n.xml" select="document('lfs-l10n.xml')"/>
-
     <!-- The CSS Stylesheets. We set here relative path from sub-dirs HTML files.
     The path from top-level HTML files (index.html, partX.html, etc) MUST be
     fixed via a sed in the Makefile-->

+ 430 - 0
lfs-common.xsl

@@ -0,0 +1,430 @@
+<?xml version='1.0' encoding='ISO-8859-1'?>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns="http://www.w3.org/1999/xhtml"
+                version="1.0">
+
+  <!-- This stylesheet contains common params and templates for all outputs. -->
+
+    <!-- This file contains our localization strings (for internationalization) -->
+  <xsl:param name="local.l10n.xml" select="document('lfs-l10n.xml')"/>
+
+
+<!-- INDEX -->
+
+    <!-- Should the Index be generated? 1 = yes, 0 = no -->
+  <xsl:param name="generate.index" select="1"></xsl:param>
+
+    <!-- The indexing method used. Only 'basic' is supported by xsltproc -->
+  <xsl:param name="index.method" select="'basic'"></xsl:param>
+
+    <!-- The Index title:
+           We create this param to can have gentext support in both
+           the Index page title and links that point to the Index page.
+           It also allow us to change the title, if wanted.
+           Note: To change the title involves creating the appropiate
+           entries in lfs-l10n.xml-->
+  <xsl:param name="index-title">Index</xsl:param>
+
+    <!-- Index title generation. -->
+    <!-- The original template is in {docbook-xsl}/common/titles.xsl -->
+  <xsl:template match="index" mode="title.markup">
+    <xsl:param name="allow-anchors" select="0"/>
+    <xsl:call-template name="gentext">
+      <xsl:with-param name="key" select="$index-title"/>
+    </xsl:call-template>
+  </xsl:template>
+
+    <!-- indexterm:
+           Dropping unneeded anchors and fo:wraper elemments. -->
+    <!-- The original templates are in {docbook-xsl}/{xhtml,fo}/index.xsl -->
+  <xsl:template match="indexterm"/>
+
+<!-- -->
+
+<!-- LABELS -->
+
+    <!-- Are sections enumerated? 1 = yes, 0 = no -->
+  <xsl:param name="section.autolabel" select="1"/>
+
+    <!-- Do section labels include the component label? 1 = yes, 0 = no -->
+  <xsl:param name="section.label.includes.component.label" select="1"/>
+
+    <!-- sect1 label.markup:
+           Use lowercase roman numbers for sect1 in preface. -->
+    <!-- The original template is in {docbook-xsl}/common/labels.xsl -->
+  <xsl:template match="sect1" mode="label.markup">
+    <!-- if the parent is a component, maybe label that too -->
+    <xsl:variable name="parent.is.component">
+      <xsl:call-template name="is.component">
+        <xsl:with-param name="node" select=".."/>
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="component.label">
+      <xsl:if test="$section.label.includes.component.label != 0
+                    and $parent.is.component != 0">
+        <xsl:variable name="parent.label">
+          <xsl:apply-templates select=".." mode="label.markup"/>
+        </xsl:variable>
+        <xsl:if test="$parent.label != ''">
+          <xsl:apply-templates select=".." mode="label.markup"/>
+          <xsl:apply-templates select=".." mode="intralabel.punctuation"/>
+        </xsl:if>
+      </xsl:if>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="@label">
+        <xsl:value-of select="@label"/>
+      </xsl:when>
+      <xsl:when test="$section.autolabel != 0">
+        <xsl:copy-of select="$component.label"/>
+        <xsl:choose>
+          <xsl:when test="ancestor::preface">
+            <xsl:number format="i" count="sect1"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:number format="1" count="sect1"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
+    <!-- sect2 label.markup:
+           Skip numeration for sect2 with empty title -->
+    <!-- The original template is in {docbook-xsl}/common/labels.xsl
+         It match also sect3, sect4, and sect5, that are unchanged. -->
+  <xsl:template match="sect2" mode="label.markup">
+    <xsl:if test="string-length(title) > 0">
+      <!-- label the parent -->
+      <xsl:variable name="parent.section.label">
+        <xsl:call-template name="label.this.section">
+          <xsl:with-param name="section" select=".."/>
+        </xsl:call-template>
+      </xsl:variable>
+      <xsl:if test="$parent.section.label != '0'">
+        <xsl:apply-templates select=".." mode="label.markup"/>
+        <xsl:apply-templates select=".." mode="intralabel.punctuation"/>
+      </xsl:if>
+      <xsl:choose>
+        <xsl:when test="@label">
+          <xsl:value-of select="@label"/>
+        </xsl:when>
+        <xsl:when test="$section.autolabel != 0">
+          <xsl:choose>
+            <!-- If the first sect2 isn't numbered, renumber the remainig sections -->
+            <xsl:when test="string-length(../sect2[1]/title) = 0">
+              <xsl:variable name="totalsect2">
+                <xsl:number count="sect2"/>
+              </xsl:variable>
+              <xsl:number value="$totalsect2 - 1"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:number count="sect2"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:message>label.markup: this can't happen!</xsl:message>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+  </xsl:template>
+
+<!-- -->
+
+<!-- XREF (see {xhtml,pdf}/xref.xsl) -->
+
+    <!-- mode object.xref.markup:
+           Propagate role to named template substitute-markup -->
+    <!-- The original template is in {docbook-xsl}/common/gentext.xsl -->
+  <xsl:template match="*" mode="object.xref.markup">
+    <xsl:param name="purpose"/>
+    <xsl:param name="xrefstyle"/>
+    <xsl:param name="referrer"/>
+    <xsl:param name="verbose" select="1"/>
+    <xsl:param name="role"/>
+    <xsl:variable name="template">
+      <xsl:choose>
+        <xsl:when test="starts-with(normalize-space($xrefstyle), 'select:')">
+          <xsl:call-template name="make.gentext.template">
+            <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
+            <xsl:with-param name="purpose" select="$purpose"/>
+            <xsl:with-param name="referrer" select="$referrer"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:when test="starts-with(normalize-space($xrefstyle), 'template:')">
+          <xsl:value-of select="substring-after(normalize-space($xrefstyle), 'template:')"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:apply-templates select="." mode="object.xref.template">
+            <xsl:with-param name="purpose" select="$purpose"/>
+            <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
+            <xsl:with-param name="referrer" select="$referrer"/>
+          </xsl:apply-templates>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:if test="$template = '' and $verbose != 0">
+      <xsl:message>
+        <xsl:text>object.xref.markup: empty xref template</xsl:text>
+        <xsl:text> for linkend="</xsl:text>
+        <xsl:value-of select="@id|@xml:id"/>
+        <xsl:text>" and @xrefstyle="</xsl:text>
+        <xsl:value-of select="$xrefstyle"/>
+        <xsl:text>"</xsl:text>
+      </xsl:message>
+    </xsl:if>
+    <xsl:call-template name="substitute-markup">
+      <xsl:with-param name="purpose" select="$purpose"/>
+      <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
+      <xsl:with-param name="referrer" select="$referrer"/>
+      <xsl:with-param name="template" select="$template"/>
+      <xsl:with-param name="verbose" select="$verbose"/>
+      <xsl:with-param name="role" select="$role"/>
+    </xsl:call-template>
+  </xsl:template>
+
+    <!-- substitute-markup:
+           Propagate role to mode insert.title.markup -->
+    <!-- The original template is in {docbook-xsl}/common/gentext.xsl -->
+  <xsl:template name="substitute-markup">
+    <xsl:param name="template" select="''"/>
+    <xsl:param name="allow-anchors" select="'0'"/>
+    <xsl:param name="title" select="''"/>
+    <xsl:param name="subtitle" select="''"/>
+    <xsl:param name="docname" select="''"/>
+    <xsl:param name="label" select="''"/>
+    <xsl:param name="pagenumber" select="''"/>
+    <xsl:param name="purpose"/>
+    <xsl:param name="xrefstyle"/>
+    <xsl:param name="referrer"/>
+    <xsl:param name="verbose"/>
+    <xsl:param name="role"/>
+    <xsl:choose>
+      <xsl:when test="contains($template, '%')">
+        <xsl:value-of select="substring-before($template, '%')"/>
+        <xsl:variable name="candidate"
+                      select="substring(substring-after($template, '%'), 1, 1)"/>
+        <xsl:choose>
+          <xsl:when test="$candidate = 't'">
+            <xsl:apply-templates select="." mode="insert.title.markup">
+              <xsl:with-param name="purpose" select="$purpose"/>
+              <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
+              <xsl:with-param name="role" select="$role"/>
+              <xsl:with-param name="title">
+                <xsl:choose>
+                  <xsl:when test="$title != ''">
+                    <xsl:copy-of select="$title"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                    <xsl:apply-templates select="." mode="title.markup">
+                      <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
+                      <xsl:with-param name="verbose" select="$verbose"/>
+                    </xsl:apply-templates>
+                  </xsl:otherwise>
+                </xsl:choose>
+              </xsl:with-param>
+            </xsl:apply-templates>
+          </xsl:when>
+          <xsl:when test="$candidate = 's'">
+            <xsl:apply-templates select="." mode="insert.subtitle.markup">
+              <xsl:with-param name="purpose" select="$purpose"/>
+              <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
+              <xsl:with-param name="subtitle">
+                <xsl:choose>
+                  <xsl:when test="$subtitle != ''">
+                    <xsl:copy-of select="$subtitle"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                    <xsl:apply-templates select="." mode="subtitle.markup">
+                      <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
+                    </xsl:apply-templates>
+                  </xsl:otherwise>
+                </xsl:choose>
+              </xsl:with-param>
+            </xsl:apply-templates>
+          </xsl:when>
+          <xsl:when test="$candidate = 'n'">
+            <xsl:apply-templates select="." mode="insert.label.markup">
+              <xsl:with-param name="purpose" select="$purpose"/>
+              <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
+              <xsl:with-param name="label">
+                <xsl:choose>
+                  <xsl:when test="$label != ''">
+                    <xsl:copy-of select="$label"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                    <xsl:apply-templates select="." mode="label.markup"/>
+                  </xsl:otherwise>
+                </xsl:choose>
+              </xsl:with-param>
+            </xsl:apply-templates>
+          </xsl:when>
+          <xsl:when test="$candidate = 'p'">
+            <xsl:apply-templates select="." mode="insert.pagenumber.markup">
+              <xsl:with-param name="purpose" select="$purpose"/>
+              <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
+              <xsl:with-param name="pagenumber">
+                <xsl:choose>
+                  <xsl:when test="$pagenumber != ''">
+                    <xsl:copy-of select="$pagenumber"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                    <xsl:apply-templates select="." mode="pagenumber.markup"/>
+                  </xsl:otherwise>
+                </xsl:choose>
+              </xsl:with-param>
+            </xsl:apply-templates>
+          </xsl:when>
+          <xsl:when test="$candidate = 'o'">
+            <!-- olink target document title -->
+            <xsl:apply-templates select="." mode="insert.olink.docname.markup">
+              <xsl:with-param name="purpose" select="$purpose"/>
+              <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
+              <xsl:with-param name="docname">
+                <xsl:choose>
+                  <xsl:when test="$docname != ''">
+                    <xsl:copy-of select="$docname"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                    <xsl:apply-templates select="." mode="olink.docname.markup"/>
+                  </xsl:otherwise>
+                </xsl:choose>
+              </xsl:with-param>
+            </xsl:apply-templates>
+          </xsl:when>
+          <xsl:when test="$candidate = 'd'">
+            <xsl:apply-templates select="." mode="insert.direction.markup">
+              <xsl:with-param name="purpose" select="$purpose"/>
+              <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
+              <xsl:with-param name="direction">
+                <xsl:choose>
+                  <xsl:when test="$referrer">
+                    <xsl:variable name="referent-is-below">
+                      <xsl:for-each select="preceding::xref">
+                        <xsl:if test="generate-id(.) = generate-id($referrer)">1</xsl:if>
+                      </xsl:for-each>
+                    </xsl:variable>
+                    <xsl:choose>
+                      <xsl:when test="$referent-is-below = ''">
+                        <xsl:call-template name="gentext">
+                          <xsl:with-param name="key" select="'above'"/>
+                        </xsl:call-template>
+                      </xsl:when>
+                      <xsl:otherwise>
+                        <xsl:call-template name="gentext">
+                          <xsl:with-param name="key" select="'below'"/>
+                        </xsl:call-template>
+                      </xsl:otherwise>
+                    </xsl:choose>
+                  </xsl:when>
+                  <xsl:otherwise>
+                    <xsl:message>Attempt to use %d in gentext with no referrer!</xsl:message>
+                  </xsl:otherwise>
+                </xsl:choose>
+              </xsl:with-param>
+            </xsl:apply-templates>
+          </xsl:when>
+          <xsl:when test="$candidate = '%' ">
+            <xsl:text>%</xsl:text>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:text>%</xsl:text><xsl:value-of select="$candidate"/>
+          </xsl:otherwise>
+        </xsl:choose>
+        <!-- recurse with the rest of the template string -->
+        <xsl:variable name="rest"
+              select="substring($template,
+              string-length(substring-before($template, '%'))+3)"/>
+        <xsl:call-template name="substitute-markup">
+          <xsl:with-param name="template" select="$rest"/>
+          <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
+          <xsl:with-param name="title" select="$title"/>
+          <xsl:with-param name="subtitle" select="$subtitle"/>
+          <xsl:with-param name="docname" select="$docname"/>
+          <xsl:with-param name="label" select="$label"/>
+          <xsl:with-param name="pagenumber" select="$pagenumber"/>
+          <xsl:with-param name="purpose" select="$purpose"/>
+          <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
+          <xsl:with-param name="referrer" select="$referrer"/>
+          <xsl:with-param name="verbose" select="$verbose"/>
+          <xsl:with-param name="role" select="$role"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$template"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+<!-- -->
+
+<!-- Total packages size calculation -->
+
+    <!-- returnvalue:
+            If the tag is not empty, apply the original template.
+            Otherwise apply the calculation template. -->
+  <xsl:template match="returnvalue">
+    <xsl:choose>
+      <xsl:when test="count(*)&gt;0">
+        <xsl:apply-imports/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="calculation">
+          <xsl:with-param name="scope" select="../../variablelist"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+    <!-- Self-made calculation template. -->
+  <xsl:template name="calculation">
+    <xsl:param name="scope"/>
+    <xsl:param name="total">0</xsl:param>
+    <xsl:param name="position">1</xsl:param>
+    <xsl:variable name="tokens" select="count($scope/varlistentry)"/>
+    <xsl:variable name="token" select="$scope/varlistentry[$position]/term/token"/>
+    <xsl:variable name="size" select="substring-before($token,' KB')"/>
+    <xsl:variable name="rawsize">
+      <xsl:choose>
+        <xsl:when test="contains($size,',')">
+          <xsl:value-of select="concat(substring-before($size,','),substring-after($size,','))"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$size"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="$position &lt;= $tokens">
+        <xsl:call-template name="calculation">
+          <xsl:with-param name="scope" select="$scope"/>
+          <xsl:with-param name="position" select="$position +1"/>
+          <xsl:with-param name="total" select="$total + $rawsize"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:choose>
+          <xsl:when test="$total &lt; '1000'">
+            <xsl:value-of select="$total"/>
+            <xsl:text>  KB</xsl:text>
+          </xsl:when>
+          <xsl:when test="$total &gt; '1000' and $total &lt; '5000'">
+            <xsl:value-of select="substring($total,1,1)"/>
+            <xsl:text>,</xsl:text>
+            <xsl:value-of select="substring($total,2)"/>
+            <xsl:text>  KB</xsl:text>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="round($total div 1024)"/>
+            <xsl:text>  MB</xsl:text>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+<!-- -->
+
+</xsl:stylesheet>

+ 1 - 3
lfs-nochunks.xsl

@@ -14,6 +14,7 @@
   <xsl:output method="html" encoding="ISO-8859-1" indent="no" />
 
    <!-- Including our others customized templates -->
+  <xsl:include href="lfs-common.xsl"/>
   <xsl:include href="xhtml/lfs-index.xsl"/>
   <xsl:include href="xhtml/lfs-mixed.xsl"/>
   <xsl:include href="xhtml/lfs-sections.xsl"/>
@@ -41,9 +42,6 @@
     <!-- How maximaly deep should be each TOC? -->
   <xsl:param name="toc.max.depth">3</xsl:param>
 
-    <!-- This file contains our localization strings (for internationalization) -->
-  <xsl:param name="local.l10n.xml" select="document('lfs-l10n.xml')"/>
-
     <!-- Dropping some unwanted style attributes -->
   <xsl:param name="ulink.target" select="''"></xsl:param>
   <xsl:param name="css.decoration" select="0"></xsl:param>

+ 1 - 3
lfs-pdf.xsl

@@ -19,6 +19,7 @@
   <!--<xsl:output  encoding="UTF-8" indent="yes" />-->
 
     <!-- Including our others customized templates. -->
+  <xsl:include href="lfs-common.xsl"/>
   <xsl:include href="pdf/lfs-admon.xsl"/>
   <xsl:include href="pdf/lfs-index.xsl"/>
   <xsl:include href="pdf/lfs-mixed.xsl"/>
@@ -29,9 +30,6 @@
     <!-- Activating FOP-1 extensions. We use FOP-0.93 as the FO procesor. -->
   <xsl:param name="fop1.extensions" select="1"/>
 
-    <!-- This file contains our localization strings (for internationalization) -->
-  <xsl:param name="local.l10n.xml" select="document('lfs-l10n.xml')"/>
-
     <!-- Desactivate draft mode at all. -->
   <xsl:param name="draft.mode" select="'no'"/>
 

+ 0 - 24
pdf/lfs-index.xsl

@@ -13,12 +13,6 @@
   <!-- This stylesheet controls how the Index is generated.
        Entities comes from {docbook-xsl}/common/entities.ent -->
 
-    <!-- Should the Index be generated? 1 = yes, 0 = no -->
-  <xsl:param name="generate.index" select="1"></xsl:param>
-
-    <!-- The indexing method used. Only 'basic' is supported by xsltproc -->
-  <xsl:param name="index.method" select="'basic'"></xsl:param>
-
     <!-- Override for punctuation separating an index term from its list
          of page references. -->
   <xsl:param name="index.term.separator" select="': '"></xsl:param>
@@ -53,19 +47,6 @@
     <xsl:attribute name="start-indent">0pt</xsl:attribute>
   </xsl:attribute-set>
 
-    <!-- The Index title.
-           This template is not actually needed but placed here
-           to allow to change the title, if wanted.
-           Note: To change the title involves creating the appropiate
-           entries in lfs-l10n.xml -->
-    <!-- The original template is in {docbook-xsl}/common/titles.xsl -->
-  <xsl:template match="index" mode="title.markup">
-    <xsl:param name="allow-anchors" select="0"/>
-    <xsl:call-template name="gentext">
-      <xsl:with-param name="key">Index</xsl:with-param>
-    </xsl:call-template>
-  </xsl:template>
-
     <!-- Divisions:
           Translate alphabetical divisons titles to by-type titles. -->
     <!-- The original template is in {docbook-xsl}/fo/autoidx.xsl -->
@@ -129,9 +110,4 @@
     </xsl:if>
   </xsl:template>
 
-    <!-- indexterm:
-           Dropping unneeded fo:wrapper -->
-    <!-- The original template is in {docbook-xsl}/fo/index.xsl -->
-  <xsl:template match="indexterm"/>
-
 </xsl:stylesheet>

+ 0 - 67
pdf/lfs-mixed.xsl

@@ -241,71 +241,4 @@
     </fo:list-item>
   </xsl:template>
 
-
-  <!-- Total packages size calculation -->
-
-    <!-- returnvalue:
-            If the tag is not empty, apply the original template.
-            Otherwise apply the calculation template. -->
-    <!-- The original template is in {docbook-xsl}/fo/inline.xsl -->
-  <xsl:template match="returnvalue">
-    <xsl:choose>
-      <xsl:when test="count(*)&gt;0">
-        <xsl:apply-imports/>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:call-template name="calculation">
-          <xsl:with-param name="scope" select="../../variablelist"/>
-        </xsl:call-template>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:template>
-
-    <!-- Self-made calculation template. -->
-  <xsl:template name="calculation">
-    <xsl:param name="scope"/>
-    <xsl:param name="total">0</xsl:param>
-    <xsl:param name="position">1</xsl:param>
-    <xsl:variable name="tokens" select="count($scope/varlistentry)"/>
-    <xsl:variable name="token" select="$scope/varlistentry[$position]/term/token"/>
-    <xsl:variable name="size" select="substring-before($token,' KB')"/>
-    <xsl:variable name="rawsize">
-      <xsl:choose>
-        <xsl:when test="contains($size,',')">
-          <xsl:value-of select="concat(substring-before($size,','),substring-after($size,','))"/>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:value-of select="$size"/>
-        </xsl:otherwise>
-      </xsl:choose>
-    </xsl:variable>
-    <xsl:choose>
-      <xsl:when test="$position &lt;= $tokens">
-        <xsl:call-template name="calculation">
-          <xsl:with-param name="scope" select="$scope"/>
-          <xsl:with-param name="position" select="$position +1"/>
-          <xsl:with-param name="total" select="$total + $rawsize"/>
-        </xsl:call-template>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:choose>
-          <xsl:when test="$total &lt; '1000'">
-            <xsl:value-of select="$total"/>
-            <xsl:text>  KB</xsl:text>
-          </xsl:when>
-          <xsl:when test="$total &gt; '1000' and $total &lt; '5000'">
-            <xsl:value-of select="substring($total,1,1)"/>
-            <xsl:text>,</xsl:text>
-            <xsl:value-of select="substring($total,2)"/>
-            <xsl:text>  KB</xsl:text>
-          </xsl:when>
-          <xsl:otherwise>
-            <xsl:value-of select="round($total div 1024)"/>
-            <xsl:text>  MB</xsl:text>
-          </xsl:otherwise>
-        </xsl:choose>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:template>
-
 </xsl:stylesheet>

+ 0 - 3
pdf/lfs-pagesetup.xsl

@@ -46,9 +46,6 @@
          Be sure that no uneeded fo:marker are generated. -->
   <xsl:param name="marker.section.level" select="-1"></xsl:param>
 
-    <!-- Dropping a blank page after book title. -->
-  <xsl:template name="book.titlepage.separator"/>
-
     <!-- book title:
           Centered the title and removed unused code. -->
     <!-- The original template is in {docbook-xsl}/fo/titlepage.templates.xsl -->

+ 0 - 47
pdf/lfs-sections.xsl

@@ -6,12 +6,6 @@
 
   <!-- This stylesheet controls how sections are handled -->
 
-    <!-- Are sections enumerated? 1 = yes, 0 = no -->
-  <xsl:param name="section.autolabel" select="1"/>
-
-    <!-- Do section labels include the component label? 1 = yes, 0 = no -->
-  <xsl:param name="section.label.includes.component.label" select="1"/>
-
      <!-- Force sect1 onto a new page -->
   <xsl:attribute-set name="section.level1.properties">
     <xsl:attribute name="break-before">
@@ -45,45 +39,4 @@
     </fo:block>
   </xsl:template>
 
-    <!-- sect2 label.markup:
-           Skip numeration for sect2 with empty title -->
-    <!-- The original template is in {docbook-xsl}/common/labels.xsl
-         It match also sect3, sect4, and sect5, that are unchanged. -->
-  <xsl:template match="sect2" mode="label.markup">
-    <xsl:if test="string-length(title) > 0">
-      <!-- label the parent -->
-      <xsl:variable name="parent.section.label">
-        <xsl:call-template name="label.this.section">
-          <xsl:with-param name="section" select=".."/>
-        </xsl:call-template>
-      </xsl:variable>
-      <xsl:if test="$parent.section.label != '0'">
-        <xsl:apply-templates select=".." mode="label.markup"/>
-        <xsl:apply-templates select=".." mode="intralabel.punctuation"/>
-      </xsl:if>
-      <xsl:choose>
-        <xsl:when test="@label">
-          <xsl:value-of select="@label"/>
-        </xsl:when>
-        <xsl:when test="$section.autolabel != 0">
-          <xsl:choose>
-            <!-- If the first sect2 isn't numbered, renumber the remainig sections -->
-            <xsl:when test="string-length(../sect2[1]/title) = 0">
-              <xsl:variable name="totalsect2">
-                <xsl:number count="sect2"/>
-              </xsl:variable>
-              <xsl:number value="$totalsect2 - 1"/>
-            </xsl:when>
-            <xsl:otherwise>
-              <xsl:number count="sect2"/>
-            </xsl:otherwise>
-          </xsl:choose>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:message>label.markup: this can't happen!</xsl:message>
-        </xsl:otherwise>
-      </xsl:choose>
-    </xsl:if>
-  </xsl:template>
-
 </xsl:stylesheet>

+ 1 - 224
pdf/lfs-xref.xsl

@@ -125,7 +125,7 @@
   </xsl:template>
 
     <!-- sect* mode xref-to:
-           Propagate role to mode object.xref.markup -->
+           Propagate role to mode object.xref.markup (see ../lfs-common.xsl) -->
     <!-- The original template is in {docbook-xsl}/fo/xref.xsl -->
   <xsl:template match="section|simplesect|sect1|sect2|sect3|sect4|sect5
                       |refsect1|refsect2|refsect3|refsection" mode="xref-to">
@@ -142,229 +142,6 @@
     </xsl:apply-templates>
   </xsl:template>
 
-    <!-- mode object.xref.markup:
-           Propagate role to named template substitute-markup -->
-    <!-- The original template is in {docbook-xsl}/common/gentext.xsl -->
-  <xsl:template match="*" mode="object.xref.markup">
-    <xsl:param name="purpose"/>
-    <xsl:param name="xrefstyle"/>
-    <xsl:param name="referrer"/>
-    <xsl:param name="verbose" select="1"/>
-    <xsl:param name="role"/>
-    <xsl:variable name="template">
-      <xsl:choose>
-        <xsl:when test="starts-with(normalize-space($xrefstyle), 'select:')">
-          <xsl:call-template name="make.gentext.template">
-            <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
-            <xsl:with-param name="purpose" select="$purpose"/>
-            <xsl:with-param name="referrer" select="$referrer"/>
-          </xsl:call-template>
-        </xsl:when>
-        <xsl:when test="starts-with(normalize-space($xrefstyle), 'template:')">
-          <xsl:value-of select="substring-after(normalize-space($xrefstyle), 'template:')"/>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:apply-templates select="." mode="object.xref.template">
-            <xsl:with-param name="purpose" select="$purpose"/>
-            <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
-            <xsl:with-param name="referrer" select="$referrer"/>
-          </xsl:apply-templates>
-        </xsl:otherwise>
-      </xsl:choose>
-    </xsl:variable>
-    <xsl:if test="$template = '' and $verbose != 0">
-      <xsl:message>
-        <xsl:text>object.xref.markup: empty xref template</xsl:text>
-        <xsl:text> for linkend="</xsl:text>
-        <xsl:value-of select="@id|@xml:id"/>
-        <xsl:text>" and @xrefstyle="</xsl:text>
-        <xsl:value-of select="$xrefstyle"/>
-        <xsl:text>"</xsl:text>
-      </xsl:message>
-    </xsl:if>
-    <xsl:call-template name="substitute-markup">
-      <xsl:with-param name="purpose" select="$purpose"/>
-      <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
-      <xsl:with-param name="referrer" select="$referrer"/>
-      <xsl:with-param name="template" select="$template"/>
-      <xsl:with-param name="verbose" select="$verbose"/>
-      <xsl:with-param name="role" select="$role"/>
-    </xsl:call-template>
-  </xsl:template>
-
-    <!-- substitute-markup:
-           Propagate role to mode insert.title.markup -->
-    <!-- The original template is in {docbook-xsl}/common/gentext.xsl -->
-  <xsl:template name="substitute-markup">
-    <xsl:param name="template" select="''"/>
-    <xsl:param name="allow-anchors" select="'0'"/>
-    <xsl:param name="title" select="''"/>
-    <xsl:param name="subtitle" select="''"/>
-    <xsl:param name="docname" select="''"/>
-    <xsl:param name="label" select="''"/>
-    <xsl:param name="pagenumber" select="''"/>
-    <xsl:param name="purpose"/>
-    <xsl:param name="xrefstyle"/>
-    <xsl:param name="referrer"/>
-    <xsl:param name="verbose"/>
-    <xsl:param name="role"/>
-    <xsl:choose>
-      <xsl:when test="contains($template, '%')">
-        <xsl:value-of select="substring-before($template, '%')"/>
-        <xsl:variable name="candidate"
-                      select="substring(substring-after($template, '%'), 1, 1)"/>
-        <xsl:choose>
-          <xsl:when test="$candidate = 't'">
-            <xsl:apply-templates select="." mode="insert.title.markup">
-              <xsl:with-param name="purpose" select="$purpose"/>
-              <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
-              <xsl:with-param name="role" select="$role"/>
-              <xsl:with-param name="title">
-                <xsl:choose>
-                  <xsl:when test="$title != ''">
-                    <xsl:copy-of select="$title"/>
-                  </xsl:when>
-                  <xsl:otherwise>
-                    <xsl:apply-templates select="." mode="title.markup">
-                      <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
-                      <xsl:with-param name="verbose" select="$verbose"/>
-                    </xsl:apply-templates>
-                  </xsl:otherwise>
-                </xsl:choose>
-              </xsl:with-param>
-            </xsl:apply-templates>
-          </xsl:when>
-          <xsl:when test="$candidate = 's'">
-            <xsl:apply-templates select="." mode="insert.subtitle.markup">
-              <xsl:with-param name="purpose" select="$purpose"/>
-              <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
-              <xsl:with-param name="subtitle">
-                <xsl:choose>
-                  <xsl:when test="$subtitle != ''">
-                    <xsl:copy-of select="$subtitle"/>
-                  </xsl:when>
-                  <xsl:otherwise>
-                    <xsl:apply-templates select="." mode="subtitle.markup">
-                      <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
-                    </xsl:apply-templates>
-                  </xsl:otherwise>
-                </xsl:choose>
-              </xsl:with-param>
-            </xsl:apply-templates>
-          </xsl:when>
-          <xsl:when test="$candidate = 'n'">
-            <xsl:apply-templates select="." mode="insert.label.markup">
-              <xsl:with-param name="purpose" select="$purpose"/>
-              <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
-              <xsl:with-param name="label">
-                <xsl:choose>
-                  <xsl:when test="$label != ''">
-                    <xsl:copy-of select="$label"/>
-                  </xsl:when>
-                  <xsl:otherwise>
-                    <xsl:apply-templates select="." mode="label.markup"/>
-                  </xsl:otherwise>
-                </xsl:choose>
-              </xsl:with-param>
-            </xsl:apply-templates>
-          </xsl:when>
-          <xsl:when test="$candidate = 'p'">
-            <xsl:apply-templates select="." mode="insert.pagenumber.markup">
-              <xsl:with-param name="purpose" select="$purpose"/>
-              <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
-              <xsl:with-param name="pagenumber">
-                <xsl:choose>
-                  <xsl:when test="$pagenumber != ''">
-                    <xsl:copy-of select="$pagenumber"/>
-                  </xsl:when>
-                  <xsl:otherwise>
-                    <xsl:apply-templates select="." mode="pagenumber.markup"/>
-                  </xsl:otherwise>
-                </xsl:choose>
-              </xsl:with-param>
-            </xsl:apply-templates>
-          </xsl:when>
-          <xsl:when test="$candidate = 'o'">
-            <!-- olink target document title -->
-            <xsl:apply-templates select="." mode="insert.olink.docname.markup">
-              <xsl:with-param name="purpose" select="$purpose"/>
-              <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
-              <xsl:with-param name="docname">
-                <xsl:choose>
-                  <xsl:when test="$docname != ''">
-                    <xsl:copy-of select="$docname"/>
-                  </xsl:when>
-                  <xsl:otherwise>
-                    <xsl:apply-templates select="." mode="olink.docname.markup"/>
-                  </xsl:otherwise>
-                </xsl:choose>
-              </xsl:with-param>
-            </xsl:apply-templates>
-          </xsl:when>
-          <xsl:when test="$candidate = 'd'">
-            <xsl:apply-templates select="." mode="insert.direction.markup">
-              <xsl:with-param name="purpose" select="$purpose"/>
-              <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
-              <xsl:with-param name="direction">
-                <xsl:choose>
-                  <xsl:when test="$referrer">
-                    <xsl:variable name="referent-is-below">
-                      <xsl:for-each select="preceding::xref">
-                        <xsl:if test="generate-id(.) = generate-id($referrer)">1</xsl:if>
-                      </xsl:for-each>
-                    </xsl:variable>
-                    <xsl:choose>
-                      <xsl:when test="$referent-is-below = ''">
-                        <xsl:call-template name="gentext">
-                          <xsl:with-param name="key" select="'above'"/>
-                        </xsl:call-template>
-                      </xsl:when>
-                      <xsl:otherwise>
-                        <xsl:call-template name="gentext">
-                          <xsl:with-param name="key" select="'below'"/>
-                        </xsl:call-template>
-                      </xsl:otherwise>
-                    </xsl:choose>
-                  </xsl:when>
-                  <xsl:otherwise>
-                    <xsl:message>Attempt to use %d in gentext with no referrer!</xsl:message>
-                  </xsl:otherwise>
-                </xsl:choose>
-              </xsl:with-param>
-            </xsl:apply-templates>
-          </xsl:when>
-          <xsl:when test="$candidate = '%' ">
-            <xsl:text>%</xsl:text>
-          </xsl:when>
-          <xsl:otherwise>
-            <xsl:text>%</xsl:text><xsl:value-of select="$candidate"/>
-          </xsl:otherwise>
-        </xsl:choose>
-        <!-- recurse with the rest of the template string -->
-        <xsl:variable name="rest"
-              select="substring($template,
-              string-length(substring-before($template, '%'))+3)"/>
-        <xsl:call-template name="substitute-markup">
-          <xsl:with-param name="template" select="$rest"/>
-          <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
-          <xsl:with-param name="title" select="$title"/>
-          <xsl:with-param name="subtitle" select="$subtitle"/>
-          <xsl:with-param name="docname" select="$docname"/>
-          <xsl:with-param name="label" select="$label"/>
-          <xsl:with-param name="pagenumber" select="$pagenumber"/>
-          <xsl:with-param name="purpose" select="$purpose"/>
-          <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
-          <xsl:with-param name="referrer" select="$referrer"/>
-          <xsl:with-param name="verbose" select="$verbose"/>
-          <xsl:with-param name="role" select="$role"/>
-        </xsl:call-template>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:value-of select="$template"/>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:template>
-
     <!-- insert.title.markup:
            Apply the role value. -->
     <!-- The original template is in {docbook-xsl}/fo/xref.xsl -->

+ 0 - 27
xhtml/lfs-index.xsl

@@ -19,12 +19,6 @@
        use of the entities from {docbook-xsl}/common/entities.ent.
        We add the relevant ones in the DOCTYPE to have more readable templates. -->
 
-    <!-- Should the Index be generated? 1 = yes, 0 = no -->
-  <xsl:param name="generate.index" select="1"></xsl:param>
-
-    <!-- The indexing method used. Only 'basic' is supported by xsltproc -->
-  <xsl:param name="index.method" select="'basic'"></xsl:param>
-
     <!-- The file name of the Index page.
          There is no upstream template with match="index", only a global
          match="*", thus the next template is enought to force the Index
@@ -33,22 +27,6 @@
     <xsl:text>longindex.html</xsl:text>
   </xsl:template>
 
-    <!-- The Index title:
-           We create this param to can have gettext support in both
-           the Index page title and links that point to the Index page.
-           It also allow us to change the title, if wanted.
-           Note: To change the title involves creating the appropiate
-           entries in lfs-l10n.xml-->
-  <xsl:param name="index-title">Index</xsl:param>
-
-    <!-- The Index title in links that points to it. -->
-    <!-- The original template is in {docbook-xsl}/common/titles.xsl -->
-  <xsl:template match="index" mode="title.markup">
-    <xsl:call-template name="gentext">
-      <xsl:with-param name="key" select="$index-title"/>
-    </xsl:call-template>
-  </xsl:template>
-
     <!-- The Index title in the longindex.html page:
            Removed a lot of code not useful for us.
            Forced h1 title size. -->
@@ -258,9 +236,4 @@
     </xsl:choose>
   </xsl:template>
 
-    <!-- indexterm:
-           Dropping unneeded anchors -->
-    <!-- The original template is in {docbook-xsl}/xhtml/index.xsl -->
-  <xsl:template match="indexterm"/>
-
 </xsl:stylesheet>

+ 0 - 67
xhtml/lfs-mixed.xsl

@@ -218,71 +218,4 @@
     </em>
   </xsl:template>
 
-
-  <!-- Total packages size calculation -->
-
-    <!-- returnvalue:
-            If the tag is not empty, apply the original template.
-            Otherwise apply the calculation template. -->
-    <!-- The original template is in {docbook-xsl}/xhtml/inline.xsl -->
-  <xsl:template match="returnvalue">
-    <xsl:choose>
-      <xsl:when test="count(*)&gt;0">
-        <xsl:apply-imports/>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:call-template name="calculation">
-        <xsl:with-param name="scope" select="../../variablelist"/>
-        </xsl:call-template>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:template>
-
-    <!-- Self-made calculation template. -->
-  <xsl:template name="calculation">
-    <xsl:param name="scope"/>
-    <xsl:param name="total">0</xsl:param>
-    <xsl:param name="position">1</xsl:param>
-    <xsl:variable name="tokens" select="count($scope/varlistentry)"/>
-    <xsl:variable name="token" select="$scope/varlistentry[$position]/term/token"/>
-    <xsl:variable name="size" select="substring-before($token,' KB')"/>
-    <xsl:variable name="rawsize">
-      <xsl:choose>
-        <xsl:when test="contains($size,',')">
-          <xsl:value-of select="concat(substring-before($size,','),substring-after($size,','))"/>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:value-of select="$size"/>
-        </xsl:otherwise>
-      </xsl:choose>
-    </xsl:variable>
-    <xsl:choose>
-      <xsl:when test="$position &lt;= $tokens">
-        <xsl:call-template name="calculation">
-          <xsl:with-param name="scope" select="$scope"/>
-          <xsl:with-param name="position" select="$position +1"/>
-          <xsl:with-param name="total" select="$total + $rawsize"/>
-        </xsl:call-template>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:choose>
-          <xsl:when test="$total &lt; '1000'">
-            <xsl:value-of select="$total"/>
-            <xsl:text>  KB</xsl:text>
-          </xsl:when>
-          <xsl:when test="$total &gt; '1000' and $total &lt; '5000'">
-            <xsl:value-of select="substring($total,1,1)"/>
-            <xsl:text>,</xsl:text>
-            <xsl:value-of select="substring($total,2)"/>
-            <xsl:text>  KB</xsl:text>
-          </xsl:when>
-          <xsl:otherwise>
-            <xsl:value-of select="round($total div 1024)"/>
-            <xsl:text>  MB</xsl:text>
-          </xsl:otherwise>
-        </xsl:choose>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:template>
-
 </xsl:stylesheet>

+ 1 - 1
xhtml/lfs-navigational.xsl

@@ -9,7 +9,7 @@
 
     <!-- html.head:
            Drop all navigational links from inside head xhtml output. -->
-    <!-- The original template is in {docbook-xsl}/xhtml/chink-common.xsl -->
+    <!-- The original template is in {docbook-xsl}/xhtml/chunk-common.xsl -->
   <xsl:template name="html.head">
     <head>
       <xsl:call-template name="system.head.content"/>

+ 0 - 87
xhtml/lfs-sections.xsl

@@ -59,91 +59,4 @@
     </div>
   </xsl:template>
 
-    <!-- Are sections enumerated? 1 = yes, 0 = no -->
-  <xsl:param name="section.autolabel" select="1"/>
-
-    <!-- Do section labels include the component label? 1 = yes, 0 = no -->
-  <xsl:param name="section.label.includes.component.label" select="1"/>
-
-    <!-- sect1 label.markup:
-           Use lowercase roman numbers for sect1 in preface. -->
-    <!-- The original template is in {docbook-xsl}/common/labels.xsl -->
-  <xsl:template match="sect1" mode="label.markup">
-    <!-- if the parent is a component, maybe label that too -->
-    <xsl:variable name="parent.is.component">
-      <xsl:call-template name="is.component">
-        <xsl:with-param name="node" select=".."/>
-      </xsl:call-template>
-    </xsl:variable>
-    <xsl:variable name="component.label">
-      <xsl:if test="$section.label.includes.component.label != 0
-                    and $parent.is.component != 0">
-        <xsl:variable name="parent.label">
-          <xsl:apply-templates select=".." mode="label.markup"/>
-        </xsl:variable>
-        <xsl:if test="$parent.label != ''">
-          <xsl:apply-templates select=".." mode="label.markup"/>
-          <xsl:apply-templates select=".." mode="intralabel.punctuation"/>
-        </xsl:if>
-      </xsl:if>
-    </xsl:variable>
-    <xsl:choose>
-      <xsl:when test="@label">
-        <xsl:value-of select="@label"/>
-      </xsl:when>
-      <xsl:when test="$section.autolabel != 0">
-        <xsl:copy-of select="$component.label"/>
-        <xsl:choose>
-          <xsl:when test="ancestor::preface">
-            <xsl:number format="i" count="sect1"/>
-          </xsl:when>
-          <xsl:otherwise>
-            <xsl:number format="1" count="sect1"/>
-          </xsl:otherwise>
-        </xsl:choose>
-      </xsl:when>
-    </xsl:choose>
-  </xsl:template>
-
-    <!-- sect2 label.markup:
-           Skip numeration for sect2 with empty title -->
-    <!-- The original template is in {docbook-xsl}/common/labels.xsl
-         It match also sect3, sect4, and sect5, that are unchanged. -->
-  <xsl:template match="sect2" mode="label.markup">
-    <xsl:if test="string-length(title) > 0">
-      <!-- label the parent -->
-      <xsl:variable name="parent.section.label">
-        <xsl:call-template name="label.this.section">
-          <xsl:with-param name="section" select=".."/>
-        </xsl:call-template>
-      </xsl:variable>
-      <xsl:if test="$parent.section.label != '0'">
-        <xsl:apply-templates select=".." mode="label.markup"/>
-        <xsl:apply-templates select=".." mode="intralabel.punctuation"/>
-      </xsl:if>
-      <xsl:choose>
-        <xsl:when test="@label">
-          <xsl:value-of select="@label"/>
-        </xsl:when>
-        <xsl:when test="$section.autolabel != 0">
-          <xsl:choose>
-            <!-- If the first sect2 isn't numbered, renumber the remainig sections -->
-            <xsl:when test="string-length(../sect2[1]/title) = 0">
-              <xsl:variable name="totalsect2">
-                <xsl:number count="sect2"/>
-              </xsl:variable>
-              <xsl:number value="$totalsect2 - 1"/>
-            </xsl:when>
-            <xsl:otherwise>
-              <xsl:number count="sect2"/>
-            </xsl:otherwise>
-          </xsl:choose>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:message>label.markup: this can't happen!</xsl:message>
-        </xsl:otherwise>
-      </xsl:choose>
-    </xsl:if>
-  </xsl:template>
-
 </xsl:stylesheet>

+ 1 - 224
xhtml/lfs-xref.xsl

@@ -98,7 +98,7 @@
   </xsl:template>
 
     <!-- sect* mode xref-to:
-           Propagate role to mode object.xref.markup -->
+           Propagate role to mode object.xref.markup (see ../lfs-common.xsl) -->
     <!-- The original template is in {docbook-xsl}/xhtml/xref.xsl -->
   <xsl:template match="section|simplesect|sect1|sect2|sect3|sect4|sect5|refsect1
                        |refsect2|refsect3|refsection" mode="xref-to">
@@ -115,229 +115,6 @@
     </xsl:apply-templates>
   </xsl:template>
 
-    <!-- mode object.xref.markup:
-           Propagate role to named template substitute-markup -->
-    <!-- The original template is in {docbook-xsl}/common/gentext.xsl -->
-  <xsl:template match="*" mode="object.xref.markup">
-    <xsl:param name="purpose"/>
-    <xsl:param name="xrefstyle"/>
-    <xsl:param name="referrer"/>
-    <xsl:param name="verbose" select="1"/>
-    <xsl:param name="role"/>
-    <xsl:variable name="template">
-      <xsl:choose>
-        <xsl:when test="starts-with(normalize-space($xrefstyle), 'select:')">
-          <xsl:call-template name="make.gentext.template">
-            <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
-            <xsl:with-param name="purpose" select="$purpose"/>
-            <xsl:with-param name="referrer" select="$referrer"/>
-          </xsl:call-template>
-        </xsl:when>
-        <xsl:when test="starts-with(normalize-space($xrefstyle), 'template:')">
-          <xsl:value-of select="substring-after(normalize-space($xrefstyle), 'template:')"/>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:apply-templates select="." mode="object.xref.template">
-            <xsl:with-param name="purpose" select="$purpose"/>
-            <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
-            <xsl:with-param name="referrer" select="$referrer"/>
-          </xsl:apply-templates>
-        </xsl:otherwise>
-      </xsl:choose>
-    </xsl:variable>
-    <xsl:if test="$template = '' and $verbose != 0">
-      <xsl:message>
-        <xsl:text>object.xref.markup: empty xref template</xsl:text>
-        <xsl:text> for linkend="</xsl:text>
-        <xsl:value-of select="@id|@xml:id"/>
-        <xsl:text>" and @xrefstyle="</xsl:text>
-        <xsl:value-of select="$xrefstyle"/>
-        <xsl:text>"</xsl:text>
-      </xsl:message>
-    </xsl:if>
-    <xsl:call-template name="substitute-markup">
-      <xsl:with-param name="purpose" select="$purpose"/>
-      <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
-      <xsl:with-param name="referrer" select="$referrer"/>
-      <xsl:with-param name="template" select="$template"/>
-      <xsl:with-param name="verbose" select="$verbose"/>
-      <xsl:with-param name="role" select="$role"/>
-    </xsl:call-template>
-  </xsl:template>
-
-    <!-- substitute-markup:
-           Propagate role to mode insert.title.markup -->
-    <!-- The original template is in {docbook-xsl}/common/gentext.xsl -->
-  <xsl:template name="substitute-markup">
-    <xsl:param name="template" select="''"/>
-    <xsl:param name="allow-anchors" select="'0'"/>
-    <xsl:param name="title" select="''"/>
-    <xsl:param name="subtitle" select="''"/>
-    <xsl:param name="docname" select="''"/>
-    <xsl:param name="label" select="''"/>
-    <xsl:param name="pagenumber" select="''"/>
-    <xsl:param name="purpose"/>
-    <xsl:param name="xrefstyle"/>
-    <xsl:param name="referrer"/>
-    <xsl:param name="verbose"/>
-    <xsl:param name="role"/>
-    <xsl:choose>
-      <xsl:when test="contains($template, '%')">
-        <xsl:value-of select="substring-before($template, '%')"/>
-        <xsl:variable name="candidate"
-                      select="substring(substring-after($template, '%'), 1, 1)"/>
-        <xsl:choose>
-          <xsl:when test="$candidate = 't'">
-            <xsl:apply-templates select="." mode="insert.title.markup">
-              <xsl:with-param name="purpose" select="$purpose"/>
-              <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
-              <xsl:with-param name="role" select="$role"/>
-              <xsl:with-param name="title">
-                <xsl:choose>
-                  <xsl:when test="$title != ''">
-                    <xsl:copy-of select="$title"/>
-                  </xsl:when>
-                  <xsl:otherwise>
-                    <xsl:apply-templates select="." mode="title.markup">
-                      <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
-                      <xsl:with-param name="verbose" select="$verbose"/>
-                    </xsl:apply-templates>
-                  </xsl:otherwise>
-                </xsl:choose>
-              </xsl:with-param>
-            </xsl:apply-templates>
-          </xsl:when>
-          <xsl:when test="$candidate = 's'">
-            <xsl:apply-templates select="." mode="insert.subtitle.markup">
-              <xsl:with-param name="purpose" select="$purpose"/>
-              <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
-              <xsl:with-param name="subtitle">
-                <xsl:choose>
-                  <xsl:when test="$subtitle != ''">
-                    <xsl:copy-of select="$subtitle"/>
-                  </xsl:when>
-                  <xsl:otherwise>
-                    <xsl:apply-templates select="." mode="subtitle.markup">
-                      <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
-                    </xsl:apply-templates>
-                  </xsl:otherwise>
-                </xsl:choose>
-              </xsl:with-param>
-            </xsl:apply-templates>
-          </xsl:when>
-          <xsl:when test="$candidate = 'n'">
-            <xsl:apply-templates select="." mode="insert.label.markup">
-              <xsl:with-param name="purpose" select="$purpose"/>
-              <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
-              <xsl:with-param name="label">
-                <xsl:choose>
-                  <xsl:when test="$label != ''">
-                    <xsl:copy-of select="$label"/>
-                  </xsl:when>
-                  <xsl:otherwise>
-                    <xsl:apply-templates select="." mode="label.markup"/>
-                  </xsl:otherwise>
-                </xsl:choose>
-              </xsl:with-param>
-            </xsl:apply-templates>
-          </xsl:when>
-          <xsl:when test="$candidate = 'p'">
-            <xsl:apply-templates select="." mode="insert.pagenumber.markup">
-              <xsl:with-param name="purpose" select="$purpose"/>
-              <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
-              <xsl:with-param name="pagenumber">
-                <xsl:choose>
-                  <xsl:when test="$pagenumber != ''">
-                    <xsl:copy-of select="$pagenumber"/>
-                  </xsl:when>
-                  <xsl:otherwise>
-                    <xsl:apply-templates select="." mode="pagenumber.markup"/>
-                  </xsl:otherwise>
-                </xsl:choose>
-              </xsl:with-param>
-            </xsl:apply-templates>
-          </xsl:when>
-          <xsl:when test="$candidate = 'o'">
-            <!-- olink target document title -->
-            <xsl:apply-templates select="." mode="insert.olink.docname.markup">
-              <xsl:with-param name="purpose" select="$purpose"/>
-              <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
-              <xsl:with-param name="docname">
-                <xsl:choose>
-                  <xsl:when test="$docname != ''">
-                    <xsl:copy-of select="$docname"/>
-                  </xsl:when>
-                  <xsl:otherwise>
-                    <xsl:apply-templates select="." mode="olink.docname.markup"/>
-                  </xsl:otherwise>
-                </xsl:choose>
-              </xsl:with-param>
-            </xsl:apply-templates>
-          </xsl:when>
-          <xsl:when test="$candidate = 'd'">
-            <xsl:apply-templates select="." mode="insert.direction.markup">
-              <xsl:with-param name="purpose" select="$purpose"/>
-              <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
-              <xsl:with-param name="direction">
-                <xsl:choose>
-                  <xsl:when test="$referrer">
-                    <xsl:variable name="referent-is-below">
-                      <xsl:for-each select="preceding::xref">
-                        <xsl:if test="generate-id(.) = generate-id($referrer)">1</xsl:if>
-                      </xsl:for-each>
-                    </xsl:variable>
-                    <xsl:choose>
-                      <xsl:when test="$referent-is-below = ''">
-                        <xsl:call-template name="gentext">
-                          <xsl:with-param name="key" select="'above'"/>
-                        </xsl:call-template>
-                      </xsl:when>
-                      <xsl:otherwise>
-                        <xsl:call-template name="gentext">
-                          <xsl:with-param name="key" select="'below'"/>
-                        </xsl:call-template>
-                      </xsl:otherwise>
-                    </xsl:choose>
-                  </xsl:when>
-                  <xsl:otherwise>
-                    <xsl:message>Attempt to use %d in gentext with no referrer!</xsl:message>
-                  </xsl:otherwise>
-                </xsl:choose>
-              </xsl:with-param>
-            </xsl:apply-templates>
-          </xsl:when>
-          <xsl:when test="$candidate = '%' ">
-            <xsl:text>%</xsl:text>
-          </xsl:when>
-          <xsl:otherwise>
-            <xsl:text>%</xsl:text><xsl:value-of select="$candidate"/>
-          </xsl:otherwise>
-        </xsl:choose>
-        <!-- recurse with the rest of the template string -->
-        <xsl:variable name="rest"
-              select="substring($template,
-              string-length(substring-before($template, '%'))+3)"/>
-        <xsl:call-template name="substitute-markup">
-          <xsl:with-param name="template" select="$rest"/>
-          <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
-          <xsl:with-param name="title" select="$title"/>
-          <xsl:with-param name="subtitle" select="$subtitle"/>
-          <xsl:with-param name="docname" select="$docname"/>
-          <xsl:with-param name="label" select="$label"/>
-          <xsl:with-param name="pagenumber" select="$pagenumber"/>
-          <xsl:with-param name="purpose" select="$purpose"/>
-          <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
-          <xsl:with-param name="referrer" select="$referrer"/>
-          <xsl:with-param name="verbose" select="$verbose"/>
-          <xsl:with-param name="role" select="$role"/>
-        </xsl:call-template>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:value-of select="$template"/>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:template>
-
     <!-- insert.title.markup:
            Apply the role value. -->
     <!-- The original template is in {docbook-xsl}/xhtml/xref.xsl -->