xslt - Getting detailed error description from Saxon 9.x in .net -
i have xslt2 transform engine setted saxon 9.x. have big xml file large xsl transformation file. can make transform xqsharp xslt2 engine, saxon getting error:
javax.xml.transform.transformerconfigurationexception: failed compile stylesheet. 1 error detected.
i more detailed error information saxon example linenumber of error , cause. 2 exceptions found are:
- saxon.api.dynamicerror
- saxon.api.staticerror
but not thrown. how detailed error desription?
i have following code:
<webmethod()> _ public function xsltsaxon(byval inputxml string, byval inputxsl string) string dim response string = "" try ' create processor instance. dim processor new processor() ' create xml reader based on xml string dim xmlreader xmlreader = xmlreader.create(new stringreader(inputxml)) ' load source document. dim input xdmnode = processor.newdocumentbuilder().build(xmlreader) ' create transformer stylesheet. dim transformer xslttransformer = processor.newxsltcompiler.compile(new stringreader(inputxsl)).load() ' set root node of source document initial context node. transformer.initialcontextnode = input ' create serializer. dim serializer new serializer() dim result stream = new memorystream() serializer.setoutputstream(result) transformer.run(serializer) result.position = 0 using reader streamreader = new streamreader(result) response = reader.readtoend() end using catch ex saxon.api.dynamicerror response = string.format("<error>dynamicerror</error>", ex.tostring) catch ex saxon.api.staticerror response = string.format("<error>staticerror</error>", ex.tostring) catch ex exception response = string.format("<error>{0}</error>", ex.tostring) end try return response end function
by default compilation error messages written standard error output stream. ends on .net of mystery if you're not running command-line console - think goes log file buried somewhere in system, it's configurable. flexible way of handling errors in application use errorlist property of xsltcompiler - if set property empty list, saxon add error information end of list staticerror object, application can retrieve , display wherever suitable.
please note, if go sourceforge page saxon find there both forum , mailing list saxon questions. questions posted either of locations answer. stackoverflow great place, it's hit-and-miss whether question gets noticed.
Comments
Post a Comment