You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Robin Green <gr...@hotmail.com> on 2000/12/16 16:11:26 UTC
Re: Java function in a xsl
David <da...@nmp.es> wrote:
>Hi Cocoonians
>
>We obtain from the data base an xml file like:
><root>
> <id> ... </id>
> <definition> ... </definition>
></root>
>
>And the definition field is very long so we want to apply a function to
>make
>it shorter.
(Note this will probably make the page run slower, not faster. But if the
purpose is to reduce it for the user, that makes sense.)
>We tried in the xsl something like:
>
>...
><xsl:template match="definition">
><h6> <xsp:expr> myfunction(???)</xsp:expr> </h6>
></xsl:template>
>....
>What should it be in the args of the function?
>Is a good idea to trim the result in the xsl?
The XSPProcessor does not accept dynamic input. So you can't do it like
that. You have one or two choices:
(1) Use the esql taglib and use
<definition><xsp:expr>myfunction(<esql:get-string
column="definition"/>)</xsp:expr></definition>
(2) If you are using custom database access code (i.e. not sql processor or
sql taglib), just modify it to call your function when getting that field.
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.