فهرست منبع

Revised xhtml/lfs-titles.xsl

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/new-xsl@7995 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
Manuel Canales Esparcia 18 سال پیش
والد
کامیت
061b7ff63c
2فایلهای تغییر یافته به همراه71 افزوده شده و 30 حذف شده
  1. 53 30
      xhtml/lfs-titles.xsl
  2. 18 0
      xhtml/lfs-xref.xsl

+ 53 - 30
xhtml/lfs-titles.xsl

@@ -4,17 +4,26 @@
                 xmlns="http://www.w3.org/1999/xhtml"
                 version="1.0">
 
-  <xsl:template name="part.titlepage">
+   <!-- REVISED -->
+
+  <!-- This stylesheet controls the h* xhtml tags used for several titles -->
+
+    <!-- preface.titlepage:
+           Uses h1 and removed a lot of unneeded code.
+           No label in preface. -->
+    <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
+  <xsl:template name="preface.titlepage">
     <div class="titlepage">
       <h1 class="{name(.)}">
-        <xsl:apply-templates select="." mode="label.markup"/>
-        <xsl:text>. </xsl:text>
         <xsl:value-of select="title"/>
       </h1>
     </div>
   </xsl:template>
 
-  <xsl:template name="chapter.titlepage">
+    <!-- part.titlepage:
+           Uses h1 and removed a lot of unneeded code. -->
+    <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
+  <xsl:template name="part.titlepage">
     <div class="titlepage">
       <h1 class="{name(.)}">
         <xsl:apply-templates select="." mode="label.markup"/>
@@ -24,15 +33,23 @@
     </div>
   </xsl:template>
 
-  <xsl:template name="preface.titlepage">
+    <!-- appendix.titlepage:
+           Uses h1 and removed a lot of unneeded code. -->
+    <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
+  <xsl:template name="appendix.titlepage">
     <div class="titlepage">
       <h1 class="{name(.)}">
+        <xsl:apply-templates select="." mode="label.markup"/>
+        <xsl:text>. </xsl:text>
         <xsl:value-of select="title"/>
       </h1>
     </div>
   </xsl:template>
 
-  <xsl:template name="appendix.titlepage">
+    <!-- chapter.titlepage:
+           Uses h1 and removed a lot of unneeded code. -->
+    <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
+  <xsl:template name="chapter.titlepage">
     <div class="titlepage">
       <h1 class="{name(.)}">
         <xsl:apply-templates select="." mode="label.markup"/>
@@ -42,9 +59,13 @@
     </div>
   </xsl:template>
 
+    <!-- sect1.titlepage:
+           Uses h1 except for the first section, and removed a lot of unneeded code. -->
+    <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
   <xsl:template name="sect1.titlepage">
     <xsl:choose>
-        <!-- I should find a better test -->
+        <!-- I should find a better test, but if chapter TOC is readded
+             h1 will be used always, thus no need to worry for now. -->
       <xsl:when test="position() = 4">
         <div class="titlepage">
           <xsl:if test="@id">
@@ -69,6 +90,11 @@
     </xsl:choose>
   </xsl:template>
 
+    <!-- sect2.titlepage:
+           Uses h2 and removed a lot of unneeded code.
+           Skip empty titles.
+           No label in preface. -->
+    <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
   <xsl:template name="sect2.titlepage">
     <xsl:choose>
       <xsl:when test="string-length(title) = 0"/>
@@ -89,29 +115,26 @@
     </xsl:choose>
   </xsl:template>
 
-  <xsl:template name="dedication.titlepage">
-    <div class="titlepage">
-      <h2 class="{name(.)}">
-        <xsl:value-of select="title"/>
-      </h2>
-    </div>
-  </xsl:template>
-
-    <!-- Added the role param for proper punctuation in xref calls. -->
-  <xsl:template match="*" mode="insert.title.markup">
-    <xsl:param name="purpose"/>
-    <xsl:param name="xrefstyle"/>
-    <xsl:param name="title"/>
-    <xsl:param name="role"/>
-    <xsl:choose>
-      <xsl:when test="$purpose = 'xref' and titleabbrev">
-        <xsl:apply-templates select="." mode="titleabbrev.markup"/>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:copy-of select="$title"/>
-        <xsl:value-of select="$role"/>
-      </xsl:otherwise>
-    </xsl:choose>
+    <!-- bridgehead:
+           When use always renderas attributes and want the output h* level
+           matching the defined sect* level. -->
+    <!-- The original template is in {docbook-xsl}/xhtml/sections.xsl -->
+  <xsl:template match="bridgehead">
+    <xsl:variable name="hlevel">
+      <xsl:choose>
+        <xsl:when test="@renderas = 'sect1'">1</xsl:when>
+        <xsl:when test="@renderas = 'sect2'">2</xsl:when>
+        <xsl:when test="@renderas = 'sect3'">3</xsl:when>
+        <xsl:when test="@renderas = 'sect4'">4</xsl:when>
+        <xsl:when test="@renderas = 'sect5'">5</xsl:when>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:element name="h{$hlevel}" namespace="http://www.w3.org/1999/xhtml">
+      <xsl:call-template name="anchor">
+        <xsl:with-param name="conditional" select="0"/>
+      </xsl:call-template>
+      <xsl:apply-templates/>
+    </xsl:element>
   </xsl:template>
 
 </xsl:stylesheet>

+ 18 - 0
xhtml/lfs-xref.xsl

@@ -289,4 +289,22 @@
     </xsl:choose>
   </xsl:template>
 
+    <!-- insert.title.markup:
+           Added the role param for proper punctuation in xref calls. -->
+  <xsl:template match="*" mode="insert.title.markup">
+    <xsl:param name="purpose"/>
+    <xsl:param name="xrefstyle"/>
+    <xsl:param name="title"/>
+    <xsl:param name="role"/>
+    <xsl:choose>
+      <xsl:when test="$purpose = 'xref' and titleabbrev">
+        <xsl:apply-templates select="." mode="titleabbrev.markup"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:copy-of select="$title"/>
+        <xsl:value-of select="$role"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
 </xsl:stylesheet>