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

Re: [saxon - Help] SystemID always empty String

Subject: Re: [saxon - Help] SystemID always empty String
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Tue, 19 Feb 2008 12:22:25 +0000
Re:  [saxon - Help] SystemID always empty String
On 19/02/2008, Johannes Neubauer <johannes.neubauer@xxxxxxxxxxxxxxxxx> wrote:
> Hi,
>
> > On 18/02/2008, Johannes Neubauer <johannes.neubauer@xxxxxxxxxxxxxxxxx>
> > wrote:
> >> TransformerHandler compiler = saxFactory.newTransformerHandler();
> >> Any Idea what I did wrong?
> >
> > Don't you want to supply the stylesheet there?
> >
> > saxFactory.newTransformerHandler(new SAXSource(new
> > InputSource("path/to/stylesheet.xslt")));
> >
> > The empty contructor for a TransformerHandler creates a
> > pseudo-identity transformer (as far as I know) and is used when you
> > want to get SAX events to a Result.
>
> Sorry this was a mistake of the example (it is not exactly what I use in
> my code, but a simplified excerpt). Of course I use
> saxFactory#getTemplatesHandler().
>
> Anyway in my code I use it the right way and the problem remains.

Ahh I see what you mean.

I've played around a bit an only managed to set the systemId after
creating a TransformerHandler from the Templates.

For example this code creates a compiled stylesheet using the SAX
events generated from a transform:

        File xslt = new File(new URI("file:/c:/test.xsl"));

        SAXTransformerFactory saxFactory =
(SAXTransformerFactory)TransformerFactory.newInstance();

        TemplatesHandler compiler = saxFactory.newTemplatesHandler();
        Transformer firstTransformer = saxFactory.newTransformer();
        Result firstResult = new SAXResult(compiler);
        firstResult.setSystemId(xslt.toURI().toString());
        firstTransformer.transform(new StreamSource(xslt), firstResult);

        System.out.println(compiler.getSystemId());

        Templates compiledStylesheet = compiler.getTemplates();

        TransformerHandler secondHandler =
saxFactory.newTransformerHandler(compiledStylesheet);
        secondHandler.setSystemId(xslt.toURI().toString());

        System.out.println(secondHandler.getSystemId());

produces:

null
file:/c:/test.xsl


cheers
-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

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-2011 All Rights Reserved.