  | |  | Output XML with stylesheet from DOM | Output XML with stylesheet from DOM 2003-01-23 - By Oxley, David
I have a DOM Document representing an xml file and I want to save it to a file with an embedded xml-stylesheet link: <?xml-stylesheet href="/?????.xsl" type="text/xsl"?>
Here is my code so far. How do I add the stylesheet link? I don't want xalan to process the stylesheet.
DOMSource xml_source = new DOMSource(document); StreamResult result = new StreamResult(out); TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer(); transformer.transform(xml_source, result);
Please reply directly to me as I'm not subscribed to the list.
Thanks. Dave.
________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"> <META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12"> <TITLE>Output XML with stylesheet from DOM</TITLE> </HEAD> <BODY>
<P><FONT SIZE=2>I have a DOM Document representing an xml file and I want to save it to a file with an embedded xml-stylesheet link:</FONT> <BR><FONT SIZE=2><?xml-stylesheet href="/?????.xsl" type=" ;text/xsl"?></FONT> </P>
<P><FONT SIZE=2>Here is my code so far. How do I add the stylesheet link? I don 't want xalan to process the stylesheet.</FONT> </P>
<P><FONT SIZE=2>DOMSource xml_source = new DOMSource(document);</FONT> <BR><FONT SIZE=2>StreamResult result = new StreamResult(out); </FONT> <BR><FONT SIZE=2>TransformerFactory tFactory = TransformerFactory.newInstance() ;</FONT> <BR><FONT SIZE=2>Transformer transformer = tFactory.newTransformer();</FONT> <BR><FONT SIZE=2>transformer.transform(xml_source, result);</FONT> </P>
<P><FONT SIZE=2>Please reply directly to me as I'm not subscribed to the list.< /FONT> </P>
<P><FONT SIZE=2>Thanks.</FONT> <BR><FONT SIZE=2>Dave.</FONT> </P>
</BODY> </HTML>
<HTML><BODY><BR> ________________________________________________________________________<BR> This e-mail has been scanned for all viruses by Star Internet. The<BR> service is powered by MessageLabs. For more information on a proactive<BR> anti-virus service working around the clock, around the globe, visit:<BR> <A href=http://www.star.net.uk> http://www.star.net.uk</A><BR> ________________________________________________________________________<BR> </BODY></HTML>
|
|
 |