浏览代码

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 年之前
父节点
当前提交
fded421024
共有 7 个文件被更改,包括 39 次插入50 次删除
  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.
            the Index page title and links that point to the Index page.
            It also allow us to change the title, if wanted.
            It also allow us to change the title, if wanted.
            Note: To change the title involves creating the appropiate
            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>
   <xsl:param name="index-title">Index</xsl:param>
 
 
     <!-- Index title generation. -->
     <!-- Index title generation. -->

+ 1 - 1
xhtml/lfs-index.xsl

@@ -212,7 +212,7 @@
 
 
     <!-- The target links:
     <!-- The target links:
            Changed links separator.
            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.
            with gentext support.
            Assume that there is no more than 2 @zone in a indexterm.
            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
            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:call-template name="object.id"/>
     </xsl:variable>
     </xsl:variable>
     <xsl:variable name="filename" select="concat($base.dir, 'legalnotice.html')"/>
     <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:call-template name="write.chunk">
       <xsl:with-param name="filename" select="$filename"/>
       <xsl:with-param name="filename" select="$filename"/>
       <xsl:with-param name="quiet" select="$chunk.quietly"/>
       <xsl:with-param name="quiet" select="$chunk.quietly"/>
       <xsl:with-param name="content">
       <xsl:with-param name="content">
         <html>
         <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>
           <body>
             <xsl:call-template name="body.attributes"/>
             <xsl:call-template name="body.attributes"/>
             <div class="{local-name(.)}">
             <div class="{local-name(.)}">
@@ -37,10 +30,7 @@
             <div class="navfooter">
             <div class="navfooter">
               <ul class="footerlinks">
               <ul class="footerlinks">
                 <li class="home">
                 <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:attribute name="title">
                       <xsl:value-of select="/book/bookinfo/title"/>
                       <xsl:value-of select="/book/bookinfo/title"/>
                       <xsl:text> - </xsl:text>
                       <xsl:text> - </xsl:text>
@@ -64,10 +54,7 @@
     <!-- The original template is in {docbook-xsl}/xhtml/titlepage.xsl -->
     <!-- The original template is in {docbook-xsl}/xhtml/titlepage.xsl -->
   <xsl:template match="copyright" mode="titlepage.mode">
   <xsl:template match="copyright" mode="titlepage.mode">
     <p class="{name(.)}">
     <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:call-template name="gentext">
           <xsl:with-param name="key" select="'Copyright'"/>
           <xsl:with-param name="key" select="'Copyright'"/>
         </xsl:call-template>
         </xsl:call-template>

+ 6 - 11
xhtml/lfs-mixed.xsl

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

+ 23 - 16
xhtml/lfs-navigational.xsl

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

+ 4 - 4
xhtml/lfs-sections.xsl

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

+ 1 - 1
xhtml/lfs-titles.xsl

@@ -170,7 +170,7 @@
   </xsl:template>
   </xsl:template>
 
 
     <!-- bridgehead:
     <!-- 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.
            matching the defined sect* level.
            Create the anchor only if there is an @id. -->
            Create the anchor only if there is an @id. -->
     <!-- The original template is in {docbook-xsl}/xhtml/sections.xsl -->
     <!-- The original template is in {docbook-xsl}/xhtml/sections.xsl -->