You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Derek Hohls <DH...@csir.co.za> on 2003/07/10 12:17:27 UTC

Working with Xalan extensions in stylesheets

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