cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Case <mec...@ucdavis.edu>
Subject Xalan TestXSLT (C++ v 1.1) vs. Cocoon 1.8
Date Mon, 06 Aug 2001 17:20:12 GMT
Hi,

I would like someone to confirm my suspicion, if possible.  I have not
used cocoon very much.  However, I understand that it uses Xalan.  I
have a question related to compliance of the number() function
implemenation.  I work primarily with TestXSLT from Xalan C++ v1.1.  I
have the XML file:

<?xml version='1.0' encoding='UTF-8'?>
<?xml-stylesheet href="UseConvertSciToNumString.xsl" type="text/xsl"?>
<?cocoon-process type="xslt"?>
<main>
  <mynum num="1"/>
  <mynum num="-2"/>
  <mynum num="3E-3"/>
  <mynum num="-2E-4"/>
  <mynum num=".5E-3"/>
  <mynum num=".3E4"/>
  <mynum num=".2E-4"/>
  <mynum num="-.6E3"/>
  <mynum num="-.6E-4"/>
  <mynum num="6.022E23"/>
  <mynum num=".312E1"/>
  <mynum num="312E-2"/>
  <mynum num="-0.312E1"/>
  <mynum num="-312E-2"/>
  <mynum num="923.9E-1"/>
  <mynum num="1.625E-12"/>
  <mynum num="1.E-5"/>
  <mynum num="2.14160E-3"/>
</main>

and I run:

testXSLT -IN TestNumber.xml -OUT TestNumberOut.XML -XSL
UseConvertSciToNumString.xsl

and I get:

<?xml version="1.0" encoding="UTF-8"?>
<html><head><title>Output for web page</title></head><body><table
align="center"
border="1"><th>num</th><th>converted</th><th>number()</th>
  <tr><td>1</td><td>1</td><td>1</td></tr>
  <tr><td>-2</td><td>-2</td><td>-2</td></tr>
  <tr><td>3E-3</td><td>0.003</td><td>NaN</td></tr>
  <tr><td>-2E-4</td><td>-0.0002</td><td>NaN</td></tr>
  <tr><td>.5E-3</td><td>0.0005</td><td>NaN</td></tr>
  <tr><td>.3E4</td><td>3000</td><td>NaN</td></tr>
  <tr><td>.2E-4</td><td>0.00002</td><td>NaN</td></tr>
  <tr><td>-.6E3</td><td>-600</td><td>NaN</td></tr>
  <tr><td>-.6E-4</td><td>-0.00006</td><td>NaN</td></tr>
  <tr><td>6.022E23</td><td>60220000000000000000000</td><td>NaN</td></tr>
  <tr><td>.312E1</td><td>3.12</td><td>NaN</td></tr>
  <tr><td>312E-2</td><td>3.12</td><td>NaN</td></tr>
  <tr><td>-0.312E1</td><td>-3.12</td><td>NaN</td></tr>
  <tr><td>-312E-2</td><td>-3.12</td><td>NaN</td></tr>
  <tr><td>923.9E-1</td><td>92.39</td><td>NaN</td></tr>
  <tr><td>1.625E-12</td><td>0.000000000001625</td><td>NaN</td></tr>
  <tr><td>1.E-5</td><td>0.00001</td><td>NaN</td></tr>
  <tr><td>2.14160E-3</td><td>0.0021416</td><td>NaN</td></tr>
</table></body></html>

Notice that number() returns NaN for scientific notation.

here is the XSL file:

<xsl:stylesheet
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   version="1.0"
>
<!--
	Example usage of ConvertSciToNumString.xsl
-->

<xsl:template match="/">
  <html>
    <head>
      <title>Output for web page</title>
    </head>
    <body>
      <xsl:apply-templates/>
    </body>
  </html>
</xsl:template>

<xsl:template match="main">
  <table border="1" align="center">
    <th>num</th>
    <th>converted</th>    
    <th>number()</th>
    <xsl:apply-templates/>
  </table>
</xsl:template>

<xsl:template match="mynum">
  <tr>
    <td><xsl:value-of select="@num"/></td>
    <td>
      <xsl:call-template name="convertSciToNumString">
        <xsl:with-param name="myval" select="@num"/>
      </xsl:call-template>
    </td>
    <td><xsl:value-of select="number(@num)"/></td>
  </tr>
</xsl:template>

<xsl:include href="ConvertSciToNumString.xsl"/>

</xsl:stylesheet>

I have had Cocoon 1.8 (w/ Jakarta-Tomcat 3.1) running on my machine for
about 6 months.  When I put the files up there I get:  


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
"http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><title>Output for web page</title></head><body><table
align="center"
border="1"><th>num</th><th>converted</th><th>number()</th>
  <tr><td>1</td><td>1</td><td>1</td></tr>
  <tr><td>-2</td><td>-2</td><td>-2</td></tr>
  <tr><td>3E-3</td><td>3E-3</td><td>0.0030</td></tr>
  <tr><td>-2E-4</td><td>-2E-4</td><td>-0.00020</td></tr>
  <tr><td>.5E-3</td><td>.5E-3</td><td>0.00050</td></tr>
  <tr><td>.3E4</td><td>.3E4</td><td>3000</td></tr>
  <tr><td>.2E-4</td><td>.2E-4</td><td>0.000020</td></tr>
  <tr><td>-.6E3</td><td>-.6E3</td><td>-600</td></tr>
  <tr><td>-.6E-4</td><td>-.6E-4</td><td>-0.000060</td></tr>
 
<tr><td>6.022E23</td><td>6.022E23</td><td>602200000000000000000000</td></tr>
  <tr><td>.312E1</td><td>.312E1</td><td>3.12</td></tr>
  <tr><td>312E-2</td><td>312E-2</td><td>3.12</td></tr>
  <tr><td>-0.312E1</td><td>-0.312E1</td><td>-3.12</td></tr>
  <tr><td>-312E-2</td><td>-312E-2</td><td>-3.12</td></tr>
  <tr><td>923.9E-1</td><td>923.9E-1</td><td>92.39</td></tr>
 
<tr><td>1.625E-12</td><td>1.625E-12</td><td>0.000000000001625</td></tr>
  <tr><td>1.E-5</td><td>1.E-5</td><td>0.000010</td></tr>
  <tr><td>2.14160E-3</td><td>2.14160E-3</td><td>0.0021416</td></tr>
</table></body></html>
<!-- This page was served from cache in 1 milliseconds by Cocoon 1.8 -->

Notice that my converted column does not work right... I can fix that by
saying if it is a number() then value-of select="number($myval)", not a
problem.  But I just thought that this must mean that Cocoon has
extended the number() function to take care of scientific notation.

I was not sure whether to post this here or to the XSL list, but thought
I'd try here first.

Thanks for any help/comments.

Sincerely,

Michael Case

-- 
Michael E. Case
UC Davis
case@ucdhep.ucdavis.edu
(530) 754-7226

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message