This patch is against 

xml-cocoon2/webapp/stylesheets/system/status2html.xsl
cocoon_20_branch (branch: 1.2.2)

It display total and free memory as Bytes, KiloBytes or
MegaByte.

Before :

    -memory
        total   63896568 
        free    2431960

After :

    -memory
        total   60.94 MB (63896568)
        free    2374.96 KB (2431960)

-- 
Sébastien Koechlin - IVision - [EMAIL PROTECTED]
--- status2html.xsl.old Tue Nov 13 17:36:16 2001
+++ status2html.xsl     Tue Nov 13 17:41:16 2001
@@ -86,4 +86,46 @@
     </tr>
 
   </xsl:template>
+
+
+       <xsl:template match="status:value[../@status:name='memory' and ( 
+@status:name='total' or @status:name='free')]">
+               <tr>
+                       <td bgcolor="#0086b2" valign="top" align="left">
+                        <FONT face="arial,helvetica,sanserif" color="#ffffff">
+                               <xsl:value-of select="@status:name"/>
+                        </FONT>
+                       </td>
+                       <td bgcolor="ffffff" width="100%">
+                        <FONT face="arial,helvetica,sanserif">
+                               <xsl:call-template name="suffix">
+                                       <xsl:with-param 
+                                               name="bytes" 
+                                               select="number(.)"/>
+                               </xsl:call-template>
+                        </FONT>
+                       </td>
+               </tr>
+       </xsl:template>
+
+       <xsl:template name="suffix">
+               <xsl:param name="bytes"/>
+               <xsl:choose>
+                       <!-- More than 4 MB (=4194304) -->
+                       <xsl:when test="$bytes &gt;= 4194304">
+                               <xsl:value-of select="round($bytes div 10485.76) div 
+100"/> MB
+                               <small>(<xsl:value-of select="$bytes"/>)</small>
+                       </xsl:when>
+                       <!-- More than 4 KB (=4096) -->
+                       <xsl:when test="$bytes &gt; 4096">
+                               <xsl:value-of select="round($bytes div 10.24) div 
+100"/> KB
+                               <small>(<xsl:value-of select="$bytes"/>)</small>
+                       </xsl:when>
+                       <!-- Less -->
+                       <xsl:otherwise>
+                               <xsl:value-of select="$bytes"/> B
+                       </xsl:otherwise>
+               </xsl:choose>
+       </xsl:template>
+
+
 </xsl:stylesheet>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to