/// <summary> /// Run the transformation, sending the result to a specified destination. /// </summary> /// <param name="destination"> /// The destination for the results of the stylesheet. The class <c>XmlDestination</c> /// is an abstraction that allows a number of different kinds of destination /// to be specified. /// </param> /// <exception cref="DynamicError">Throws a DynamicError if the transformation /// fails.</exception> public void Run(XmlDestination destination) { try { controller.setOutputProperties(destination.GetOutputProperties()); if (streamSource != null) { controller.transform(streamSource, destination.GetResult()); } else if (initialContextNode != null) { JDocumentInfo doc = initialContextNode.getDocumentRoot(); controller.registerDocument(doc, doc.getBaseURI()); controller.transform(initialContextNode, destination.GetResult()); } else { controller.transform(null, destination.GetResult()); } destination.Close(); } catch (javax.xml.transform.TransformerException err) { throw new DynamicError(err); } }
/// <summary> /// Run the transformation, sending the result to a specified destination. /// </summary> /// <param name="destination"> /// The destination for the results of the stylesheet. The class <c>XmlDestination</c> /// is an abstraction that allows a number of different kinds of destination /// to be specified. /// </param> /// <exception cref="DynamicError">Throws a DynamicError if the transformation /// fails.</exception> public void Run(XmlDestination destination) { // TODO: This isn't an ideal way of running the stylesheet if it invokes xsl:strip-space: it's better to do the // whitespace stripping while building the tree. try { controller.setOutputProperties(destination.GetOutputProperties()); if (initialContextNode != null) { JDocumentInfo doc = initialContextNode.getDocumentRoot(); controller.registerDocument(doc, doc.getBaseURI()); } controller.transform(initialContextNode, destination.GetResult()); destination.Close(); } catch (javax.xml.transform.TransformerException err) { throw new DynamicError(err); } }