This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Java code doing transformation
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] Java code doing transformation
- From: Carsten Heinrigs <carst at ocean7 dot com>
- Date: Wed, 27 Jun 2001 18:35:42 -0400
- References: <000701bfe082$02064980$3da3243e@braniganz>
- Reply-To: xsl-list at lists dot mulberrytech dot com
The 'JavaTM API for XML Processing (jaxp-1.1) has a series of examples.
just to give an idea, it
looks like this
...
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer(new StreamSource(xslfi
le));
transformer.setParameter("what",this);
DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = dfactory.newDocumentBuilder();
Document outDoc = docBuilder.newDocument();
transformer.transform(new StreamSource(in),
new DOMResult(outDoc));
...
or
...
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer(new StreamSource(xslfi
le));
transformer.setParameter("what",this);
transformer.transform(new StreamSource(in),
new StreamResult(new FileOutputStream(out)));
...
you can also get the result handed to an SAXParser
carst
--
Carsten Heinrigs
Ocean-7 Development
Tel: 212-533-8460
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list