You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Matthew Cordes <mc...@maine.edu> on 2001/01/16 19:44:01 UTC
Bug in newest cvs esql
Hello Donald,
There is a bug in the newest esql logicsheet on or about line 710.
get-string which calls get-string-encoded checks for an esql:encoding
child then calls get-nested-content with it as a param.
Here is the applicable code fragment:
<xsl:variable name="encoding"><xsl:call-template name="get-nested-string"><xsl:with-param name="content" select="esql:encoding"/></xsl:call-template></xsl:variable>
<!-- added by me -->
<xsl:message>encoding: '<xsl:value-of select="$encoding"/>'</xsl:message>
<xsl:choose>
<xsl:when test="$encoding">
new String (<xsl:value-of select="$resultset"/>.getBytes
(<xsl:value-of select="$column-spec"/>), <xsl:value-of select="$encoding"/>)
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$resultset"/>.getString(<xsl:value-of select="$column-spec"/>)
</xsl:otherwise>
</xsl:choose>
</xsl:template>
The choose above always chooses the <xsl:when> option because even when
<esql:encoding/> is not specified $encoding evaluates to an empty java
string (e.g. "" ).
I solved the bug by changing the <xsl:when> (above) to
<xsl:when test="$encoding and not(normalize-space(translate($encoding, '	 ', ' '))='""')">
but perhaps you have a more elegant solution.
-matt
remove me from this list
Posted by Thomas Spicer <th...@hotmail.com>.
please remive me from this list. all other methods have failed.
Re: Bug in newest cvs esql
Posted by Donald Ball <ba...@webslingerZ.com>.
On Tue, 16 Jan 2001, Matthew Cordes wrote:
> There is a bug in the newest esql logicsheet on or about line 710.
> get-string which calls get-string-encoded checks for an esql:encoding
> child then calls get-nested-content with it as a param.
>
> Here is the applicable code fragment:
>
> <xsl:variable name="encoding"><xsl:call-template name="get-nested-string"><xsl:with-param name="content" select="esql:encoding"/></xsl:call-template></xsl:variable>
>
> <!-- added by me -->
> <xsl:message>encoding: '<xsl:value-of select="$encoding"/>'</xsl:message>
>
> <xsl:choose>
> <xsl:when test="$encoding">
> new String (<xsl:value-of select="$resultset"/>.getBytes
> (<xsl:value-of select="$column-spec"/>), <xsl:value-of select="$encoding"/>)
> </xsl:when>
> <xsl:otherwise>
> <xsl:value-of select="$resultset"/>.getString(<xsl:value-of select="$column-spec"/>)
> </xsl:otherwise>
> </xsl:choose>
> </xsl:template>
>
>
> The choose above always chooses the <xsl:when> option because even when
> <esql:encoding/> is not specified $encoding evaluates to an empty java
> string (e.g. "" ).
>
> I solved the bug by changing the <xsl:when> (above) to
>
> <xsl:when test="$encoding and not(normalize-space(translate($encoding, '	 ', ' '))='""')">
>
> but perhaps you have a more elegant solution.
my elegant solution was to test for the presence of esql:encoding instead
of the $encoding variable. i think it should solve the stupid problem,
thanks for pointing it out though - and let me know if my fix is
boneheaded.
- donald