cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Derek Hohls" <DHo...@csir.co.za>
Subject Working with Xalan extensions in stylesheets
Date Thu, 10 Jul 2003 10:17:27 GMT
I know this is not a "pure" Cocoon query, but
thought someone might have a quick answer:

If I have this stylesheet which implements some
Javascript functions:

<?xml version="1.0"?> 
<xsl:stylesheet 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xalan="http://xml.apache.org/xalan"
  xmlns:maths="http://localhost/xslt/maths"
  extension-element-prefixes="maths"
  version="1.0">

  <xalan:component prefix="maths" elements="rules" functions="pi">
    <xalan:script lang="javascript">    
        function pi() {
          return 3.141592653589790;
        }                                     
    </xalan:script>
  </xalan:component>
</xsl:stylesheet>  

And I call it thus from another stylesheet:

Line 978:
<xsl:variable name="radians"    select="$value div $seriesTotal * 2 * maths:pi()" />

Why do I get this exception:

; SystemID: file:/C:/tomcat/webapps/cocoon/indicators/styles/xsl/pie.xsl; Line#: 978; Column#:
87
javax.xml.transform.TransformerException: 
javax.xml.transform.TransformerException: 
Instance method call to method pi requires an Object instance as first argument


ie. I cannot see why, if the Javascript method does not have any
 parameters, that one must be passed - or, if so, what that could 
possibly be?


Thanks
Derek


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Mailscanner thanks transtec Computers for their support.


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


Mime
View raw message