Failure to compile XSLT
Added by Tiaan Waslap almost 2 years ago
The following code fails to compile the attached XSLT. It did compile with earlier versions of HEC (notably 1.2.1 albeit with some C++ code differences)
#include <string>
using namespace std;
#include <Saxon.C.API/SaxonProcessor.h>
#include <Saxon.C.API/XdmValue.h>
#include <Saxon.C.API/XdmItem.h>
#include <Saxon.C.API/XdmNode.h>
int main(int argc, char **argv)
{
SaxonProcessor *saxon = new SaxonProcessor(true);
Xslt30Processor *trans = saxon->newXslt30Processor();
XsltExecutable *exe = trans->compileFromFile(argv[1]);
if (trans->exceptionOccurred())
{
printf("1: %s\n", trans->getErrorMessage());
return 1;
}
XdmNode *node = saxon->parseXmlFromFile(argv[2]);
if (saxon->exceptionOccurred())
{
printf("2: %s\n", saxon->getErrorMessage());
return 1;
}
if (!node)
{
printf("3: failed to parse xml\n");
return 1;
}
exe->setGlobalContextItem(node);
if (exe->exceptionOccurred())
{
printf("4: %s\n", exe->getErrorMessage());
return 1;
}
string xform = exe->transformToString();
if (exe->exceptionOccurred())
{
printf("5: %s\n", exe->getErrorMessage());
return 1;
}
printf("%s\n", xform.c_str());
return 0;
}
The trans->compileFromFile fails with the attached style sheet. Is there an opinion out there whether it should have succeeded (my code wrong or stylesheet wrong perhaps) ?
The exception i get is:
1: NullPointer exception found: java.lang.NullPointerException
at net.sf.saxon.expr.parser.LoopLifter.markDependencies(LoopLifter.java:221)
at net.sf.saxon.expr.parser.LoopLifter.gatherInfo(LoopLifter.java:171)
at net.sf.saxon.expr.parser.LoopLifter.gatherInfo(LoopLifter.java:174)
at net.sf.saxon.expr.parser.LoopLifter.gatherInfo(LoopLifter.java:174)
at net.sf.saxon.expr.parser.LoopLifter.gatherInfo(LoopLifter.java:174)
at net.sf.saxon.expr.parser.LoopLifter.gatherInfo(LoopLifter.java:174)
at net.sf.saxon.expr.parser.LoopLifter.gatherInfo(LoopLifter.java:174)
at net.sf.saxon.expr.parser.LoopLifter.gatherInfo(LoopLifter.java:174)
at net.sf.saxon.expr.parser.LoopLifter.gatherInfo(LoopLifter.java:174)
at net.sf.saxon.expr.parser.LoopLifter.gatherInfo(LoopLifter.java:174)
at net.sf.saxon.expr.parser.LoopLifter.gatherInfo(LoopLifter.java:153)
at net.sf.saxon.expr.parser.LoopLifter.process(LoopLifter.java:53)
at net.sf.saxon.expr.parser.ExpressionTool.optimizeComponentBody(ExpressionTool.java:978)
at net.sf.saxon.style.XSLTemplate.optimize(XSLTemplate.java:1043)
at net.sf.saxon.style.PrincipalStylesheetModule.optimizeTopLevel(PrincipalStylesheetModule.java:1496)
at net.sf.saxon.style.PrincipalStylesheetModule.compile(PrincipalStylesheetModule.java:1315)
at net.sf.saxon.style.Compilation.compilePackage(Compilation.java:324)
at net.sf.saxon.style.StylesheetModule.loadStylesheet(StylesheetModule.java:246)
at net.sf.saxon.style.Compilation.compileSingletonPackage(Compilation.java:113)
at net.sf.saxon.s9api.XsltCompiler.compile(XsltCompiler.java:969)
at net.sf.saxon.option.cpp.Xslt30Processor.compileFromFile(Xslt30Processor.java:323)
Thanks
Replies (1)
RE: Failure to compile XSLT - Added by Martin Honnen almost 2 years ago
Might be https://saxonica.plan.io/issues/5888
Please register to reply