Project

Profile

Help

Bug #1790

closed

[Regression?] Saxon-HE 9.5 and XsltExecutable.getGlobalParameters()

Added by Francesco Sblendorio over 11 years ago. Updated over 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
s9api API
Sprint/Milestone:
-
Start date:
2013-05-31
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

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

GlobalParametersTest.java (1.4 KB) GlobalParametersTest.java Francesco Sblendorio, 2013-05-31 12:32

Please register to edit this issue

Also available in: Atom PDF