Ignore:
Timestamp:
05/07/2004 08:18:37 PM (20 years ago)
Author:
Matthew Burgess <matthew@…>
Children:
215e6dc
Parents:
ff979cd
Message:

Upgraded to lfs-xsl-0.9 (Manuel)

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/b5_1/BOOK@3518 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

File:
1 edited

Legend:

Unmodified
Added
Removed
  • stylesheets/pdf/lfs-index.xsl

    rff979cd r11b36cd  
    44<!ENTITY uppercase "'ABCDEFGHIJKLMNOPQRSTUVWXYZ'">
    55<!ENTITY primary   'normalize-space(concat(primary/@sortas, primary[not(@sortas)]))'>
     6<!ENTITY secondary 'normalize-space(concat(secondary/@sortas, secondary[not(@sortas)]))'>
    67<!ENTITY scope 'count(ancestor::node()|$scope) = count(ancestor::node())'>
     8<!ENTITY sep '" "'>
    79]>
    810
    9 <!-- Version 0.8.0 - Manuel Canales Esparcia <macana@lfs-es.org> -->
     11<!-- Version 0.9 - Manuel Canales Esparcia <macana@lfs-es.org> -->
    1012
    1113<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     
    1315                version="1.0">
    1416
    15 <!--Index Stuff-->
    16 
    17         <!--Only one column to fit the targets titles-->
    18   <xsl:param name="column.count.index" select="1"></xsl:param>
     17        <!--Only one column to fit the table layout-->
     18  <xsl:param name="column.count.index" select="1"/>
    1919
    2020    <!--Title-->
    2121  <xsl:template match="index" mode="title.markup">
    22         <xsl:param name="allow-anchors" select="0"/>
    2322    <xsl:text>Index of packages and important installed files</xsl:text>
    2423        </xsl:template>
     
    3938                <xsl:when test="$divtitle = 'A'">
    4039                  <xsl:text>Packages</xsl:text>
    41               </xsl:when>
    42               <xsl:when test="$divtitle = 'B'">
    43                   <xsl:text>Programs</xsl:text>
    44               </xsl:when>
    45               <xsl:when test="$divtitle = 'C'">
    46                   <xsl:text>Libraries</xsl:text>
    47               </xsl:when>
    48               <xsl:when test="$divtitle = 'D'">
    49                   <xsl:text>Scripts</xsl:text>
    50               </xsl:when>
    51               <xsl:when test="$divtitle = 'E'">
    52                   <xsl:text>Others</xsl:text>
    53               </xsl:when>
    54               <xsl:otherwise>
    55                 <xsl:value-of select="$divtitle"/>
    56               </xsl:otherwise>
    57             </xsl:choose>
     40                </xsl:when>
     41                <xsl:when test="$divtitle = 'B'">
     42                    <xsl:text>Programs</xsl:text>
     43                </xsl:when>
     44                <xsl:when test="$divtitle = 'C'">
     45                    <xsl:text>Libraries</xsl:text>
     46                </xsl:when>
     47                <xsl:when test="$divtitle = 'D'">
     48                    <xsl:text>Scripts</xsl:text>
     49                </xsl:when>
     50                <xsl:when test="$divtitle = 'E'">
     51                    <xsl:text>Others</xsl:text>
     52                </xsl:when>
     53                <xsl:otherwise>
     54                  <xsl:value-of select="$divtitle"/>
     55                </xsl:otherwise>
     56                </xsl:choose>
    5857            </xsl:with-param>
    5958          </xsl:call-template>
    6059        </xsl:if>
    61         <fo:block>
    62           <xsl:apply-templates select="key('letter', $key)[&scope;]
    63                                       [count(.|key('primary', &primary;)[&scope;][1])=1]"
    64                               mode="index-primary">
    65             <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
    66             <xsl:with-param name="scope" select="$scope"/>
    67           </xsl:apply-templates>
    68         </fo:block>
     60        <fo:table table-layout="fixed" width="100%">
     61                <fo:table-column column-number="1" column-width="11em"/>
     62                <fo:table-column column-number="2" column-width="19em"/>
     63                <fo:table-column column-number="3"/>
     64          <fo:table-body>
     65            <xsl:apply-templates select="key('letter', $key)[&scope;]
     66                                        [count(.|key('primary', &primary;)[&scope;][1])=1]"
     67                                mode="index-primary">
     68              <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
     69              <xsl:with-param name="scope" select="$scope"/>
     70            </xsl:apply-templates>
     71                </fo:table-body>
     72        </fo:table>
    6973      </fo:block>
    7074    </xsl:if>
    7175  </xsl:template>
    7276
    73         <!-- The separator -->
     77        <!-- Dropping the separator from here -->
    7478  <xsl:template match="indexterm" mode="reference">
    7579    <xsl:param name="scope" select="."/>
    76     <xsl:text>: </xsl:text>
    7780        <xsl:call-template name="reference">
    7881        <xsl:with-param name="zones" select="normalize-space(@zone)"/>
    7982        <xsl:with-param name="scope" select="$scope"/>
    8083      </xsl:call-template>
     84  </xsl:template>
     85
     86        <!-- Changing the output tags and re-addind the separator-->
     87  <xsl:template match="indexterm" mode="index-primary">
     88    <xsl:param name="scope" select="."/>
     89    <xsl:variable name="key" select="&primary;"/>
     90    <xsl:variable name="refs" select="key('primary', $key)[&scope;]"/>
     91    <fo:table-row>
     92        <fo:table-cell>
     93        <fo:block>
     94          <xsl:value-of select="primary"/>
     95          <xsl:text>: </xsl:text>
     96                                </fo:block>
     97      </fo:table-cell>
     98      <xsl:for-each select="$refs[not(see) and not(seealso)
     99                            and not(secondary)]">
     100        <xsl:apply-templates select="." mode="reference">
     101          <xsl:with-param name="scope" select="$scope"/>
     102        </xsl:apply-templates>
     103      </xsl:for-each>
     104                </fo:table-row>
     105                <xsl:if test="$refs/secondary">
     106      <xsl:apply-templates select="$refs[secondary and count(.|key('secondary',
     107                                concat($key, &sep;, &secondary;))[&scope;][1]) = 1]" mode="index-secondary">
     108                                <xsl:with-param name="scope" select="$scope"/>
     109                                <xsl:sort select="translate(&secondary;, &lowercase;, &uppercase;)"/>
     110                        </xsl:apply-templates>
     111                </xsl:if>
     112  </xsl:template>
     113
     114  <xsl:template match="indexterm" mode="index-secondary">
     115    <xsl:param name="scope" select="."/>
     116                <xsl:variable name="key" select="concat(&primary;, &sep;, &secondary;)"/>
     117    <xsl:variable name="refs" select="key('secondary', $key)[&scope;]"/>
     118    <fo:table-row>
     119        <fo:table-cell>
     120                    <fo:block start-indent="1pc">
     121          <xsl:value-of select="secondary"/>
     122          <xsl:text>: </xsl:text>
     123        </fo:block>
     124        </fo:table-cell>
     125      <xsl:for-each select="$refs[not(see) and not(seealso) and not(tertiary)]">
     126        <xsl:apply-templates select="." mode="reference">
     127          <xsl:with-param name="scope" select="$scope"/>
     128        </xsl:apply-templates>
     129      </xsl:for-each>
     130                </fo:table-row>
    81131  </xsl:template>
    82132 
     
    101151          </xsl:call-template>
    102152        </xsl:variable>
    103         <fo:basic-link internal-destination="{$id}">
    104           <xsl:value-of select="$target/title"/>
    105           <xsl:apply-templates select="$target" mode="page.citation">
    106                 <xsl:with-param name="id" select="$id"/>
    107           </xsl:apply-templates>
    108         </fo:basic-link>
    109           <xsl:text>, </xsl:text>
    110         <fo:basic-link internal-destination="{$id2}">
    111                 <xsl:text>description</xsl:text>
    112           <xsl:apply-templates select="$target2" mode="page.citation">
    113                 <xsl:with-param name="id" select="$id2"/>
    114           </xsl:apply-templates>
    115         </fo:basic-link>
     153        <fo:table-cell>
     154                <fo:block>
     155            <fo:basic-link internal-destination="{$id}">
     156              <xsl:value-of select="$target/title"/>
     157              <xsl:apply-templates select="$target" mode="page.citation">
     158                <xsl:with-param name="id" select="$id"/>
     159              </xsl:apply-templates>
     160            </fo:basic-link>
     161                </fo:block>
     162                                </fo:table-cell>
     163        <fo:table-cell>
     164                <fo:block>
     165            <fo:basic-link internal-destination="{$id2}">
     166              <xsl:text>description</xsl:text>
     167              <xsl:apply-templates select="$target2" mode="page.citation">
     168                <xsl:with-param name="id" select="$id2"/>
     169              </xsl:apply-templates>
     170            </fo:basic-link>
     171                </fo:block>
     172                                </fo:table-cell>
    116173      </xsl:when>
    117174      <xsl:otherwise>
     
    123180          </xsl:call-template>
    124181        </xsl:variable>
    125         <fo:basic-link internal-destination="{$id}">
    126           <xsl:value-of select="$target/title"/>
    127           <xsl:apply-templates select="$target" mode="page.citation">
    128                 <xsl:with-param name="id" select="$id"/>
    129           </xsl:apply-templates>
    130         </fo:basic-link>
     182        <fo:table-cell>
     183                <fo:block>
     184            <fo:basic-link internal-destination="{$id}">
     185              <xsl:value-of select="$target/title"/>
     186              <xsl:apply-templates select="$target" mode="page.citation">
     187                <xsl:with-param name="id" select="$id"/>
     188              </xsl:apply-templates>
     189            </fo:basic-link>
     190                </fo:block>
     191                                </fo:table-cell>
    131192      </xsl:otherwise>
    132193    </xsl:choose>
Note: See TracChangeset for help on using the changeset viewer.