cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carloz Alaniz <car...@ti.com>
Subject Floating Point alignment
Date Tue, 03 Jul 2001 20:59:24 GMT
Does anybody know how to use XSLT to align floating point numbers in an
HTML Table?

(e.g.)

My ex.xml file looks like this:

<?xml-stylesheet href="ex.xsl" type="text/xsl"?>
<?cocoon-process type="xslt"?>
<mytable>
  <heading> My Heading </heading>
  <row> 1.234   </row>
  <row> 23.3432 </row>
  <row> 1.2     </row>
  <row> 111.221 </row>
</mytable>
---------------------
My ex.xsl file looks like this:

<?xml version='1.0'?> 
<xsl:stylesheet version="1.0" 
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

 <xsl:template match="/"> 
  <HTML><TITLE>Example</TITLE><BODY> 
  
  <TABLE border="3"> 
   <TR>
     <TD> <xsl:value-of select="mytable/heading"/> </TD>
   </TR>
   <xsl:for-each select="mytable/row"> 
   <TR>
     <TD align="center"><xsl:value-of select="."/></TD>
   </TR>
   </xsl:for-each> 
   </TABLE>

   </BODY></HTML> 
  </xsl:template> 
</xsl:stylesheet>
----------------------------------------------
My HTML table looks like this:

------------
| My Heading |
 ------------
|   1.234    |
 ------------
|  23.3432   |   
 ------------
|    1.2     |
 ------------
|   111.221  |
 ------------
If you look at the columns in my example, you will see that Floating
Point alignment does not take place correctly.

Has anyboy encountered this kind of problem or can help me fix it so
that my alignment will be correct such as:
--------------
| My Heading  |
 -------------
|    1.234    |
 -------------
|   23.3432   |   
 -------------
|    1.2      |
 -------------
|  111.221    |
 ------------
Mime
View raw message