xsl-list
[Top] [All Lists]

Re: [xsl] [saxon - Help] SystemID always empty String

2008-02-19 08:24:26
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

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-----

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--