|
Subject: Re: [xsl] [saxon - Help] SystemID always empty String From: Johannes Neubauer <johannes.neubauer@xxxxxxxxxxxxxxxxx> Date: Tue, 19 Feb 2008 16:20:11 +0100 |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Unfortenately that does not work for me because I must have the systemId for compilation errors. I've marked the line in your code where I need the systemId, when a compilation error occurs. I need that because I like to output the systemId of the stylesheet where the error occured in my ErrorListener. This is helpful especially, when I have a stylesheet implementing a lot of other stylesheets, importing further stylesheets, ... !
Andrew Welch schrieb:
| 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();
Here, an error might occur (whilst compiling the stylesheet), which I
like to handle in my Errorlistener with an output like: "In " +
systemId" an error occured... (followed by StandardErrorListener output).
|
| TransformerHandler secondHandler =
| saxFactory.newTransformerHandler(compiledStylesheet);
| secondHandler.setSystemId(xslt.toURI().toString());
|
| System.out.println(secondHandler.getSystemId());
|-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHuvOrGaEJacf6i/cRAg6ZAKCqdRp3XiTrzCbjgt3Uz5PzjrtOuQCaAtnH ChZbsHeGzinbXh/wkPnBelo= =VBou -----END PGP SIGNATURE-----
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] [saxon - Help] SystemID a, Andrew Welch | Thread | Re: [xsl] [saxon - Help] SystemID a, Andrew Welch |
| Re: [xsl] [saxon - Help] SystemID a, Florent Georges | Date | Re: [xsl] [saxon - Help] SystemID a, Andrew Welch |
| Month |