You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Cory Isaacson (Compuflex)" <ci...@compuflex.com> on 2002/03/27 02:40:04 UTC

StreamSource Question

I am trying to build a Transformer from a String, so I am creating a
StringReader as a StreamSource. I know that the String contains a valid XSLT
document. Is there any reason this should not work?

Here is my code snippet:

    StringReader stringReader = new StringReader(xsltString);
    TransformerFactory tFactory = TransformerFactory.newInstance();
    Transformer transformer = tFactory.newTransformer(new
StreamSource(stringReader));

    /* Create the outputDoc.*/
    outputDoc = new DocumentImpl();

    /* Perform the transformation.*/
    transformer.transform(new DOMSource(rootDataElement), new
DOMResult(outputDoc));

Thanks in advance.

Cory