Actions
Bug #5585
closedSaxonCS reports missing name attribute on xsl:accumulator but then gives System.ArgumentNullException
Start date:
2022-06-29
Due date:
% Done:
100%
Estimated time:
Legacy ID:
Applies to branch:
11, trunk
Fix Committed on Branch:
11, trunk
Fixed in Maintenance Release:
Platforms:
.NET
Description
Due do a typo I had e.g. xsl:accumulator nme="..."
in my XSLT 3 code and found that Saxon EE 11.3 Java reports two messages
Error at xsl:accumulator on line 7 column 77 of sheet1-acc-no-name.xsl:
XTSE0010 Element must have an @name attribute
Error in xsl:accumulator/@nme on line 7 column 77 of sheet1-acc-no-name.xsl:
XTSE0090 Attribute @nme is not allowed on element <xsl:accumulator>
Errors were reported during stylesheet compilation
while SaxonCS reports the first message but then gives a System.ArgumentNullException (building the accumulator value?):
Error at xsl:accumulator on line 7 column 6 of sheet1-acc-no-name.xsl:
XTSE0010 Element must have an @name attribute
System.ArgumentNullException: Value cannot be null. (Parameter 'key')
at System.Collections.Generic.Dictionary`2.FindValue(TKey key)
at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
at Saxon.Impl.Helpers.MapUtils.Get[K,V](IDictionary`2 map, K key)
at Saxon.Hej.expr.accum.AccumulatorRegistry.getAccumulator(StructuredQName name)
at Saxon.Hej.style.XSLAccumulator.index(ComponentDeclaration decl, PrincipalStylesheetModule top)
at Saxon.Hej.style.PrincipalStylesheetModule.buildIndexes()
at Saxon.Hej.style.PrincipalStylesheetModule.preprocess(Compilation compilation)
at Saxon.Hej.style.Compilation.compilePackage(Source source)
at Saxon.Hej.style.StylesheetModule.loadStylesheet(Source styleSource, Compilation compilation)
at Saxon.Hej.style.Compilation.compileSingletonPackage(Configuration config, CompilerInfo compilerInfo, Source source)
at Saxon.Hej.s9api.XsltCompiler.compile(Source source)
at Saxon.Hej.Transform.doTransform(String[] args)
Fatal error during transformation: ArgumentNullException: Value cannot be null. (Parameter 'key')
Exiting with code 2
Example XSLT:
<?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="#all"
version="3.0">
<xsl:accumulator nme="foo-collector" as="xs:string?" initial-value="()">
<xsl:accumulator-rule match="items/foo/text()" select="string()"/>
</xsl:accumulator>
<xsl:mode on-no-match="shallow-skip" use-accumulators="#all"/>
<xsl:template match="data/item/name">
<xsl:next-match/>
<xsl:comment select="accumulator-before('foo-collector')"/>
</xsl:template>
</xsl:stylesheet>
Example XML:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<items>
<foo>foo1</foo>
<cats>
<cat>cat1</cat>
<cat>cat2</cat>
</cats>
</items>
<data>
<item>
<name>item 1</name>
<foo>foo1</foo>
<cat>cat1</cat>
</item>
<item>
<name>item 2</name>
<foo>foo2</foo>
<cat>cat1</cat>
</item>
</data>
</root>
Please register to edit this issue
Actions