You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by ba...@locus.apache.org on 2000/03/29 08:31:57 UTC
cvs commit: xml-cocoon/src/org/apache/cocoon/processor/xsp/library/java sql.xsl
balld 00/03/28 22:31:57
Modified: src/org/apache/cocoon/processor/xsp/library/java sql.xsl
Log:
Patched the code up per Ricardo's instructions and voila! It works!
Revision Changes Path
1.7 +44 -10 xml-cocoon/src/org/apache/cocoon/processor/xsp/library/java/sql.xsl
Index: sql.xsl
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/processor/xsp/library/java/sql.xsl,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- sql.xsl 2000/03/15 01:01:44 1.6
+++ sql.xsl 2000/03/29 06:31:57 1.7
@@ -8,14 +8,34 @@
<xsl:template name="get-nested-content">
<xsl:param name="content"/>
- <xsl:choose>
- <xsl:when test="$content/*">
- <xsl:apply-templates select="$content/*"/>
- </xsl:when>
- <xsl:otherwise>"<xsl:value-of select="$content"/>"</xsl:otherwise>
- </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="$content/*">
+ <xsl:apply-templates select="$content/*"/>
+ </xsl:when>
+ <xsl:otherwise>"<xsl:value-of select="$content"/>"</xsl:otherwise>
+ </xsl:choose>
</xsl:template>
+ <xsl:template name="get-nested-string">
+ <xsl:param name="content"/>
+ <xsl:choose>
+ <xsl:when test="$content/*">
+ ""
+ <xsl:for-each select="$content/node()">
+ <xsl:choose>
+ <xsl:when test="name(.)">
+ + <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:otherwise>
+ + "<xsl:value-of select="normalize-space(translate(.,'	 ',' '))"/>"
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>"<xsl:value-of select="$content"/>"</xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
<xsl:template match="xsp:page">
<xsp:page>
<xsl:copy>
@@ -30,7 +50,7 @@
<xsl:template match="sql:execute-query">
<xsl:variable name="driver">
- <xsl:call-template name="get-nested-content">
+ <xsl:call-template name="get-nested-string">
<xsl:with-param name="content" select="sql:driver"/>
</xsl:call-template>
</xsl:variable>
@@ -145,10 +165,22 @@
</xsl:call-template>
</xsl:variable>
<xsl:variable name="query">
- <xsl:call-template name="get-nested-content">
+ <xsl:call-template name="get-nested-string">
<xsl:with-param name="content" select="sql:query"/>
</xsl:call-template>
</xsl:variable>
+ <xsp:logic>
+ {
+ Integer max_rows = new Integer(0);
+ String max_rows_string = String.valueOf(<xsl:copy-of select="$max-rows"/>);
+ try {
+ max_rows = new Integer(max_rows_string);
+ } catch (Exception e) {}
+ Integer skip_rows = new Integer(0);
+ String skip_rows_string = String.valueOf(<xsl:copy-of select="$skip-rows"/>);
+ try {
+ skip_rows = new Integer(skip_rows_string);
+ } catch (Exception e) {}
<xsp:content>
<xsp:expr>
XSPSQLLibrary.processQuery(
@@ -163,8 +195,8 @@
String.valueOf(<xsl:copy-of select="$null-indicator"/>),
String.valueOf(<xsl:copy-of select="$id-attribute"/>),
String.valueOf(<xsl:copy-of select="$id-attribute-column"/>),
- new Integer(String.valueOf(<xsl:copy-of select="$max-rows"/>)),
- new Integer(String.valueOf(<xsl:copy-of select="$skip-rows"/>)),
+ max_rows,
+ skip_rows,
String.valueOf(<xsl:copy-of select="$error-element"/>),
String.valueOf(<xsl:copy-of select="$error-message-attribute"/>),
String.valueOf(<xsl:copy-of select="$error-stacktrace-attribute"/>),
@@ -180,6 +212,8 @@
null)
</xsp:expr>
</xsp:content>
+ }
+ </xsp:logic>
</xsl:template>
<xsl:template match="@*|node()" priority="-1">