cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Friedrich Schuster" <schus...@debitel.net>
Subject C2: Processing exception with logicsheet
Date Fri, 28 Dec 2001 08:05:06 GMT

Hi Cocoon Developers,

I get a ProcessingException: Language Exception
when passing parameters to a logicsheet (cocoon2.0, Tomcat 4.0.1, Win2k,
JDK1.3).

This happens _only_ when passing the parameter
within the content of a custom tag
via
<xxx.customTag>
<xxx:param name="start">0</xxx:param>
</xxx:customTag>
(not as an attribute).

The generated code does not compile:

    start = Strings.isDigit(this.characters("0");) ?
                                       --------------------^
            Strings.toInt(this.characters("0");) : 0 ;
                                  --------------------^

A transformation of the same xml / xsl with Xalan-J 2.2
(without cocoon) seems to work, but not with Cocoon 2.

Embedding the value with: <xxx:param
name="start"><xsl:expr>0</xsl:expr></xxx:param>
does not solve the problem: then I have different value types for the
same variable (String for an attribute, int for <xxx:param ...>, not
to mention the inconvenience for logicsheet-users.
Does not work either: <xxx:param
name="start"><xsl:expr>"0"</xsl:expr></xxx:param>
then I get "\n0".

Did anybody experience or solve this problem ?
Thanks in advance,

Friedrich Schuster
friedrich@schuster.net
Heidelberg, Germany

-------- xml --------

<vstring:indexOfAnyBut
  s="  hello old world  !!  "
  c=" helod"
  ignoreCase="false"
>
  <vstring:param name="start">0</vstring:param>
</vstring:indexOfAnyBut>


------ xsl-logic ------

<!-- INDEXOFANYBUT TAG -->
<xsl:template match="vstring:indexOfAnyBut">

<xsl:variable name="s">
  <xsl:call-template name="get-parameter">
    <xsl:with-param name="name">s</xsl:with-param>
    <xsl:with-param name="required">true</xsl:with-param>
  </xsl:call-template>
</xsl:variable>

<xsl:variable name="c">
  <xsl:call-template name="get-parameter">
    <xsl:with-param name="name">c</xsl:with-param>
    <xsl:with-param name="required">true</xsl:with-param>
  </xsl:call-template>
</xsl:variable>

<xsl:variable name="start">
  <xsl:call-template name="get-parameter">
    <xsl:with-param name="name">start</xsl:with-param>
    <xsl:with-param name="required">false</xsl:with-param>
  </xsl:call-template>
</xsl:variable>

<xsl:variable name="ignoreCase">
  <xsl:call-template name="get-parameter">
    <xsl:with-param name="name">ignoreCase</xsl:with-param>
    <xsl:with-param name="required">false</xsl:with-param>
  </xsl:call-template>
</xsl:variable>

<xsp:logic>
  s = <xsl:copy-of select="$s" />;
  c = <xsl:copy-of select="$c" />;
  start = Strings.isDigit(<xsl:copy-of select="$start"/>) ?
Strings.toInt(<xsl:copy-of select="$start"/>) : 0 ;
  ignoreCase = Strings.equals(<xsl:copy-of
select="$ignoreCase"/>,"true",true) ;
  indexOfAnyBut=String.valueOf(ViolinStrings.Strings.indexOfAnyBut(s, c,
start, ignoreCase));
</xsp:logic>
<xsp:expr>indexOfAnyBut</xsp:expr>
</xsl:template>


.... deleted ...


<!-- Utility templates -->
<!--                   -->
<!-- DO NOT TOUCH      -->
<!--                   -->

<!-- Keep all unknown tags -->
<xsl:template match="@*|node()" priority="-1">
  <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
</xsl:template>

<!-- START: util templates from Apache Cocoon Logicsheet Concepts -->

<xsl:template name="get-parameter">
<xsl:param name="name"/>
<xsl:param name="default"/>
<xsl:param name="required">false</xsl:param>
<xsl:variable name="prefix">vstring</xsl:variable>

<xsl:variable name="qname">
  <xsl:value-of select="concat($prefix, ':param')"/>
</xsl:variable>

<xsl:choose>
  <xsl:when test="@*[name(.) = $name]">
    "<xsl:value-of select="@*[name(.) = $name]"/>"
  </xsl:when>
  <xsl:when test="(*[name(.) = $qname])[@name = $name]">
    <xsl:call-template name="get-nested-content">
      <xsl:with-param name="content"
        select="(*[name(.) = $qname])[@name = $name]"/>
    </xsl:call-template>
  </xsl:when>
  <xsl:otherwise>""</xsl:otherwise>
</xsl:choose>
</xsl:template>

<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:template>

<!-- END: util templates from Apache Cocoon Logicsheet Concepts -->


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message