This article explains how to generate an XHTML document using an XSL Transform.

XSL Transform for build XHTML

Assume we want transform following XML document

An XSL Transform starts from XML input and produces output in several  formats. To get XHTML output we’ll need to define the correct output format at the top of the document.

The transform is quite simple, and here, there is an image showing the output result.

xsl-to-xhtml

You can get the source from my Git folder: https://github.com/psuzzi/asegno/tree/master/codeexamples/2011/xsl-to-xhtml,

References

This is a snippet of code to show how to perform an XSL transformation with Java

Below you can see how to XSL Transform using File, StreamSource and StreamResult.

 

And there it is an example of XSL Transform using StringReader and StringWriter.

 

Source code is available on my Git repository:

.