Ignore:
Timestamp:
Mar 5, 2011, 9:27:15 PM (13 years ago)
Author:
Joe Ciccone <jciccone@…>
Children:
7b0cc7e8
Parents:
5171adc
Message:

Simplify the code to append the bits to the title as well as only
apply it to packages when there are multiple instances.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BOOK/stylesheets/clfs-profile.xsl

    r5171adc r33cb2bd  
    5050        </xsl:with-param>
    5151        <xsl:with-param name="bits" select="substring-before(concat($bits, ','), ',')" />
    52         <xsl:with-param name="multi"><xsl:text>multi</xsl:text></xsl:with-param>
     52        <xsl:with-param name="multibuild" select="$multibuild" />
    5353      </xsl:call-template>
    5454    </xsl:if>
     
    7171    <xsl:param name="idsuffix" /> <!-- Suffix to attach to the end of the ID for this perticular instance -->
    7272    <xsl:param name="bits" /> <!-- Which bit sizes to create a package for -->
    73     <xsl:param name="multi" /> <!-- multi/single build -->
     73    <xsl:param name="multibuild" /> <!-- Are there multiple instances of this package? -->
    7474
    7575    <xsl:for-each select="sect1">
     76
    7677      <xsl:copy>
     78
    7779        <xsl:attribute name="id">
    7880          <xsl:value-of select="concat($id, $idsuffix)" />
    7981        </xsl:attribute>
    80         <xsl:attribute name="role">
    81           <xsl:text>package</xsl:text>
    82         </xsl:attribute>
    83         <xsl:attribute name="condition">
    84           <xsl:value-of select="$multi" />
    85         </xsl:attribute>
     82
    8683        <xsl:processing-instruction name="dbhtml">
    8784          <xsl:text>filename=&quot;</xsl:text>
     
    8986          <xsl:text>.html&quot;</xsl:text>
    9087        </xsl:processing-instruction>
     88
     89        <xsl:for-each select="title">
     90          <xsl:element name="title">
     91            <xsl:copy-of select="@*|node()" />
     92            <xsl:if test="contains($clfs.multilib, ',') and ($multibuild = 'true')">
     93              <xsl:text> - </xsl:text>
     94              <xsl:choose>
     95                <xsl:when test="$bits = '32'">
     96                  <xsl:text>32Bit</xsl:text>
     97                </xsl:when>
     98                <xsl:when test="$bits = 'n32'">
     99                  <xsl:text>N32</xsl:text>
     100                </xsl:when>
     101                <xsl:when test="$bits = '64'">
     102                  <xsl:text>64Bit</xsl:text>
     103                </xsl:when>
     104              </xsl:choose>
     105            </xsl:if>
     106          </xsl:element>
     107        </xsl:for-each>
     108
    91109        <xsl:choose>
    92110          <xsl:when test="$bits = '32'">
    93             <xsl:apply-templates select="@*|node()" mode="filter-bits-32" />
     111            <xsl:apply-templates select="@*|node()[not(self::title)]" mode="filter-bits-32" />
    94112          </xsl:when>
    95113          <xsl:when test="$bits = 'n32'">
    96             <xsl:apply-templates select="@*|node()" mode="filter-bits-n32" />
     114            <xsl:apply-templates select="@*|node()[not(self::title)]" mode="filter-bits-n32" />
    97115          </xsl:when>
    98116          <xsl:when test="$bits = '64'">
    99             <xsl:apply-templates select="@*|node()" mode="filter-bits-64" />
     117            <xsl:apply-templates select="@*|node()[not(self::title)]" mode="filter-bits-64" />
    100118          </xsl:when>
    101119        </xsl:choose>
     120
    102121      </xsl:copy>
     122
    103123    </xsl:for-each>
     124
    104125  </xsl:template>
    105126
    106127  <!-- Apply the profile to the 32bit package -->
    107 
    108   <xsl:template match="//sect1/title" mode="filter-bits-32">
    109     <xsl:element name="title">
    110       <xsl:copy-of select="@*|node()" />
    111       <xsl:if test="contains($clfs.multilib, ',')">
    112         <xsl:text> - 32Bit</xsl:text>
    113       </xsl:if>
    114     </xsl:element>
    115   </xsl:template>
    116128
    117129  <xsl:template match="@*|node()" mode="filter-bits-32">
     
    142154
    143155  <!-- Apply the profile to the n32 package -->
    144  
    145   <xsl:template match="//sect1/title" mode="filter-bits-n32">
    146     <xsl:element name="title">
    147       <xsl:copy-of select="@*|node()" />
    148       <xsl:if test="contains($clfs.multilib, ',')">
    149         <xsl:text> - N32</xsl:text>
    150       </xsl:if>
    151     </xsl:element>
    152   </xsl:template>
    153156
    154157  <xsl:template match="@*|node()" mode="filter-bits-n32">
     
    179182
    180183  <!-- Apply the profile to the 64bit package -->
    181  
    182   <xsl:template match="//sect1/title" mode="filter-bits-64">
    183     <xsl:element name="title">
    184       <xsl:copy-of select="@*|node()" />
    185       <xsl:if test="contains($clfs.multilib, ',')">
    186         <xsl:text> - 64Bit</xsl:text>
    187       </xsl:if>
    188     </xsl:element>
    189   </xsl:template>
    190184
    191185  <xsl:template match="@*|node()" mode="filter-bits-64">
Note: See TracChangeset for help on using the changeset viewer.