I've done something like this before: taking Xerces DOMs as the input XML
and the XSL stylesheet, and then outputting a Xerces DOM. The code looks
something like this:
// you may not need all of these; I've stripped out quite a bit of my code
to only provide the relevant pieces
import org.w3c.dom.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import javax.xml.transform.stream.*;
public Document transformXerces(Document source, Document stylesheet) {
Source xmlSource = new DOMSource(source),
xslSource = new DOMSource(stylesheet);
Result output = new DOMResult();
try {
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer(xslSource);
transformer.transform(xmlSource, output);
}
catch (TransformerConfigurationException e) {
// handle configuration errors
}
catch (TransformerException e) {
// handle transform errors
}
// return result
return (Document)(((DOMResult)output).getNode());
}
Good luck. Feel free to ask if you have any questions.
______________________________________
Aaron Scifres
Software Engineer
DeskNet, Inc.
66 Pearl St. Suite 300
Portland, ME 04101
(207) 772-1484 x16
http://www.desknetinc.com
DeskNetAPS - Harness the Power of Your Content
Richard Heintze
<[EMAIL PROTECTED] To: [EMAIL PROTECTED]
oo.com> cc:
Subject: Wanted: Simple example
manually that manually loads Xerces dom
02/21/2003 01:09
PM
Please respond to
xerces-j-user
I need a minimal example similar to SimpleTransform
provided with Xalan.
However, I want to explicitly load the xsl file and
input XML myself from a file using Xerces, make a few
changes to the DOM, and then explicitly pass the DOM
to to the transform function and receive a Xerces DOM,
and explicitly write it out myself.
Thanks,
Siegfried
__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]