[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Saxon question..

Subject: RE: Saxon question..
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Fri, 19 Oct 2001 10:21:44 +0100
saxon domresult
>
> Not sure if this is the best place to ask this, but I know
> the author of
> Saxon frequents this list. Basically, I want to know if Saxon
> has built in
> ability to handle XML and XSL in various manners?
> Specifically, I have the
> need to do one of two things with XML/XSL:
>
> 1) Pass in an XML and XSL, and get out an XML.
>
> 2) Pass in an XML and XSL, and get out a Document (Jaxp
> compatible) object, already parsed.

You can get a DOM Document as the result of your transformation by supplying
a DOMResult object instead of a StreamResult.

If the DOMResult already contains a Document object, Saxon will populate
that Document object. If it doesn't, Saxon will build its own. Saxon's
implementation of the DOM is rather minimal, so if you want to use DOM
interfaces seriously, it's probably best to use a product such as Xerces and
Crimson to create the Document object.

Mike Kay

>
> The first one, I have working using a little bit of Java code:
>
>   public static void transformXMLWithXSL(File sourceXML, File
> sourceXSL,
> File target)
>   {
>     StreamSource xslStream = new StreamSource(sourceXSL);
>     StreamSource xmlStream = new StreamSource(sourceXML);
>
>     try
>     {
>       Templates templates = tFactory.newTemplates(xslStream);
>       Transformer transformer = templates.newTransformer();
>       transformer.transform(xmlStream, new StreamResult(new
> FileOutputStream(target)));
>     }
>     catch(Exception e)
>     {
>       e.printStackTrace(System.out);
>     }
>   }
>
> I don't know if this is the best way to do this, but it does
> work. I am
> attempting to create a simple API that any of our
> applications can use to
> allow conversion of one XML file format into our own format.
> Basically, we
> will provide a "hub" to convert any format to our own format
> so that we can
> more easily use our existing code to manipulate the incoming
> xml formats. We
> have different software apps exporting their own but similar
> formats. I am
> sure this is common to many of you. We will also like to use
> FO eventually
> to produce PDF and RTF output files.
>
> So before I go reinvent the wheel, does Saxon have built in
> API calls to do
> this already? Or does it just provide the engine to transform?
>
> Thanks.
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.