Actions
Bug #2185
closedNullPointerException when setting a parameter value
Status:
Duplicate
Priority:
Normal
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
2014-10-16
Due date:
% Done:
0%
Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:
Description
I obtained the following exception when setting a parameter value in a transformer:
Exception in thread "main" java.lang.NullPointerException
at net.sf.saxon.s9api.XsltExecutable.getGlobalParameters(XsltExecutable.java:126)
at net.sf.saxon.jaxp.TransformerImpl.setParameter(TransformerImpl.java:196)
at com.oxygenxml.xsl.saxon.RunTransformation.main(RunTransformation.java:62)
The exception above could be obtained by running the next sample Java application:
public static void main(String[] args) throws TransformerException {
// Create transformer
TransformerFactory transformerFactory = TransformerFactoryImpl.newInstance();
File xslFile = new File(xslPath);
InputSource inputSource = new InputSource(xslFile.toURI().toString());
Source source = new SAXSource(inputSource);
Transformer transformer = transformerFactory.newTransformer(source);
// Create XML SAX source
Source xmlSource = new SAXSource(new InputSource(new File(xmlPath).toURI().toString()));
// Output stream result
Result outputTarget = new StreamResult(new File(outPath));
// Run transformation
transformer.setParameter("param", "2.0");
transformer.transform(xmlSource, outputTarget);
}
Where XML file content is:
<?xml version="1.0" encoding="UTF-8"?>
<root/>
and XSL file content is:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template match="/">
test
</xsl:template>
</xsl:stylesheet>
Related issues
Updated by Michael Kay about 10 years ago
- Status changed from New to Duplicate
- Priority changed from Low to Normal
Please register to edit this issue
Actions