Hi,

Rereading my own mail: start with the bottom advice = remove newlines between tags.

what I noticed is that you use get-column name like:

<esql:get-column-name>
<esql:param name="column">
<xsp:expr>i</xsp:expr>
</esql:param>
</esql:get-column-name>

What I would do if I'd like to call
<esql:get-column-name column="i"/>

I'd write
<esql:get-column-name>
<xsp:attribute name="column"><xsp:expr>i</xsp:expr></xsp:attribute>
</esql:get-column-name>

In other words: let xsp add the attribute. Please note that I don't know
what xsp does that; it could be *after* esql has been called but before the
SAX stream is emitted (the class is run).
But as I do all my variable attribute settings with xsp:attribute (admittedly
those attributes are all used by a later transformer - not by esql)
and that works well - it might be worth a try.


Apart from that, you might want to not insert newlines in this kind of tags, as Java does not
like strings with newlines in it.
Your code has been compiled like:
getColumnName( "
i
" ); // actually, the value of i
due to the newlines between the tags. If you *do* need newlines, and don't have the
option to use normalize-space in the xsl (and here you do not) do newlines like:
<xsp:attribute
name="myname><xsp:expr>i</xsp:expr></xsp:attribute>
Notice the newline IN the attribute element - xsp is insensitive to newlines and whitespace,
Java is most decidedly not.


Leon


Frank Thilo Mueller wrote:


Dear Christian,

thank you very much for your answer. I already had tried both ways
before but I couldnt reach the result I am heading at.

Im using the esql example to print out table column name number i.



<esql:get-column-name>
<esql:param name="column"><xsp:expr>i</xsp:expr></esql:param>
</esql:get-column-name>



If I replace this i with a 1, everything is fine. If I define int 1=1 outside of the <content> then it gives me an error:

org.apache.cocoon.ProcessingException: Language Exception:
org.apache.cocoon.components.language.LanguageException: Error compiling
esql_xsp: ERROR 1
(org\apache\cocoon\www\samples\databases\xsp\esql_xsp.java): ... default:
this.characters("\n "); // start error (lines 588-588) "String literal is
not properly closed by a double-quote"
XSPObjectHelper.xspExpr(contentHandler,
_esql_query.getResultSet().getMetaData().getColumnName(" // end error i
")); this.characters("\n\n\t"); ... Line 588, column 0: String literal is
not properly closed by a double-quote

Which says nearly nothing to me.

Any ideas ?

Thank you,

Thilo

---------
more detailed code sample

 <page>
  <title>A Database Driven XSP Page</title>
   <resources>
      <resource type="file"
href="../transform/sql-page.xml.sql">Schema</resource>
      <resource type="doc" href="userdocs/xsp/esql">ESQL</resource>
   </resources>

<xsp:logic>
int i=1;
</xsp:logic>


<content>


  <esql:connection>
    <esql:pool>personnel</esql:pool>

<para>

Die Zahl i hat den Wert <xsp:expr>i</xsp:expr>

</para>
<para>
 Generische Tabellenausgabe
</para>


<para> Spaltenname </para>

      <esql:execute-query>
        <esql:query>select * from employee</esql:query>
        <esql:results>
           <esql:get-column-name>
                <esql:param name="column">
                <xsp:expr>i</xsp:expr>
                </esql:param>
            </esql:get-column-name>

        </esql:results>
      </esql:execute-query>


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to