Browse Source

Some code clean-up.

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/new-xsl@8139 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
Manuel Canales Esparcia 18 years ago
parent
commit
fded421024
7 changed files with 39 additions and 50 deletions
  1. 1 1
      lfs-common.xsl
  2. 1 1
      xhtml/lfs-index.xsl
  3. 3 16
      xhtml/lfs-legalnotice.xsl
  4. 6 11
      xhtml/lfs-mixed.xsl
  5. 23 16
      xhtml/lfs-navigational.xsl
  6. 4 4
      xhtml/lfs-sections.xsl
  7. 1 1
      xhtml/lfs-titles.xsl

+ 1 - 1
lfs-common.xsl

@@ -23,7 +23,7 @@
            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-->
+           entries in lfs-l10n.xml -->
   <xsl:param name="index-title">Index</xsl:param>
 
     <!-- Index title generation. -->

+ 1 - 1
xhtml/lfs-index.xsl

@@ -212,7 +212,7 @@
 
     <!-- The target links:
            Changed links separator.
-           On the cecond @zone link, we use a fixed string for the text
+           On the second @zone link, we use a fixed string for the text
            with gentext support.
            Assume that there is no more than 2 @zone in a indexterm.
            Use href.target.uri named template to resolve the links. It is faster

+ 3 - 16
xhtml/lfs-legalnotice.xsl

@@ -16,19 +16,12 @@
       <xsl:call-template name="object.id"/>
     </xsl:variable>
     <xsl:variable name="filename" select="concat($base.dir, 'legalnotice.html')"/>
-    <xsl:variable name="title">
-      <xsl:apply-templates select="." mode="title.markup"/>
-    </xsl:variable>
     <xsl:call-template name="write.chunk">
       <xsl:with-param name="filename" select="$filename"/>
       <xsl:with-param name="quiet" select="$chunk.quietly"/>
       <xsl:with-param name="content">
         <html>
-          <head>
-            <xsl:call-template name="system.head.content"/>
-            <xsl:call-template name="head.content"/>
-            <xsl:call-template name="user.head.content"/>
-          </head>
+          <xsl:call-template name="html.head"/>
           <body>
             <xsl:call-template name="body.attributes"/>
             <div class="{local-name(.)}">
@@ -37,10 +30,7 @@
             <div class="navfooter">
               <ul class="footerlinks">
                 <li class="home">
-                  <a accesskey="h">
-                    <xsl:attribute name="href">
-                      <xsl:text>index.html</xsl:text>
-                    </xsl:attribute>
+                  <a accesskey="h" href="index.html">
                     <xsl:attribute name="title">
                       <xsl:value-of select="/book/bookinfo/title"/>
                       <xsl:text> - </xsl:text>
@@ -64,10 +54,7 @@
     <!-- The original template is in {docbook-xsl}/xhtml/titlepage.xsl -->
   <xsl:template match="copyright" mode="titlepage.mode">
     <p class="{name(.)}">
-      <a>
-        <xsl:attribute name="href">
-          <xsl:value-of select="'legalnotice.html'"/>
-        </xsl:attribute>
+      <a href="legalnotice.html">
         <xsl:call-template name="gentext">
           <xsl:with-param name="key" select="'Copyright'"/>
         </xsl:call-template>

+ 6 - 11
xhtml/lfs-mixed.xsl

@@ -154,12 +154,10 @@
       SegmentedList.  If there are too many Segs or too few SegTitles,
       you'll get something odd...maybe an error -->
     <div class="seg">
-      <strong>
-        <span class="segtitle">
-          <xsl:apply-templates select="$segtitles[$segnum=position()]"
-                               mode="segtitle-in-seg"/>
-          <xsl:text>: </xsl:text>
-        </span>
+      <strong class="segtitle">
+        <xsl:apply-templates select="$segtitles[$segnum=position()]"
+                              mode="segtitle-in-seg"/>
+        <xsl:text>: </xsl:text>
       </strong>
       <span class="segbody">
         <xsl:if test="@id">
@@ -240,7 +238,6 @@
         <xsl:otherwise>3</xsl:otherwise>
       </xsl:choose>
     </xsl:variable>
-    <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
     <xsl:variable name="title">
       <xsl:call-template name="gentext">
         <xsl:with-param name="key">RevHistory</xsl:with-param>
@@ -248,13 +245,11 @@
     </xsl:variable>
     <xsl:variable name="contents">
       <div class="{name(.)}">
-        <table summary="Revision history">
+        <table summary="{$title}">
           <tr>
             <th colspan="{$numcols}">
               <b>
-                <xsl:call-template name="gentext">
-                  <xsl:with-param name="key" select="'RevHistory'"/>
-                </xsl:call-template>
+                <xsl:value-of select="$title"/>
               </b>
             </th>
           </tr>

+ 23 - 16
xhtml/lfs-navigational.xsl

@@ -26,10 +26,8 @@
     <xsl:param name="next" select="/foo"/>
     <xsl:variable name="up" select="parent::*"/>
     <xsl:variable name="home" select="/*[1]"/>
-    <xsl:variable name="row" select="count($prev) &gt; 0 or (count($up) &gt; 0
-            and generate-id($up) != generate-id($home)) or count($next) &gt; 0"/>
       <!-- Don't generate the header in index.html -->
-    <xsl:if test="$row and $home != .">
+    <xsl:if test="$home != .">
       <div class="navheader">
           <!-- Add common titles -->
         <div class="headertitles">
@@ -65,19 +63,16 @@
     <xsl:param name="next" select="/foo"/>
     <xsl:variable name="up" select="parent::*"/>
     <xsl:variable name="home" select="/*[1]"/>
-    <xsl:variable name="row" select="count($prev) &gt; 0 or count($up) &gt; 0
-            or count($next) &gt; 0 or generate-id($home) != generate-id(.)"/>
-    <xsl:if test="$row">
-      <div class="navfooter">
-          <!-- Create footer navigational links -->
-        <xsl:call-template name="navigational.links">
-          <xsl:with-param name="prev" select="$prev"/>
-          <xsl:with-param name="next" select="$next"/>
-          <xsl:with-param name="up" select="$up"/>
-          <xsl:with-param name="home" select="$home"/>
-        </xsl:call-template>
-      </div>
-    </xsl:if>
+      <!-- Create footer navigational links -->
+    <div class="navfooter">
+      <xsl:call-template name="navigational.links">
+        <xsl:with-param name="prev" select="$prev"/>
+        <xsl:with-param name="next" select="$next"/>
+        <xsl:with-param name="up" select="$up"/>
+        <xsl:with-param name="home" select="$home"/>
+      </xsl:call-template>
+    </div>
+      <!-- In HLFS, add the features.js call -->
     <xsl:if test="$book-type = 'hlfs'">
       <script type="text/javascript">
         <xsl:attribute name="src">
@@ -109,9 +104,12 @@
     <xsl:param name="up"/>
     <xsl:param name="home"/>
     <ul>
+        <!-- No prev link when prev is home -->
       <xsl:if test="count($prev)&gt;0 and $prev != $home">
         <li class="prev">
           <xsl:choose>
+              <!-- If prev is a dummy sect1 that is the first one in a chapter,
+                   links to the parent chapter.-->
             <xsl:when test="$prev[@role='dummy'] and
                             count(preceding-sibling::sect1)=1">
               <a accesskey="p">
@@ -131,6 +129,8 @@
                 <xsl:value-of select="../title"/>
               </p>
             </xsl:when>
+              <!-- If prev is a dummy sect1 that is not the first one in a chapter,
+                   links to the previous sect1.-->
             <xsl:when test="$prev[@role='dummy'] and
                             count(preceding-sibling::sect1)&gt;1">
               <a accesskey="p">
@@ -150,6 +150,7 @@
                 <xsl:value-of select="preceding-sibling::sect1[position()=2]/title"/>
               </p>
             </xsl:when>
+              <!-- Normal prev links -->
             <xsl:otherwise>
               <a accesskey="p">
                 <xsl:attribute name="href">
@@ -171,9 +172,11 @@
           </xsl:choose>
         </li>
       </xsl:if>
+        <!-- Next link except in the last page -->
       <xsl:if test="count($next)&gt;0">
         <li class="next">
           <xsl:choose>
+              <!-- Current page is sect1 a next is a dummy sect1, link to the next one -->
             <xsl:when test="$next[@role='dummy'] and local-name(.) = 'sect1'">
               <a accesskey="n">
                 <xsl:attribute name="href">
@@ -192,6 +195,7 @@
                 <xsl:value-of select="following-sibling::sect1[position()=2]/title"/>
               </p>
             </xsl:when>
+              <!-- Current page is chapter a next is a dummy sect1, link to the next one -->
             <xsl:when test="$next[@role='dummy'] and local-name(.) = 'chapter'">
               <a accesskey="n">
                 <xsl:attribute name="href">
@@ -210,6 +214,7 @@
                 <xsl:value-of select="descendant::sect1[position()=2]/title"/>
               </p>
             </xsl:when>
+              <!-- Normal next links. Take care of Index gentext support. -->
             <xsl:otherwise>
               <a accesskey="n">
                 <xsl:attribute name="href">
@@ -251,6 +256,7 @@
       </xsl:if>
       <li class="up">
         <xsl:choose>
+            <!-- Up link except if up is home -->
           <xsl:when test="count($up)&gt;0 and $up != $home">
             <a accesskey="u">
               <xsl:attribute name="href">
@@ -274,6 +280,7 @@
       </li>
       <li class="home">
         <xsl:choose>
+            <!-- No home link in home page -->
           <xsl:when test="$home != .">
             <a accesskey="h">
               <xsl:attribute name="href">

+ 4 - 4
xhtml/lfs-sections.xsl

@@ -11,7 +11,7 @@
   <xsl:param name="chunk.first.sections" select="1"/>
 
     <!-- preface:
-           Process the child elements before generating the TOC -->
+           Output non sect1 child elements before the TOC -->
     <!-- The original template is in {docbook-xsl}/xhtml/components.xsl -->
   <xsl:template match="preface">
     <xsl:call-template name="id.warning"/>
@@ -28,12 +28,12 @@
       </xsl:if>
       <xsl:call-template name="component.separator"/>
       <xsl:call-template name="preface.titlepage"/>
+      <xsl:apply-templates/>
       <xsl:variable name="toc.params">
         <xsl:call-template name="find.path.params">
           <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
         </xsl:call-template>
       </xsl:variable>
-      <xsl:apply-templates/>
       <xsl:if test="contains($toc.params, 'toc')">
         <xsl:call-template name="component.toc">
           <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
@@ -45,7 +45,7 @@
   </xsl:template>
 
     <!-- chapter:
-           Process the child elements before generating the TOC -->
+           Output non sect1 child elements before the TOC -->
     <!-- The original template is in {docbook-xsl}/xhtml/components.xsl -->
   <xsl:template match="chapter">
     <xsl:call-template name="id.warning"/>
@@ -62,12 +62,12 @@
       </xsl:if>
       <xsl:call-template name="component.separator"/>
       <xsl:call-template name="chapter.titlepage"/>
+      <xsl:apply-templates/>
       <xsl:variable name="toc.params">
         <xsl:call-template name="find.path.params">
           <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
         </xsl:call-template>
       </xsl:variable>
-      <xsl:apply-templates/>
       <xsl:if test="contains($toc.params, 'toc')">
         <xsl:call-template name="component.toc">
           <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>

+ 1 - 1
xhtml/lfs-titles.xsl

@@ -170,7 +170,7 @@
   </xsl:template>
 
     <!-- bridgehead:
-           When use always renderas attributes and want the output h* level
+           We use always renderas attributes and want the output h* level
            matching the defined sect* level.
            Create the anchor only if there is an @id. -->
     <!-- The original template is in {docbook-xsl}/xhtml/sections.xsl -->