Drivers can invoke the Novell XSLT processor directly by using the com.novell.xsl.StyleSheet class. There are various ways in which this can be set up and invoked, but a typical invocation is illustrated by the following code fragment.
import com.novell.nds.dirxml.driver.*; import com.novell.xsl.*; import com.novell.xsl.result.*; import org.w3c.dom.*; . . . try { XmlDocument inputDoc = new XmlDocument(); XmlDocument stylesheetDoc = new XmlDocument(); // load the input and stylesheet documents from a file inputDoc.readDocument(new FileInputStream("input.xml")); stylesheetDoc.readDocument(new FileInputStream("stylesheet.xsl")); // create the stylesheet processor and give it the stylesheet Stylesheet styleSheet = new Stylesheet(); styleSheet.load(stylesheetDoc.getDocument()); // pass in any stylesheet parameters that the stylesheet might need styleSheet.setParameter("fromNds", new Boolean(fromNds)); // setup a result handler to get a DOM tree Document resultDoc = com.novell.xml.dom.DocumentFactory.newDocument(); DOMResultHandler resultHandler = new DOMResultHandler(resultDoc); styleSheet.setResultHandler(resultHandler); // apply the stylesheet styleSheet.process(doc, null); // result will be in resultDoc } catch( XSLException xsle ) { // handle any exception thrown }