cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Norman Barker <>
Subject Re: Extension functions in XSL (Saxon)
Date Fri, 19 Nov 2004 12:00:49 GMT
Derek Hohls wrote:

>I am running Cocoon 2.1.5 under Windows XP, Java 1.4.2
>I have the following test files:
><?xml version="1.0" encoding="UTF-8"?>
>  <number>42</number>
><?xml version="1.0"?> 
>  xmlns:xsl=""
>  xmlns:math="java:java.lang.Math"
>  version="1.0">
><xsl:template match="/">
>  <xsl:value-of  select="math:max(5,10)"/>
>  *
>  <xsl:value-of  select="math:cos(100)"/>
>when I run this through Saxon  on the command line,
>I get :
><?xml version="1.0" encoding="utf-8"?>10
>but when I try the same process under Cocoon, I get:
>org.apache.cocoon.ProcessingException: Failed to execute pipeline.:
>java.lang.RuntimeException: java.lang.NoSuchMethodException: For
>extension function, could not find method
>java.lang.Double.max([ExpressionContext,] #NUMBER).
>Any ideas how to get extension functions like this to work?
I think because in Cocoon you are using Xalan, you can do it this way


and then declaring 
<xsl:value-of  select="math:max(5,10)"/>

will work.

Alternative you can use the namespace

which will allow you to use the java functions.

The former is preferable as it is not dependent on
the stylesheet processor.


Norman Barker
Software Engineer
ComSine Ltd
Tel: +44 (0)1483 457121
*Please Note:*
This text is confidential. If you are not the named addressee, it could be unlawful for you
to read, copy, distribute, disclose or use the information contained herewith. If you are
not the intended recipient please telephone +44(0)1483 457121.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message