aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Canales Esparcia <manuel@linuxfromscratch.org>2006-07-30 19:05:14 +0000
committerManuel Canales Esparcia <manuel@linuxfromscratch.org>2006-07-30 19:05:14 +0000
commit8035189ca68d9823f268e29bdef2092a5f4e2990 (patch)
treef7d82587b95e4ce73bb8078788b94e74edadbc1f
parente6a5a463ccbae2ae05d67ba0dff30c2742611b63 (diff)
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
-rw-r--r--stylesheets/pdf/lfs-mixed.xsl54
1 files changed, 54 insertions, 0 deletions
diff --git a/stylesheets/pdf/lfs-mixed.xsl b/stylesheets/pdf/lfs-mixed.xsl
index ac096e5c9..da3665909 100644
--- a/stylesheets/pdf/lfs-mixed.xsl
+++ b/stylesheets/pdf/lfs-mixed.xsl
@@ -16,6 +16,7 @@
and to remove vertical space in pachages and patches pages. -->
<xsl:template match="para">
<xsl:choose>
+ <xsl:when test="child::ulink[@url=' ']"/>
<xsl:when test="./@remap='verbatim'">
<fo:block wrap-option="no-wrap"
white-space-collapse="false"
@@ -254,4 +255,57 @@
</xsl:choose>
</xsl:template>
+ <!-- Total packages size calculation -->
+ <xsl:template match="returnvalue">
+ <xsl:call-template name="calculation">
+ <xsl:with-param name="scope" select="../../variablelist"/>
+ </xsl:call-template>
+ </xsl:template>
+
+ <xsl:template name="calculation">
+ <xsl:param name="scope"/>
+ <xsl:param name="total">0</xsl:param>
+ <xsl:param name="position">1</xsl:param>
+ <xsl:variable name="tokens" select="count($scope/varlistentry)"/>
+ <xsl:variable name="token" select="$scope/varlistentry[$position]/term/token"/>
+ <xsl:variable name="size" select="substring-before($token,' KB')"/>
+ <xsl:variable name="rawsize">
+ <xsl:choose>
+ <xsl:when test="contains($size,',')">
+ <xsl:value-of select="concat(substring-before($size,','),substring-after($size,','))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$size"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$position &lt;= $tokens">
+ <xsl:call-template name="calculation">
+ <xsl:with-param name="scope" select="$scope"/>
+ <xsl:with-param name="position" select="$position +1"/>
+ <xsl:with-param name="total" select="$total + $rawsize"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$total &lt; '1000'">
+ <xsl:value-of select="$total"/>
+ <xsl:text> KB</xsl:text>
+ </xsl:when>
+ <xsl:when test="$total &gt; '1000' and $total &lt; '5000'">
+ <xsl:value-of select="substring($total,1,1)"/>
+ <xsl:text>,</xsl:text>
+ <xsl:value-of select="substring($total,2)"/>
+ <xsl:text> KB</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="round($total div 1024)"/>
+ <xsl:text> MB</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
</xsl:stylesheet>