Changeset 98493e2


Ignore:
Timestamp:
07/30/2006 07:05:14 PM (18 years ago)
Author:
Manuel Canales Esparcia <manuel@…>
Branches:
6.2
Children:
2eb0d7e
Parents:
9f76f83
Message:

Updated XSL PDF code to match current packages and patches pages tagging.

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

File:
1 edited

Legend:

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

    r9f76f83 r98493e2  
    1717 <xsl:template match="para">
    1818    <xsl:choose>
     19      <xsl:when test="child::ulink[@url=' ']"/>
    1920      <xsl:when test="./@remap='verbatim'">
    2021        <fo:block wrap-option="no-wrap"
     
    255256  </xsl:template>
    256257
     258    <!-- Total packages size calculation -->
     259  <xsl:template match="returnvalue">
     260    <xsl:call-template name="calculation">
     261     <xsl:with-param name="scope" select="../../variablelist"/>
     262    </xsl:call-template>
     263  </xsl:template>
     264
     265  <xsl:template name="calculation">
     266    <xsl:param name="scope"/>
     267    <xsl:param name="total">0</xsl:param>
     268    <xsl:param name="position">1</xsl:param>
     269    <xsl:variable name="tokens" select="count($scope/varlistentry)"/>
     270    <xsl:variable name="token" select="$scope/varlistentry[$position]/term/token"/>
     271    <xsl:variable name="size" select="substring-before($token,' KB')"/>
     272    <xsl:variable name="rawsize">
     273      <xsl:choose>
     274        <xsl:when test="contains($size,',')">
     275          <xsl:value-of select="concat(substring-before($size,','),substring-after($size,','))"/>
     276        </xsl:when>
     277        <xsl:otherwise>
     278          <xsl:value-of select="$size"/>
     279        </xsl:otherwise>
     280      </xsl:choose>
     281    </xsl:variable>
     282    <xsl:choose>
     283      <xsl:when test="$position &lt;= $tokens">
     284        <xsl:call-template name="calculation">
     285          <xsl:with-param name="scope" select="$scope"/>
     286          <xsl:with-param name="position" select="$position +1"/>
     287          <xsl:with-param name="total" select="$total + $rawsize"/>
     288        </xsl:call-template>
     289      </xsl:when>
     290      <xsl:otherwise>
     291        <xsl:choose>
     292          <xsl:when test="$total &lt; '1000'">
     293            <xsl:value-of select="$total"/>
     294            <xsl:text>  KB</xsl:text>
     295          </xsl:when>
     296          <xsl:when test="$total &gt; '1000' and $total &lt; '5000'">
     297            <xsl:value-of select="substring($total,1,1)"/>
     298            <xsl:text>,</xsl:text>
     299            <xsl:value-of select="substring($total,2)"/>
     300            <xsl:text>  KB</xsl:text>
     301          </xsl:when>
     302          <xsl:otherwise>
     303            <xsl:value-of select="round($total div 1024)"/>
     304            <xsl:text>  MB</xsl:text>
     305          </xsl:otherwise>
     306        </xsl:choose>
     307      </xsl:otherwise>
     308    </xsl:choose>
     309  </xsl:template>
     310
    257311</xsl:stylesheet>
Note: See TracChangeset for help on using the changeset viewer.