SaxonC EE 11.2 "TransformFromFile()" produces empty output

78 Views Asked by At

my C++ code :

SaxonProcessor* processor = new SaxonProcessor(false);
    processor->setcwd( Current Working Directory );
    Xslt30Processor* xslt = processor->newXslt30Processor();

    XdmNode* xmlfile = processor->parseXmlFromFile( Some Xml File );
    XsltExecutable* xslte = xslt->compileFromFile(Some Xsl File);
    xslte->setOutputFile(Output File);

    xslte->transformToFile(xmlfile);                          

This works when i use "Xslt30Processor::TransformFiletoFile()" but this somehow doesn't.

1

There are 1 best solutions below

3
ond1 On

I will raise a bug issue against transformToFile(). However if you use applyTemplatesReturningFile as a workaround it does work:

SaxonProcessor* processor = new SaxonProcessor(false);
processor->setcwd( Current Working Directory );
Xslt30Processor* xslt = processor->newXslt30Processor();
XdmNode* xmlfile = processor->parseXmlFromFile( Some Xml File );
XsltExecutable* xslte = xslt->compileFromFile(Some Xsl File);
xslte->setInitialMatchSelection(xmlfile);
xslte->applyTemplatesReturningFile(Output File);