Quantcast

saxon.jar parameters and API equivalent

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

saxon.jar parameters and API equivalent

Christophe Marchand-2

 

 

Hello !

 

I have an XSL transformation that works perfectly when run from command line, and not when I run it from my java program. So, I'm looking for which option(s) I miss...

 

Command line is :

java -jar saxon-xxx.jar -ext:on -s:elfCommonLogSpecificLevels.xspec -o:eflCommonLogSpecificLevels.xspec.results.xml -xsl:eflCommonLogSpecificLevels.xspec.xsl -it:{http://www.jenitennison.com/xslt/xspec}main

 

Java is :

final Processor processor = new Processor(false);
final XsltCompiler xsltCompiler = processor.newXsltCompiler();
final XsltExecutable xeXSpec = xsltCompiler.compile(new StreamSource(...));
final XsltTransformer xtXSpec = xeXSpec.load();
xtXSpec.setInitialTemplate(QName.fromClarkName("{http://www.jenitennison.com/xslt/xspec}main"));
xtXSpec.setDestination(...);
xtXSpec.transform();

 

The error I have with my java code is :

Error on line 25 of eflCommon.xsl:
XPDY0002: The context item is absent
[ERROR] The context item is absent

 

Any help will be much appreciated.

 

Best regards,

Christophe


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: saxon.jar parameters and API equivalent

Michael Kay
You haven't supplied a source document for the transformation. There are two ways you can do this with the XsltTransformer:

(a) setSource() - sets any JAXP Source object, e.g. new StreamSource(new File(sourceFile))

(b) setInitialContextNode() - typically a node that has been built using proc.newDocumentBuilder().build(), or perhaps a node returned from a previous transformation or query.

Michael Kay
Saxonica


On 14 Jan 2016, at 08:08, [hidden email] wrote:

 
 

Hello !

 

I have an XSL transformation that works perfectly when run from command line, and not when I run it from my java program. So, I'm looking for which option(s) I miss...

 

Command line is :

java -jar saxon-xxx.jar -ext:on -s:elfCommonLogSpecificLevels.xspec -o:eflCommonLogSpecificLevels.xspec.results.xml -xsl:eflCommonLogSpecificLevels.xspec.xsl -it:{http://www.jenitennison.com/xslt/xspec}main

 

Java is :

final Processor processor = new Processor(false);
final XsltCompiler xsltCompiler = processor.newXsltCompiler();
final XsltExecutable xeXSpec = xsltCompiler.compile(new StreamSource(...));
final XsltTransformer xtXSpec = xeXSpec.load();
xtXSpec.setInitialTemplate(QName.fromClarkName("{http://www.jenitennison.com/xslt/xspec}main"));
xtXSpec.setDestination(...);
xtXSpec.transform();

 

The error I have with my java code is :

Error on line 25 of eflCommon.xsl:
XPDY0002: The context item is absent
[ERROR] The context item is absent

 

Any help will be much appreciated.

 

Best regards,

Christophe

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: saxon.jar parameters and API equivalent

Christophe Marchand-2
So easy...
I couldn't imagine that a tranform could have no source document...

Thanks a lot, Michael.

Christophe

Le 14/01/2016 15:53, Michael Kay a écrit :
You haven't supplied a source document for the transformation. There are two ways you can do this with the XsltTransformer:

(a) setSource() - sets any JAXP Source object, e.g. new StreamSource(new File(sourceFile))

(b) setInitialContextNode() - typically a node that has been built using proc.newDocumentBuilder().build(), or perhaps a node returned from a previous transformation or query.

Michael Kay
Saxonica


On 14 Jan 2016, at 08:08, [hidden email] wrote:

 
 

Hello !

 

I have an XSL transformation that works perfectly when run from command line, and not when I run it from my java program. So, I'm looking for which option(s) I miss...

 

Command line is :

java -jar saxon-xxx.jar -ext:on -s:elfCommonLogSpecificLevels.xspec -o:eflCommonLogSpecificLevels.xspec.results.xml -xsl:eflCommonLogSpecificLevels.xspec.xsl -it:{http://www.jenitennison.com/xslt/xspec}main

 

Java is :

final Processor processor = new Processor(false);
final XsltCompiler xsltCompiler = processor.newXsltCompiler();
final XsltExecutable xeXSpec = xsltCompiler.compile(new StreamSource(...));
final XsltTransformer xtXSpec = xeXSpec.load();
xtXSpec.setInitialTemplate(QName.fromClarkName("{http://www.jenitennison.com/xslt/xspec}main"));
xtXSpec.setDestination(...);
xtXSpec.transform();

 

The error I have with my java code is :

Error on line 25 of eflCommon.xsl:
XPDY0002: The context item is absent
[ERROR] The context item is absent

 

Any help will be much appreciated.

 

Best regards,

Christophe

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help



------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140


_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Loading...