写法一:可调用多个JAVA类
< xsl:stylesheet xmlns:xsl = " http://www.w3.org/1999/XSL/Transform " version = " 1.0 "
xmlns:math = " com.test.Math "
xmlns:string = " com.test.StringUtils "
extension-element-prefixes = " math string " >
< xsl:value-of select = " string:toUpper('aaaa') " />
< br />
< xsl:value-of select = " math:plus(10,20) " />
< br />
写法二:不可调用多个JAVA类 namespace分不开
< xsl:stylesheet xmlns:xsl = " http://www.w3.org/1999/XSL/Transform " version = " 1.0 "
xmlns:xalan = " http://xml.apache.org/xalan "
xmlns:dh-ext = " ext1 "
extension-element-prefixes = " dh-ext " >
< xalan:component prefix = " string " functions = " toUpper " >
< xalan:script lang = " javaclass " src = " xalan://com.test.StringUtils " ></ xalan:script >
</ xalan:component >
< xsl:value-of select = " string:toUpper('aaaa') " />
< br />
< xsl:stylesheet xmlns:xsl = " http://www.w3.org/1999/XSL/Transform " version = " 1.0 "
xmlns:math = " com.test.Math "
xmlns:string = " com.test.StringUtils "
extension-element-prefixes = " math string " >
< xsl:value-of select = " string:toUpper('aaaa') " />
< br />
< xsl:value-of select = " math:plus(10,20) " />
< br />
写法二:不可调用多个JAVA类 namespace分不开
< xsl:stylesheet xmlns:xsl = " http://www.w3.org/1999/XSL/Transform " version = " 1.0 "
xmlns:xalan = " http://xml.apache.org/xalan "
xmlns:dh-ext = " ext1 "
extension-element-prefixes = " dh-ext " >
< xalan:component prefix = " string " functions = " toUpper " >
< xalan:script lang = " javaclass " src = " xalan://com.test.StringUtils " ></ xalan:script >
</ xalan:component >
< xsl:value-of select = " string:toUpper('aaaa') " />
< br />
探讨JAVA类在XSLT中的应用
本文深入探讨了如何在XSLT中调用JAVA类,对比了两种不同的实现方式,阐述了它们的优缺点及应用场景。
1335

被折叠的 条评论
为什么被折叠?



