我正在复制XSLT Cookbook: 2nd Edition (O'Reilly: Mangano, 2006) 中的一个示例,其中 Mangano 使用 SVG 创建了一个树形图。作为快速测试此代码的一种方法,我只是使用 JSTL 的<x:transform/>
标记转换 XML,并在 Jetty 6 中运行它。XSLT 似乎挂在调用上java:java.lang.Math:max
,说:
错误:'找不到外部方法'max'(必须是公开的)。' 致命错误:“无法编译样式表”
给我错误的代码包含在此处...Math:max(...
称为:
<?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))"/>
...