public class WorkingWithXML {
private static String _dataDir = "/home/admin1/pdf-examples/Samples/";
public static void ExampleXSLTtoPDF() throws TransformerException {
String xslFile = _dataDir + "XMLFile1.xml", xmlFile = _dataDir + "XSLTFile1.xslt";
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer =
factory.newTransformer( new StreamSource( xslFile ) );
StreamSource xmlsource = new StreamSource( xmlFile );
ByteArrayOutputStream baos = new ByteArrayOutputStream();
StreamResult output = new StreamResult( baos );
transformer.transform( xmlsource, output );
com.aspose.pdf.HtmlLoadOptions options = new com.aspose.pdf.HtmlLoadOptions();
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document(bais, options);
pdfDocument.save(_dataDir + "data_xml.pdf");
}
}