Java Extension Function Using the Package Format Namespace

<xsl:stylesheet 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xslt"
xmlns:myJava="xalan://java.lang">
   
<xalan:component prefix="Math" functions="sin cos tan atan">
 <xalan:script lang="javaclass" src="java.lang"/>
</xalan:component>
   
<xsl:variable name="PI" select="4.0 * myJava:Math.atan(1.0)"/>
   
<!-- ... -->
   
</xsl:stylesheet>

This form is useful if you want to reference many classes within the same package.

Get XSLT Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.