I am copying an example from XSLT Cookbook: 2nd Edition (O’Reilly: Mangano, 2006) where Mangano creates a tree diagram with SVG. As a way to quickly test this code, I am simply transforming the XML using JSTL’s <x:transform/> tag, and running it in Jetty 6. The XSLT seems to be getting hung on calling java:java.lang.Math:max, saying:
ERROR: ‘Cannot find external method ‘max’ (must be public).’ FATAL ERROR: ‘Could not compile stylesheet’
The code that gives me the error is contained in here where ...Math:max(... is called:
<?xml version='1.0' encoding='UTF-8'?> <xsl:stylesheet version='1.1' xmlns:emath='http://www.exslt.org/math' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:tree='http://www.ora.com/XSLTCookboox/ns/tree' xmlns:xalan='http://xml.apache.org/xslt' xmlns:Math='xalan:java.lang.Math'> ... <!--Pass 1 copies input with added bookkeeping attributes --> <xsl:variable name='treeWithLayout'> <xsl:apply-templates mode='layout'/> </xsl:variable> <xsl:variable name='maxPos' select='Math:max($treeWithLayout/*/@tree:WEIGHT * ($nodeWidth + $horzSpace), $treeWithLayout/*/@tree:MAXDEPTH * ($nodeHeight + $vertSpace))'/> ...
I found this usage online: