Hi,

 

The code below is being used to generate HTML by applying XSL to XML.

 

However, it is unclear how to turn off the validation of the XML due to a DTD references in the XML.

 

Regards,

 

Tim

 

public static String applyXslToXml(String sourceID, String xslID) throws TransformerException,

TransformerConfigurationException {

 

// Create a transform factory instance.

TransformerFactory tfactory = TransformerFactory.newInstance();

 

// Create a transformer for the stylesheet.

Transformer transformer = tfactory.newTransformer(new StreamSource(new File(xslID)));

TransformerFactory ByteArrayOutputStream out = new ByteArrayOutputStream();

 

// Transform the source XML to System.out.

transformer.transform(new StreamSource(new File(sourceID)), new StreamResult(out));

String outString = out.toString();

return outString;

}