Calling Java Directly from XSLT Processors

As discussed in Chapter 5, until recently, XSLT processors have been free to define the way they implement extension functions, and one of those ways includes calling Java functions directly. For example, in Saxon and Xalan, you can run Java code if you define a namespace that specifies a Java class as the final part of its URI as follows, where I’m defining a Datenamespace that corresponds to the Java Dateclass:

<?xml version="1.0"?> 
<xsl:stylesheet version="1.1" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:Date="http://www.saxon.com/java/java.util.Date"> 
        . 
        . 
        . 

As you saw in Chapter 5, this means that you can use Java Datefunctions such as toString and newto embed the current date in an ...

Get Inside XSLT 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.