Project

Profile

Help

infinite recursion caught by Saxon 11.4 HE and EE Java but given exception with SaxonCS 11.4

Added by Martin Honnen over 1 year ago

From the command line, Saxon HE 11.4 and EE Java both recognize the infinite recursion in my XSLT with e.g.

  <xsl:template match="div">
    <xsl:copy>
      <xsl:apply-templates select="."/>
    </xsl:copy>
  </xsl:template>

telling me e.g.

  In template rule with match="div" on line 8 of recursion-test2.xsl
     invoked by xsl:apply-templates at file:/C:/Users/SomeUser/SomePath/SomeDir/./recursion-test2.xsl#10
Too many nested apply-templates calls. The stylesheet may be looping.

On the other hand, SaxonCS just ends up with lots of lines of stack and then a StackOverflow exception

Stack overflow.
   at Saxon.Impl.Helpers.MapUtils.Get[[System.Int32, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IDictionary`2<Int32,System.__Canon>, Int32)
   at Saxon.Hej.om.NamePool.getUnprefixedQName(Int32)
   at Saxon.Hej.om.NamePool.getURI(Int32)
   at Saxon.Hej.tree.tiny.TinyNodeImpl.getURI()
   at Saxon.Hej.om.NameOfNode.hasURI(System.String)
   at Saxon.Hej.event.NamespaceDifferencer.startElement(Saxon.Hej.om.NodeName, Saxon.Hej.type.SchemaType, Saxon.Hej.om.AttributeMap, Saxon.Hej.om.NamespaceMap, Saxon.Hej.s9api.Location, Int32)
   at Saxon.Hej.event.ProxyReceiver.startElement(Saxon.Hej.om.NodeName, Saxon.Hej.type.SchemaType, Saxon.Hej.om.AttributeMap, Saxon.Hej.om.NamespaceMap, Saxon.Hej.s9api.Location, Int32)
   at Saxon.Hej.event.SequenceNormalizer.startElement(Saxon.Hej.om.NodeName, Saxon.Hej.type.SchemaType, Saxon.Hej.om.AttributeMap, Saxon.Hej.om.NamespaceMap, Saxon.Hej.s9api.Location, Int32)
   at Saxon.Hej.serialize.UncommittedSerializer.startElement(Saxon.Hej.om.NodeName, Saxon.Hej.type.SchemaType, Saxon.Hej.om.AttributeMap, Saxon.Hej.om.NamespaceMap, Saxon.Hej.s9api.Location, Int32)
   at Saxon.Hej.event.ProxyReceiver.startElement(Saxon.Hej.om.NodeName, Saxon.Hej.type.SchemaType, Saxon.Hej.om.AttributeMap, Saxon.Hej.om.NamespaceMap, Saxon.Hej.s9api.Location, Int32)
   at Saxon.Hej.event.ComplexContentOutputter.startContent()
   at Saxon.Hej.event.ComplexContentOutputter.startElement(Saxon.Hej.om.NodeName, Saxon.Hej.type.SchemaType, Saxon.Hej.s9api.Location, Int32)
   at Saxon.Hej.expr.instruct.ElementCreator.processLeavingTail(Saxon.Hej.event.Outputter, Saxon.Hej.expr.XPathContext, Saxon.Hej.om.NodeInfo)
   at Saxon.Hej.expr.instruct.Copy.processLeavingTail(Saxon.Hej.event.Outputter, Saxon.Hej.expr.XPathContext)
[...]
   at Saxon.Hej.expr.instruct.ElementCreator.processLeavingTail(Saxon.Hej.event.Outputter, Saxon.Hej.expr.XPathContext, Saxon.Hej.om.NodeInfo)
   at Saxon.Hej.expr.instruct.Copy.processLeavingTail(Saxon.Hej.event.Outputter, Saxon.Hej.expr.XPathContext)
   at Saxon.Hej.expr.instruct.TemplateRule.applyLeavingTail(Saxon.Hej.event.Outputter, Saxon.Hej.expr.XPathContext)
   at Saxon.Hej.trans.Mode.applyTemplates(Saxon.Hej.expr.instruct.ParameterSet, Saxon.Hej.expr.instruct.ParameterSet, Saxon.Hej.om.NodeInfo, Saxon.Hej.event.Outputter, Saxon.Hej.expr.XPathContextMajor, Saxon.Hej.s9api.Location)
   at Saxon.Hej.expr.instruct.ApplyTemplates.apply(Saxon.Hej.event.Outputter, Saxon.Hej.expr.XPathContext, Boolean)
   at Saxon.Hej.expr.instruct.ApplyTemplates.process(Saxon.Hej.event.Outputter, Saxon.Hej.expr.XPathContext)
   at Saxon.Hej.expr.instruct.ElementCreator.processLeavingTail(Saxon.Hej.event.Outputter, Saxon.Hej.expr.XPathContext, Saxon.Hej.om.NodeInfo)
   at Saxon.Hej.expr.instruct.Copy.processLeavingTail(Saxon.Hej.event.Outputter, Saxon.Hej.expr.XPathContext)
   at Saxon.Hej.expr.instruct.TemplateRule.applyLeavingTail(Saxon.Hej.event.Outputter, Saxon.Hej.expr.XPathContext)
   at Saxon.Hej.trans.Mode.applyTemplates(Saxon.Hej.expr.instruct.ParameterSet, Saxon.Hej.expr.instruct.ParameterSet, Saxon.Hej.om.NodeInfo, Saxon.Hej.event.Outputter, Saxon.Hej.expr.XPathContextMajor, Saxon.Hej.s9api.Location)
   at Saxon.Hej.expr.instruct.ApplyTemplates.apply(Saxon.Hej.event.Outputter, Saxon.Hej.expr.XPathContext, Boolean)
   at Saxon.Hej.expr.instruct.ApplyTemplates.process(Saxon.Hej.event.Outputter, Saxon.Hej.expr.XPathContext)
   at Saxon.Hej.expr.instruct.ElementCreator.processLeavingTail(Saxon.Hej.event.Outputter, Saxon.Hej.expr.XPathContext, Saxon.Hej.om.NodeInfo)
   at Saxon.Hej.expr.instruct.Copy.processLeavingTail(Saxon.Hej.event.Outputter, Saxon.Hej.expr.XPathContext)
   at Saxon.Hej.expr.instruct.TemplateRule.applyLeavingTail(Saxon.Hej.event.Outputter, Saxon.Hej.expr.XPathContext)
   at Saxon.Hej.trans.Mode.applyTemplates(Saxon.Hej.expr.instruct.ParameterSet, Saxon.Hej.expr.instruct.ParameterSet, Saxon.Hej.om.NodeInfo, Saxon.Hej.event.Outputter, Saxon.Hej.expr.XPathContextMajor, Saxon.Hej.s9api.Location)
   at Saxon.Hej.trans.rules.ShallowCopyRuleSet.process(Saxon.Hej.om.Item, Saxon.Hej.expr.instruct.ParameterSet, Saxon.Hej.expr.instruct.ParameterSet, Saxon.Hej.event.Outputter, Saxon.Hej.expr.XPathContext, Saxon.Hej.s9api.Location)
   at Saxon.Hej.expr.instruct.NextMatch.processLeavingTail(Saxon.Hej.event.Outputter, Saxon.Hej.expr.XPathContext)
   at Saxon.Hej.expr.instruct.Block.processLeavingTail(Saxon.Hej.event.Outputter, Saxon.Hej.expr.XPathContext)
   at Saxon.Hej.expr.instruct.TemplateRule.applyLeavingTail(Saxon.Hej.event.Outputter, Saxon.Hej.expr.XPathContext)
   at Saxon.Hej.trans.Mode.applyTemplates(Saxon.Hej.expr.instruct.ParameterSet, Saxon.Hej.expr.instruct.ParameterSet, Saxon.Hej.om.NodeInfo, Saxon.Hej.event.Outputter, Saxon.Hej.expr.XPathContextMajor, Saxon.Hej.s9api.Location)
   at Saxon.Hej.trans.XsltController.applyTemplates(Saxon.Hej.om.Sequence, Saxon.Hej.event.Receiver)
   at Saxon.Hej.s9api.AbstractXsltTransformer.applyTemplatesToSource(Saxon.Ejavax.xml.transform.Source, Saxon.Hej.event.Receiver)
   at Saxon.Hej.s9api.Xslt30Transformer.applyTemplates(Saxon.Ejavax.xml.transform.Source, Saxon.Hej.s9api.Destination)
   at Saxon.Hej.Transform.processFile(Saxon.Ejavax.xml.transform.Source, Saxon.Hej.s9api.XsltExecutable, Saxon.Ejava.io.File, Saxon.Hej.trans.CommandLineOptions)
   at Saxon.Hej.Transform.doTransform(System.String[])
   at Saxon.Hej.Transform.main(System.String[])
   at Saxon.Cmd.Command.Main(System.String[])

Perhaps something to improve in SaxonCS, to make it detect the (potential) stack overflow? Not sure whether the platform doesn't allow it as Java seems to allow it.


    (1-2/2)

    Please register to reply