Bug #1790
closed[Regression?] Saxon-HE 9.5 and XsltExecutable.getGlobalParameters()
100%
Description
In Saxon HE 9.5.0.1. there seems to be a regression of a functionality which worked perfectly in Saxon HE 9.4.0.7 (NullPointerException calling XsltExecutable.getGlobalParameters).
Using Saxon HE 9.4.0.7 I used successfully the method "getGlobalParameters" of the class "XsltExecutable". The task is to get the parameters of an XSLT file.
When turned to Saxon HE 9.5.0.2, this method raised a NullPointerException. An example follows, working perfectly with version 9.4.0.7 but no (raising a NullPointerException) with version 9.5.0.2. Could someone help me in finding and solve this issue? Thanks in advance.
import java.io.*;
import java.util.*;
import javax.xml.transform.stream.*;
import net.sf.saxon.*;
import net.sf.saxon.s9api.*;
import org.junit.*;
public class GlobalParametersTest {
@Test
public void globalParametersTest() throws UnsupportedEncodingException, SaxonApiException {
Configuration configuration = Configuration.newConfiguration();
Processor processor = new Processor(configuration);
XsltCompiler xsltCompiler = processor.newXsltCompiler();
String source="<?xml version='1.0'?>" +
" <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'" +
" xmlns:xs='http://www.w3.org/2001/XMLSchema'" +
" version='2.0'>" +
" <xsl:param name='surname' as='xs:string' />" +
" <xsl:param name='age' as='xs:integer' />" +
" <xsl:template match='/'><xsl:element name='root' /></xsl:template>" +
" </xsl:stylesheet>";
XsltExecutable xsltExecutable = xsltCompiler.compile(new StreamSource(new ByteArrayInputStream(source.getBytes("UTF-8"))));
Map<QName, XsltExecutable.ParameterDetails> params = xsltExecutable.getGlobalParameters();
System.out.println();
int i=0;
for (QName key: params.keySet()) {
System.out.println("Parameter n."+(++i)+": "+key);
}
System.out.println();
}
}
Following, here are segments of pom.xml respectively, with working and non-working version of Saxon-HE:
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>Saxon-HE</artifactId>
<version>9.4.0.7</version>
</dependency>
or
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>Saxon-HE</artifactId>
<version>9.5.0.2</version>
</dependency>
Files
Updated by O'Neil Delpratt over 11 years ago
- Assignee set to O'Neil Delpratt
- Found in version changed from 9.5.0.2 and 9.5.0.1 to 9.5
Updated by Michael Kay over 11 years ago
- Status changed from New to Resolved
- Assignee changed from O'Neil Delpratt to Michael Kay
- Priority changed from High to Normal
The name of the parameter in the table of external parameters had not been initialized. I am committing a patch and have added your test case as a JUnit test.
Updated by O'Neil Delpratt over 11 years ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in version set to 9.5.1.1
Bug now closed. Applied to the Saxon 9.5.1.1 maintenance release.
Please register to edit this issue