nicolaken 02/04/18 09:25:43
Modified: src/java/org/apache/cocoon/components/language/markup/xsp/java
esql.xsl
Log:
Patch 8058 from [EMAIL PROTECTED]
"This adds get-bigdecimal to ESQL (see java.math.BigDecimal for details as to why
you need BigDecimals)"
Revision Changes Path
1.15 +16 -2
xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/java/esql.xsl
Index: esql.xsl
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/java/esql.xsl,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- esql.xsl 9 Apr 2002 12:50:40 -0000 1.14
+++ esql.xsl 18 Apr 2002 16:25:42 -0000 1.15
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<!-- $Id: esql.xsl,v 1.14 2002/04/09 12:50:40 haul Exp $-->
+<!-- $Id: esql.xsl,v 1.15 2002/04/18 16:25:42 nicolaken Exp $-->
<!--
============================================================================
@@ -56,7 +56,7 @@
* ESQL Logicsheet
*
* @author ?
- * @version CVS $Revision: 1.14 $ $Date: 2002/04/09 12:50:40 $
+ * @version CVS $Revision: 1.15 $ $Date: 2002/04/18 16:25:42 $
-->
<xsl:stylesheet version="1.0"
@@ -184,6 +184,7 @@
<xsp:include>java.util.List</xsp:include>
<xsp:include>java.util.Iterator</xsp:include>
<xsp:include>java.util.ListIterator</xsp:include>
+ <xsp:include>java.math.BigDecimal</xsp:include>
<xsp:include>java.sql.Struct</xsp:include>
<xsp:include>java.sql.Types</xsp:include>
<xsp:include>org.apache.cocoon.components.language.markup.xsp.EsqlHelper</xsp:include>
@@ -811,6 +812,19 @@
</xsl:otherwise>
</xsl:choose>
</xsl:template>
+
+<xspdoc:desc>returns the value of the given column as a BigDecimal. if a format
attribute exists, its value is taken to be a decimal format string as defined in
java.text.DecimalFormat, and the result is formatted accordingly.</xspdoc:desc>
+<xsl:template
match="esql:row-results//esql:get-bigdecimal|esql:call-results//esql:get-bigdecimal">
+ <xsl:choose>
+ <xsl:when test="@format">
+ <xsp:expr>new DecimalFormat("<xsl:value-of
select="@format"/>").format(<xsl:call-template
name="get-resultset"/>.getBigDecimal(<xsl:call-template
name="get-column"/>))</xsp:expr>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsp:expr><xsl:call-template
name="get-resultset"/>.getBigDecimal(<xsl:call-template name="get-column"/>)</xsp:expr>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
<xspdoc:desc>returns the current result set</xspdoc:desc>
<xsl:template match="esql:results//esql:get-resultset">
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]