Actions
Bug #2815
closedNullPointerException with Saxon EE 9.7.0.6 with stylesheet using xsl:merge
Start date:
2016-06-27
Due date:
% Done:
100%
Estimated time:
Legacy ID:
Applies to branch:
9.7, trunk
Fix Committed on Branch:
9.7, trunk
Fixed in Maintenance Release:
Platforms:
Description
https://www.data2type.de/xml-xslt-xslfo/xslt/xslt3/ has some XSLT 3.0 stylesheets that seem to be developed with Saxon 9.6. Yesterday I tried some of them with Saxon 9.7 and I run into a problem with the samples in https://www.data2type.de/xml-xslt-xslfo/xslt/xslt3/streaming/loesungen/uebung7-mitarbeiterlisten/, Saxon 9.7 EE gives a NullPointerException when compiling the stylesheet.
As the original code uses a collection of input files I tried to reduce the sample, the reduced test case is
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" version="3.0">
<xsl:output indent="yes" />
<xsl:strip-space elements="*" />
<xsl:mode on-no-match="shallow-copy" />
<xsl:template match="/" name="main">
<Personenliste>
<xsl:merge>
<xsl:merge-source for-each-stream="'input1.xml'" streamable="yes" select="Company/Person/Name">
<xsl:merge-key select="Surname" />
</xsl:merge-source>
<xsl:merge-action>
<xsl:apply-templates select="current-merge-group()" />
</xsl:merge-action>
</xsl:merge>
</Personenliste>
</xsl:template>
<xsl:template match="Name">
<Person>
<xsl:attribute name="Firma" select="ancestor::Company/@Name"></xsl:attribute>
<xsl:apply-templates select="node()" />
</Person>
</xsl:template>
<xsl:template match="Surname">
<Nachname>
<xsl:apply-templates select="node()" />
</Nachname>
</xsl:template>
<xsl:template match="Firstname">
<Vorname>
<xsl:apply-templates select="node()" />
</Vorname>
</xsl:template>
</xsl:stylesheet>
a minimal input file is
<?xml version="1.0" encoding="UTF-8"?>
<Company Name="Company A">
<Person>
<Name Title="Mr." Gender="male">
<Firstname>John</Firstname>
<Surname>Doe</Surname>
</Name>
</Person>
</Company>
when I run Saxon-EE 9.7.0.6J from the command line with -t -xsl:.\sheet2.xsl -it:main
it outputs the following stack trace:
java.lang.NullPointerException
at com.saxonica.xslt3.instruct.MergeInstr$MergeSource.copy(MergeInstr.java:108)
at com.saxonica.xslt3.instruct.MergeInstr.copy(MergeInstr.java:688)
at net.sf.saxon.expr.instruct.FixedElement.copy(FixedElement.java:228)
at net.sf.saxon.style.XSLTemplate.optimize(XSLTemplate.java:808)
at net.sf.saxon.style.PrincipalStylesheetModule.optimizeTopLevel(PrincipalStylesheetModule.java:1349)
at net.sf.saxon.style.PrincipalStylesheetModule.compile(PrincipalStylesheetModule.java:1199)
at net.sf.saxon.style.Compilation.compilePackage(Compilation.java:262)
at net.sf.saxon.style.StylesheetModule.loadStylesheet(StylesheetModule.java:260)
at net.sf.saxon.style.Compilation.compileSingletonPackage(Compilation.java:101)
at net.sf.saxon.s9api.XsltCompiler.compile(XsltCompiler.java:859)
at net.sf.saxon.Transform.doTransform(Transform.java:727)
at net.sf.saxon.Transform.main(Transform.java:77)
Saxon-EE 9.6.0.9J runs the code and outputs the result
<?xml version="1.0" encoding="UTF-8"?>
<Personenliste>
<Person Firma="Company A">
<Vorname>John</Vorname>
<Nachname>Doe</Nachname>
</Person>
</Personenliste>
Files
Please register to edit this issue
Actions