Project

Profile

Help

Maintenance: Planio will be observing a scheduled maintenance window this Sunday, November 10, 2024 from 20:00 UTC until 21:00 UTC to perform important network maintenance in our primary data center. Your Planio account will be unavailable for a few minutes during this maintenance window.

Bug #6004

closed

java.lang.RuntimeException: Internal error in XSLT 3 using xsl:evaluate on function call of anonymous function

Added by Martin Honnen over 1 year ago. Updated over 1 year ago.

Status:
Duplicate
Priority:
Normal
Assignee:
-
Category:
XSLT conformance
Sprint/Milestone:
Start date:
2023-05-01
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
11, 12
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:
.NET, Java

Description

Trying to approach as to what could be wrong in https://saxonica.plan.io/issues/6003 I wrote some simpler code using xsl:evaluate on an XPath expression which is an anonymous function that is then called with a parameter bound in the function body; that brings down Saxon HE 12.1 Java, 11.5 Java and SaxonCS 12.1 with errors like "System.Exception: Internal error evaluating function anon:f_16454088" (CS) or "java.lang.RuntimeException: Internal error evaluating function anon:f_1768242710" (HE 12.1 J).

SaxonJS runs the code without giving errors.

The code is e.g.

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="3.0"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  exclude-result-prefixes="#all"
  expand-text="yes">

  <xsl:mode on-no-match="shallow-copy"/>

  <xsl:template match="value">
    <xsl:next-match/>
    <result>
      <xsl:evaluate xpath=". || '()'">
        <xsl:with-param name="p1" select="map{ 'foo': 'foo 1' }"/>
      </xsl:evaluate>
    </result>
  </xsl:template>

  <xsl:template match="/" name="xsl:initial-template">
    <xsl:copy>
      <xsl:apply-templates/>
      <xsl:comment>Run with {system-property('xsl:product-name')} {system-property('xsl:product-version')} {system-property('Q{http://saxon.sf.net/}platform')} at {current-dateTime()}</xsl:comment>
    </xsl:copy>
  </xsl:template>
  
</xsl:stylesheet>

Input:

<root>
  <value>function() { $p1?foo }</value>
</root>

Stack trace of HE 12.1 Java:

java.lang.RuntimeException: Internal error evaluating function anon:f_1768242710
        at net.sf.saxon.expr.instruct.UserFunction.call(UserFunction.java:690)
        at net.sf.saxon.functions.hof.UserFunctionReference$BoundUserFunction.call(UserFunctionReference.java:488)
        at net.sf.saxon.expr.DynamicFunctionCall$DynamicFunctionCallElaborator.lambda$elaborateForPull$2(DynamicFunctionCall.java:357)
        at net.sf.saxon.expr.DynamicFunctionCall.iterate(DynamicFunctionCall.java:222)
        at net.sf.saxon.expr.instruct.EvaluateInstr$EvaluateInstrElaborator.lambda$elaborateForPull$4(EvaluateInstr.java:689)
        at net.sf.saxon.expr.elab.PullElaborator.lambda$elaborateForPush$0(PullElaborator.java:38)
        at net.sf.saxon.expr.instruct.FixedElement$FixedElementElaborator.lambda$elaborateForPush$0(FixedElement.java:653)
        at net.sf.saxon.expr.instruct.Block$BlockElaborator.lambda$elaborateForPush$1(Block.java:856)
        at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:396)
        at net.sf.saxon.trans.Mode.handleRuleNotNull(Mode.java:568)
        at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:502)
        at net.sf.saxon.trans.rules.ShallowCopyRuleSet.process(ShallowCopyRuleSet.java:112)
        at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:499)
        at net.sf.saxon.expr.instruct.ApplyTemplates$ApplyTemplatesElaborator.lambda$elaborateForPush$1(ApplyTemplates.java:653)
        at net.sf.saxon.expr.instruct.Block$BlockElaborator.lambda$elaborateForPush$1(Block.java:854)
        at net.sf.saxon.expr.instruct.Copy$CopyElaborator.lambda$elaborateForPush$0(Copy.java:651)
        at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:396)
        at net.sf.saxon.trans.Mode.handleRuleNotNull(Mode.java:568)
        at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:502)
        at net.sf.saxon.trans.XsltController.applyTemplates(XsltController.java:684)
        at net.sf.saxon.s9api.AbstractXsltTransformer.applyTemplatesToSource(AbstractXsltTransformer.java:427)
        at net.sf.saxon.s9api.Xslt30Transformer.applyTemplates(Xslt30Transformer.java:306)
        at net.sf.saxon.Transform.processFile(Transform.java:1389)
        at net.sf.saxon.Transform.doTransform(Transform.java:879)
        at net.sf.saxon.Transform.main(Transform.java:83)
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
        at net.sf.saxon.value.Closure.saveContext(Closure.java:90)
        at net.sf.saxon.value.MemoClosure.<init>(MemoClosure.java:65)
        at net.sf.saxon.expr.elab.MemoClosureEvaluator.evaluate(MemoClosureEvaluator.java:47)
        at net.sf.saxon.expr.elab.LearningEvaluator.evaluate(LearningEvaluator.java:61)
        at net.sf.saxon.expr.instruct.UserFunction.call(UserFunction.java:675)
        ... 24 more
java.lang.RuntimeException: Internal error evaluating template rule  at line 10 in module file:/C:/Users/marti/OneDrive/Documents/xslt/blog-xslt-3-by-example/evaluate/eval-function1.xsl
        at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:411)
        at net.sf.saxon.trans.Mode.handleRuleNotNull(Mode.java:568)
        at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:502)
        at net.sf.saxon.trans.rules.ShallowCopyRuleSet.process(ShallowCopyRuleSet.java:112)
        at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:499)
        at net.sf.saxon.expr.instruct.ApplyTemplates$ApplyTemplatesElaborator.lambda$elaborateForPush$1(ApplyTemplates.java:653)
        at net.sf.saxon.expr.instruct.Block$BlockElaborator.lambda$elaborateForPush$1(Block.java:854)
        at net.sf.saxon.expr.instruct.Copy$CopyElaborator.lambda$elaborateForPush$0(Copy.java:651)
        at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:396)
        at net.sf.saxon.trans.Mode.handleRuleNotNull(Mode.java:568)
        at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:502)
        at net.sf.saxon.trans.XsltController.applyTemplates(XsltController.java:684)
        at net.sf.saxon.s9api.AbstractXsltTransformer.applyTemplatesToSource(AbstractXsltTransformer.java:427)
        at net.sf.saxon.s9api.Xslt30Transformer.applyTemplates(Xslt30Transformer.java:306)
        at net.sf.saxon.Transform.processFile(Transform.java:1389)
        at net.sf.saxon.Transform.doTransform(Transform.java:879)
        at net.sf.saxon.Transform.main(Transform.java:83)
Caused by: java.lang.RuntimeException: Internal error evaluating function anon:f_1768242710
        at net.sf.saxon.expr.instruct.UserFunction.call(UserFunction.java:690)
        at net.sf.saxon.functions.hof.UserFunctionReference$BoundUserFunction.call(UserFunctionReference.java:488)
        at net.sf.saxon.expr.DynamicFunctionCall$DynamicFunctionCallElaborator.lambda$elaborateForPull$2(DynamicFunctionCall.java:357)
        at net.sf.saxon.expr.DynamicFunctionCall.iterate(DynamicFunctionCall.java:222)
        at net.sf.saxon.expr.instruct.EvaluateInstr$EvaluateInstrElaborator.lambda$elaborateForPull$4(EvaluateInstr.java:689)
        at net.sf.saxon.expr.elab.PullElaborator.lambda$elaborateForPush$0(PullElaborator.java:38)
        at net.sf.saxon.expr.instruct.FixedElement$FixedElementElaborator.lambda$elaborateForPush$0(FixedElement.java:653)
        at net.sf.saxon.expr.instruct.Block$BlockElaborator.lambda$elaborateForPush$1(Block.java:856)
        at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:396)
        ... 16 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
        at net.sf.saxon.value.Closure.saveContext(Closure.java:90)
        at net.sf.saxon.value.MemoClosure.<init>(MemoClosure.java:65)
        at net.sf.saxon.expr.elab.MemoClosureEvaluator.evaluate(MemoClosureEvaluator.java:47)
        at net.sf.saxon.expr.elab.LearningEvaluator.evaluate(LearningEvaluator.java:61)
        at net.sf.saxon.expr.instruct.UserFunction.call(UserFunction.java:675)
        ... 24 more
java.lang.RuntimeException: Internal error evaluating template rule  at line 19 in module file:/C:/Users/marti/OneDrive/Documents/xslt/blog-xslt-3-by-example/evaluate/eval-function1.xsl
        at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:411)
        at net.sf.saxon.trans.Mode.handleRuleNotNull(Mode.java:568)
        at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:502)
        at net.sf.saxon.trans.XsltController.applyTemplates(XsltController.java:684)
        at net.sf.saxon.s9api.AbstractXsltTransformer.applyTemplatesToSource(AbstractXsltTransformer.java:427)
        at net.sf.saxon.s9api.Xslt30Transformer.applyTemplates(Xslt30Transformer.java:306)
        at net.sf.saxon.Transform.processFile(Transform.java:1389)
        at net.sf.saxon.Transform.doTransform(Transform.java:879)
        at net.sf.saxon.Transform.main(Transform.java:83)
Caused by: java.lang.RuntimeException: Internal error evaluating template rule  at line 10 in module file:/C:/Users/marti/OneDrive/Documents/xslt/blog-xslt-3-by-example/evaluate/eval-function1.xsl
        at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:411)
        at net.sf.saxon.trans.Mode.handleRuleNotNull(Mode.java:568)
        at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:502)
        at net.sf.saxon.trans.rules.ShallowCopyRuleSet.process(ShallowCopyRuleSet.java:112)
        at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:499)
        at net.sf.saxon.expr.instruct.ApplyTemplates$ApplyTemplatesElaborator.lambda$elaborateForPush$1(ApplyTemplates.java:653)
        at net.sf.saxon.expr.instruct.Block$BlockElaborator.lambda$elaborateForPush$1(Block.java:854)
        at net.sf.saxon.expr.instruct.Copy$CopyElaborator.lambda$elaborateForPush$0(Copy.java:651)
        at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:396)
        ... 8 more
Caused by: java.lang.RuntimeException: Internal error evaluating function anon:f_1768242710
        at net.sf.saxon.expr.instruct.UserFunction.call(UserFunction.java:690)
        at net.sf.saxon.functions.hof.UserFunctionReference$BoundUserFunction.call(UserFunctionReference.java:488)
        at net.sf.saxon.expr.DynamicFunctionCall$DynamicFunctionCallElaborator.lambda$elaborateForPull$2(DynamicFunctionCall.java:357)
        at net.sf.saxon.expr.DynamicFunctionCall.iterate(DynamicFunctionCall.java:222)
        at net.sf.saxon.expr.instruct.EvaluateInstr$EvaluateInstrElaborator.lambda$elaborateForPull$4(EvaluateInstr.java:689)
        at net.sf.saxon.expr.elab.PullElaborator.lambda$elaborateForPush$0(PullElaborator.java:38)
        at net.sf.saxon.expr.instruct.FixedElement$FixedElementElaborator.lambda$elaborateForPush$0(FixedElement.java:653)
        at net.sf.saxon.expr.instruct.Block$BlockElaborator.lambda$elaborateForPush$1(Block.java:856)
        at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:396)
        ... 16 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
        at net.sf.saxon.value.Closure.saveContext(Closure.java:90)
        at net.sf.saxon.value.MemoClosure.<init>(MemoClosure.java:65)
        at net.sf.saxon.expr.elab.MemoClosureEvaluator.evaluate(MemoClosureEvaluator.java:47)
        at net.sf.saxon.expr.elab.LearningEvaluator.evaluate(LearningEvaluator.java:61)
        at net.sf.saxon.expr.instruct.UserFunction.call(UserFunction.java:675)
        ... 24 more
Fatal error during transformation: java.lang.RuntimeException: Internal error evaluating template rule  at line 19 in module file:/C:/Users/marti/OneDrive/Documents/xslt/blog-xslt-3-by-example/evaluate/eval-function1.xsl

Stack trace SaxonCS 12.1

<?xml version="1.0" encoding="UTF-8"?><root>
  <value>function() { $p1?foo }</value>System.Exception: Internal error evaluating function anon:f_16454088
 ---> System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at Saxon.Hej.value.Closure.saveContext(Expression expression, XPathContext context)
   at Saxon.Hej.value.MemoClosure..ctor(Expression expr, PullEvaluator inputEvaluator, XPathContext context)
   at Saxon.Hej.expr.elab.MemoClosureEvaluator.evaluate(XPathContext context)
   at Saxon.Hej.expr.elab.LearningEvaluator.evaluate(XPathContext context)
   at Saxon.Hej.expr.instruct.UserFunction.call(XPathContext context, Sequence[] actualArgs)
   --- End of inner exception stack trace ---
   at Saxon.Hej.expr.instruct.UserFunction.call(XPathContext context, Sequence[] actualArgs)
   at Saxon.Hej.functions.hof.UserFunctionReference.BoundUserFunction.call(XPathContext context, Sequence[] args)
   at Saxon.Hej.expr.DynamicFunctionCall.DynamicFunctionCallElaborator.<>c__DisplayClass0_0.<elaborateForPull>b__0(XPathContext context)
   at Saxon.Hej.expr.DynamicFunctionCall.iterate(XPathContext context)
   at Saxon.Hej.expr.instruct.EvaluateInstr.EvaluateInstrElaborator.<>c__DisplayClass0_0.<elaborateForPull>b__0(XPathContext context)
   at Saxon.Hej.expr.elab.PullElaborator.<>c__DisplayClass2_0.<elaborateForPush>b__0(Outputter out, XPathContext context)
   at Saxon.Hej.expr.instruct.FixedElement.FixedElementElaborator.<>c__DisplayClass0_0.<elaborateForPush>b__0(Outputter out, XPathContext context)
   at Saxon.Hej.expr.instruct.Block.BlockElaborator.<>c__DisplayClass3_1.<elaborateForPush>b__1(Outputter out, XPathContext context)
   at Saxon.Hej.expr.instruct.TemplateRule.applyLeavingTail(Outputter output, XPathContext context)
System.Exception: Internal error evaluating template rule  at line 10 in module file:///C:/Users/marti/OneDrive/Documents/xslt/blog-xslt-3-by-example/evaluate/eval-function1.xsl
 ---> System.Exception: Internal error evaluating function anon:f_16454088
 ---> System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at Saxon.Hej.value.Closure.saveContext(Expression expression, XPathContext context)
   at Saxon.Hej.value.MemoClosure..ctor(Expression expr, PullEvaluator inputEvaluator, XPathContext context)
   at Saxon.Hej.expr.elab.MemoClosureEvaluator.evaluate(XPathContext context)
   at Saxon.Hej.expr.elab.LearningEvaluator.evaluate(XPathContext context)
   at Saxon.Hej.expr.instruct.UserFunction.call(XPathContext context, Sequence[] actualArgs)
   --- End of inner exception stack trace ---
   at Saxon.Hej.expr.instruct.UserFunction.call(XPathContext context, Sequence[] actualArgs)
   at Saxon.Hej.functions.hof.UserFunctionReference.BoundUserFunction.call(XPathContext context, Sequence[] args)
   at Saxon.Hej.expr.DynamicFunctionCall.DynamicFunctionCallElaborator.<>c__DisplayClass0_0.<elaborateForPull>b__0(XPathContext context)
   at Saxon.Hej.expr.DynamicFunctionCall.iterate(XPathContext context)
   at Saxon.Hej.expr.instruct.EvaluateInstr.EvaluateInstrElaborator.<>c__DisplayClass0_0.<elaborateForPull>b__0(XPathContext context)
   at Saxon.Hej.expr.elab.PullElaborator.<>c__DisplayClass2_0.<elaborateForPush>b__0(Outputter out, XPathContext context)
   at Saxon.Hej.expr.instruct.FixedElement.FixedElementElaborator.<>c__DisplayClass0_0.<elaborateForPush>b__0(Outputter out, XPathContext context)
   at Saxon.Hej.expr.instruct.Block.BlockElaborator.<>c__DisplayClass3_1.<elaborateForPush>b__1(Outputter out, XPathContext context)
   at Saxon.Hej.expr.instruct.TemplateRule.applyLeavingTail(Outputter output, XPathContext context)
   --- End of inner exception stack trace ---
   at Saxon.Hej.expr.instruct.TemplateRule.applyLeavingTail(Outputter output, XPathContext context)
   at Saxon.Hej.trans.Mode.handleRuleNotNull(Rule rule, TraceListener traceListener, XPathContextMajor context, Item item, TemplateRule previousTemplate, ParameterSet parameters, ParameterSet tunnelParameters, Outputter output)
   at Saxon.Hej.trans.Mode.applyTemplates(ParameterSet parameters, ParameterSet tunnelParameters, NodeInfo separator, Outputter output, XPathContextMajor context, Location locationId)
   at Saxon.Hej.trans.rules.ShallowCopyRuleSet.process(Item item, ParameterSet parameters, ParameterSet tunnelParams, Outputter out, XPathContext context, Location locationId)
   at Saxon.Hej.trans.Mode.applyTemplates(ParameterSet parameters, ParameterSet tunnelParameters, NodeInfo separator, Outputter output, XPathContextMajor context, Location locationId)
   at Saxon.Hej.expr.instruct.ApplyTemplates.ApplyTemplatesElaborator.<>c__DisplayClass1_2.<elaborateForPush>b__1(Outputter output, XPathContext context)
   at Saxon.Hej.expr.instruct.Block.BlockElaborator.<>c__DisplayClass3_1.<elaborateForPush>b__1(Outputter out, XPathContext context)
   at Saxon.Hej.expr.instruct.Copy.CopyElaborator.<>c__DisplayClass0_0.<elaborateForPush>b__0(Outputter output, XPathContext context)
   at Saxon.Hej.expr.instruct.TemplateRule.applyLeavingTail(Outputter output, XPathContext context)
System.Exception: Internal error evaluating template rule  at line 19 in module file:///C:/Users/marti/OneDrive/Documents/xslt/blog-xslt-3-by-example/evaluate/eval-function1.xsl
 ---> System.Exception: Internal error evaluating template rule  at line 10 in module file:///C:/Users/marti/OneDrive/Documents/xslt/blog-xslt-3-by-example/evaluate/eval-function1.xsl
 ---> System.Exception: Internal error evaluating function anon:f_16454088
 ---> System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at Saxon.Hej.value.Closure.saveContext(Expression expression, XPathContext context)
   at Saxon.Hej.value.MemoClosure..ctor(Expression expr, PullEvaluator inputEvaluator, XPathContext context)
   at Saxon.Hej.expr.elab.MemoClosureEvaluator.evaluate(XPathContext context)
   at Saxon.Hej.expr.elab.LearningEvaluator.evaluate(XPathContext context)
   at Saxon.Hej.expr.instruct.UserFunction.call(XPathContext context, Sequence[] actualArgs)
   --- End of inner exception stack trace ---
   at Saxon.Hej.expr.instruct.UserFunction.call(XPathContext context, Sequence[] actualArgs)
   at Saxon.Hej.functions.hof.UserFunctionReference.BoundUserFunction.call(XPathContext context, Sequence[] args)
   at Saxon.Hej.expr.DynamicFunctionCall.DynamicFunctionCallElaborator.<>c__DisplayClass0_0.<elaborateForPull>b__0(XPathContext context)
   at Saxon.Hej.expr.DynamicFunctionCall.iterate(XPathContext context)
   at Saxon.Hej.expr.instruct.EvaluateInstr.EvaluateInstrElaborator.<>c__DisplayClass0_0.<elaborateForPull>b__0(XPathContext context)
   at Saxon.Hej.expr.elab.PullElaborator.<>c__DisplayClass2_0.<elaborateForPush>b__0(Outputter out, XPathContext context)
   at Saxon.Hej.expr.instruct.FixedElement.FixedElementElaborator.<>c__DisplayClass0_0.<elaborateForPush>b__0(Outputter out, XPathContext context)
   at Saxon.Hej.expr.instruct.Block.BlockElaborator.<>c__DisplayClass3_1.<elaborateForPush>b__1(Outputter out, XPathContext context)
   at Saxon.Hej.expr.instruct.TemplateRule.applyLeavingTail(Outputter output, XPathContext context)
   --- End of inner exception stack trace ---
   at Saxon.Hej.expr.instruct.TemplateRule.applyLeavingTail(Outputter output, XPathContext context)
   at Saxon.Hej.trans.Mode.handleRuleNotNull(Rule rule, TraceListener traceListener, XPathContextMajor context, Item item, TemplateRule previousTemplate, ParameterSet parameters, ParameterSet tunnelParameters, Outputter output)
   at Saxon.Hej.trans.Mode.applyTemplates(ParameterSet parameters, ParameterSet tunnelParameters, NodeInfo separator, Outputter output, XPathContextMajor context, Location locationId)
   at Saxon.Hej.trans.rules.ShallowCopyRuleSet.process(Item item, ParameterSet parameters, ParameterSet tunnelParams, Outputter out, XPathContext context, Location locationId)
   at Saxon.Hej.trans.Mode.applyTemplates(ParameterSet parameters, ParameterSet tunnelParameters, NodeInfo separator, Outputter output, XPathContextMajor context, Location locationId)
   at Saxon.Hej.expr.instruct.ApplyTemplates.ApplyTemplatesElaborator.<>c__DisplayClass1_2.<elaborateForPush>b__1(Outputter output, XPathContext context)
   at Saxon.Hej.expr.instruct.Block.BlockElaborator.<>c__DisplayClass3_1.<elaborateForPush>b__1(Outputter out, XPathContext context)
   at Saxon.Hej.expr.instruct.Copy.CopyElaborator.<>c__DisplayClass0_0.<elaborateForPush>b__0(Outputter output, XPathContext context)
   at Saxon.Hej.expr.instruct.TemplateRule.applyLeavingTail(Outputter output, XPathContext context)
   --- End of inner exception stack trace ---
   at Saxon.Hej.expr.instruct.TemplateRule.applyLeavingTail(Outputter output, XPathContext context)
   at Saxon.Hej.trans.Mode.handleRuleNotNull(Rule rule, TraceListener traceListener, XPathContextMajor context, Item item, TemplateRule previousTemplate, ParameterSet parameters, ParameterSet tunnelParameters, Outputter output)
   at Saxon.Hej.trans.Mode.applyTemplates(ParameterSet parameters, ParameterSet tunnelParameters, NodeInfo separator, Outputter output, XPathContextMajor context, Location locationId)
   at Saxon.Hej.trans.XsltController.applyTemplates(Sequence source, Receiver out)
   at Saxon.Hej.s9api.AbstractXsltTransformer.applyTemplatesToSource(Source source, Receiver out)
   at Saxon.Hej.s9api.Xslt30Transformer.applyTemplates(Source source, Destination destination)
   at Saxon.Hej.Transform.processFile(Source source, XsltExecutable sheet, File outputFile, CommandLineOptions options)
   at Saxon.Hej.Transform.doTransform(String[] args)
Fatal error during transformation: Exception: Internal error evaluating template rule  at line 19 in module file:///C:/Users/marti/OneDrive/Documents/xslt/blog-xslt-3-by-example/evaluate/eval-function1.xsl
Exiting with code 2

Related issues

Is duplicate of Saxon - Bug #6003: Inline function expression evaluated using xsl:evaluateClosedMichael Kay2023-05-01

Actions
Actions #1

Updated by Martin Honnen over 1 year ago

With the (unofficial) SaxonC 12.2 Python wheel from https://github.com/Saxonica/BuildWheels/actions/runs/4822744715 I get a similar stack trace:

java.lang.RuntimeException: Internal error evaluating function anon:f_495690640
	at net.sf.saxon.expr.instruct.UserFunction.call(UserFunction.java:684)
	at net.sf.saxon.functions.hof.UserFunctionReference$BoundUserFunction.call(UserFunctionReference.java:488)
	at net.sf.saxon.expr.DynamicFunctionCall$DynamicFunctionCallElaborator.lambda$elaborateForPull$2(DynamicFunctionCall.java:356)
	at net.sf.saxon.expr.DynamicFunctionCall.iterate(DynamicFunctionCall.java:222)
	at net.sf.saxon.expr.instruct.EvaluateInstr$EvaluateInstrElaborator.lambda$elaborateForPull$4(EvaluateInstr.java:687)
	at net.sf.saxon.expr.elab.PullElaborator.lambda$elaborateForPush$0(PullElaborator.java:38)
	at net.sf.saxon.expr.instruct.FixedElement$FixedElementElaborator.lambda$elaborateForPush$0(FixedElement.java:640)
	at net.sf.saxon.expr.instruct.Block$BlockElaborator.lambda$elaborateForPush$1(Block.java:853)
	at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:393)
	at net.sf.saxon.trans.Mode.handleRuleNotNull(Mode.java:568)
	at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:502)
	at net.sf.saxon.trans.rules.ShallowCopyRuleSet.process(ShallowCopyRuleSet.java:112)
	at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:499)
	at net.sf.saxon.expr.instruct.ApplyTemplates$ApplyTemplatesElaborator.lambda$elaborateForPush$1(ApplyTemplates.java:650)
	at net.sf.saxon.expr.instruct.Block$BlockElaborator.lambda$elaborateForPush$1(Block.java:851)
	at net.sf.saxon.expr.instruct.Copy$CopyElaborator.lambda$elaborateForPush$0(Copy.java:645)
	at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:393)
	at net.sf.saxon.trans.Mode.handleRuleNotNull(Mode.java:568)
	at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:502)
	at net.sf.saxon.trans.XsltController.applyTemplates(XsltController.java:684)
	at net.sf.saxon.s9api.Xslt30Transformer.transform(Xslt30Transformer.java:396)
	at net.sf.saxon.option.cpp.Xslt30Processor.transformToString(Xslt30Processor.java:1607)
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
	at net.sf.saxon.value.Closure.saveContext(Closure.java:90)
	at net.sf.saxon.value.MemoClosure.<init>(MemoClosure.java:65)
	at net.sf.saxon.expr.elab.MemoClosureEvaluator.evaluate(MemoClosureEvaluator.java:47)
	at net.sf.saxon.expr.elab.LearningEvaluator.evaluate(LearningEvaluator.java:61)
	at net.sf.saxon.expr.instruct.UserFunction.call(UserFunction.java:674)
	... 21 more
java.lang.RuntimeException: Internal error evaluating template rule  at line 10 in module file:///C:/Users/marti/OneDrive/Documents/xslt/blog-xslt-3-by-example/evaluate/eval-function1.xsl
	at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:403)
	at net.sf.saxon.trans.Mode.handleRuleNotNull(Mode.java:568)
	at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:502)
	at net.sf.saxon.trans.rules.ShallowCopyRuleSet.process(ShallowCopyRuleSet.java:112)
	at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:499)
	at net.sf.saxon.expr.instruct.ApplyTemplates$ApplyTemplatesElaborator.lambda$elaborateForPush$1(ApplyTemplates.java:650)
	at net.sf.saxon.expr.instruct.Block$BlockElaborator.lambda$elaborateForPush$1(Block.java:851)
	at net.sf.saxon.expr.instruct.Copy$CopyElaborator.lambda$elaborateForPush$0(Copy.java:645)
	at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:393)
	at net.sf.saxon.trans.Mode.handleRuleNotNull(Mode.java:568)
	at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:502)
	at net.sf.saxon.trans.XsltController.applyTemplates(XsltController.java:684)
	at net.sf.saxon.s9api.Xslt30Transformer.transform(Xslt30Transformer.java:396)
	at net.sf.saxon.option.cpp.Xslt30Processor.transformToString(Xslt30Processor.java:1607)
Caused by: java.lang.RuntimeException: Internal error evaluating function anon:f_495690640
	at net.sf.saxon.expr.instruct.UserFunction.call(UserFunction.java:684)
	at net.sf.saxon.functions.hof.UserFunctionReference$BoundUserFunction.call(UserFunctionReference.java:488)
	at net.sf.saxon.expr.DynamicFunctionCall$DynamicFunctionCallElaborator.lambda$elaborateForPull$2(DynamicFunctionCall.java:356)
	at net.sf.saxon.expr.DynamicFunctionCall.iterate(DynamicFunctionCall.java:222)
	at net.sf.saxon.expr.instruct.EvaluateInstr$EvaluateInstrElaborator.lambda$elaborateForPull$4(EvaluateInstr.java:687)
	at net.sf.saxon.expr.elab.PullElaborator.lambda$elaborateForPush$0(PullElaborator.java:38)
	at net.sf.saxon.expr.instruct.FixedElement$FixedElementElaborator.lambda$elaborateForPush$0(FixedElement.java:640)
	at net.sf.saxon.expr.instruct.Block$BlockElaborator.lambda$elaborateForPush$1(Block.java:853)
	at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:393)
	... 13 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
	at net.sf.saxon.value.Closure.saveContext(Closure.java:90)
	at net.sf.saxon.value.MemoClosure.<init>(MemoClosure.java:65)
	at net.sf.saxon.expr.elab.MemoClosureEvaluator.evaluate(MemoClosureEvaluator.java:47)
	at net.sf.saxon.expr.elab.LearningEvaluator.evaluate(LearningEvaluator.java:61)
	at net.sf.saxon.expr.instruct.UserFunction.call(UserFunction.java:674)
	... 21 more
Traceback (most recent call last):
  File "C:\Users\marti\PycharmProjects\SaxonCHE122TestEval\run-xslt1.py", line 6, in <module>
    result = xslt30Processor.transform_to_string(source_file='function-expression-sample1.xml', stylesheet_file='eval-function1.xsl')
Actions #2

Updated by Michael Kay over 1 year ago

  • Status changed from New to Duplicate

Confirmed that this is the same bug as #6003.

Added this as xslt3 test case evaluate-052.

Actions #3

Updated by Michael Kay over 1 year ago

  • Is duplicate of Bug #6003: Inline function expression evaluated using xsl:evaluate added

Please register to edit this issue

Also available in: Atom PDF