Java XSL Transform

This snippet of code shows how to do an XSL transform with Java

private static final String ERR_XSL_CONFIGURATION = "Error during XSL Transform configuration."; private static final String ERR_XSL_TRANSFORM = "Error during XSL Transform execution."; /** XSL Transform with input, output and parameters. */ @SuppressWarnings("unchecked") public static void transform(Source xml, Source xsl, Result out, HashMap< [...]


This article explain how to use XSL Transformation to build an XHTML document.

XSL Transform for build XHTML

Assume we want transform following XML document

<?xml version=”1.0″ encoding=”UTF-8″?> <books> <book isbn=”9781849511742″ title=”WordPress 3.0 jQuery” pdate=”24/09/2010″/> <book isbn=”9781849511407″ title=”WordPress Top Plugins” pdate=”21/09/2010″/> <book isbn=”9781847196569″ title=”WordPress 2.7 Complete” pdate=”02/06/2009″/> <book isbn=”9781849510080″ title=”WordPress 2.8 Theme Design” pdate=”30/11/2009″/> <book [...]