Project

Profile

Help

Internal error evaluating template rule

Added by Vladimir Nesterovsky over 6 years ago

Please take a look at exception we see. Later we shall try provide a simple test case that reproduce the problem.

 [java] Exception in thread "main" java.lang.RuntimeException: Internal error evaluating template rule  at line 160 in module ...1.xslt
 [java] 	at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:360)
 [java] 	at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:502)
 [java] 	at net.sf.saxon.trans.TextOnlyCopyRuleSet.process(TextOnlyCopyRuleSet.java:69)
 [java] 	at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:478)
 [java] 	at net.sf.saxon.Controller.transformDocument(Controller.java:2402)
 [java] 	at net.sf.saxon.Controller.transform(Controller.java:1970)
 [java] 	at net.sf.saxon.s9api.XsltTransformer.transform(XsltTransformer.java:596)
 [java] 	at net.sf.saxon.jaxp.TransformerImpl.transform(TransformerImpl.java:73)

... [java] Caused by: java.lang.RuntimeException: Internal error evaluating template rule at line 159 in module ...2.xslt [java] at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:360) [java] at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:502) [java] at net.sf.saxon.expr.instruct.ApplyTemplates$ApplyTemplatesPackage.processLeavingTail(ApplyTemplates.java:553) [java] at net.sf.saxon.expr.instruct.CallTemplate.process(CallTemplate.java:355) [java] at net.sf.saxon.expr.instruct.CallTemplate.processLeavingTail(CallTemplate.java:411) [java] at net.sf.saxon.expr.instruct.Choose.processLeavingTail(Choose.java:879) [java] at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:687) [java] at net.sf.saxon.expr.instruct.Instruction.process(Instruction.java:151) [java] at net.sf.saxon.expr.LetExpression.process(LetExpression.java:588) [java] at net.sf.saxon.expr.instruct.ForEach.processLeavingTail(ForEach.java:472) [java] at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:687) [java] at net.sf.saxon.expr.instruct.NamedTemplate.expand(NamedTemplate.java:262) [java] at net.sf.saxon.expr.instruct.CallTemplate.process(CallTemplate.java:353) [java] at net.sf.saxon.expr.instruct.CallTemplate.processLeavingTail(CallTemplate.java:411) [java] at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:687) [java] at net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:701) [java] at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:347) [java] ... 11 more [java] Caused by: java.lang.RuntimeException: Internal error evaluating template rule at line 278 in module ...1.xslt [java] at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:360) [java] at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:502) [java] at net.sf.saxon.expr.instruct.ApplyTemplates.apply(ApplyTemplates.java:295) [java] at net.sf.saxon.expr.instruct.ApplyTemplates.process(ApplyTemplates.java:248) [java] at net.sf.saxon.expr.parser.ExpressionTool.evaluate(ExpressionTool.java:349) [java] at net.sf.saxon.expr.parser.ExpressionTool.eagerEvaluate(ExpressionTool.java:462) [java] at net.sf.saxon.expr.TryCatch.iterate(TryCatch.java:262) [java] at net.sf.saxon.expr.Expression.process(Expression.java:927) [java] at net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:703) [java] at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:687) [java] at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:347) [java] ... 27 more [java] Caused by: java.lang.ClassCastException: net.sf.saxon.tree.util.FastStringBuffer cannot be cast to java.lang.String [java] at net.sf.saxon.functions.Serialize.setSerializationParams(Serialize.java:365) [java] at net.sf.saxon.functions.Serialize.evalSerialize(Serialize.java:485) [java] at net.sf.saxon.functions.Serialize.call(Serialize.java:441) [java] at net.sf.saxon.functions.Serialize.call(Serialize.java:49) [java] at net.sf.saxon.expr.FunctionCall.iterate(FunctionCall.java:547) [java] at net.sf.saxon.expr.Expression.evaluateItem(Expression.java:840) [java] at net.sf.saxon.expr.parser.Evaluator$4.evaluate(Evaluator.java:85) [java] at net.sf.saxon.expr.SystemFunctionCall.evaluateArguments(SystemFunctionCall.java:448) [java] at net.sf.saxon.expr.FunctionCall.iterate(FunctionCall.java:545) [java] at net.sf.saxon.expr.Expression.process(Expression.java:927) [java] at net.sf.saxon.expr.instruct.UserFunction.process(UserFunction.java:649) [java] at net.sf.saxon.expr.UserFunctionCall.process(UserFunctionCall.java:589) [java] at net.sf.saxon.expr.instruct.ResultDocument.processInstruction(ResultDocument.java:480) [java] at net.sf.saxon.Configuration.processResultDocument(Configuration.java:2272) [java] at net.sf.saxon.expr.instruct.ResultDocument.process(ResultDocument.java:387) [java] at net.sf.saxon.expr.instruct.ResultDocument.processLeavingTail(ResultDocument.java:373) [java] at net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:701) [java] at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:687) [java] at net.sf.saxon.expr.instruct.Instruction.process(Instruction.java:151) [java] at net.sf.saxon.expr.LetExpression.process(LetExpression.java:588) [java] at net.sf.saxon.expr.instruct.ForEach.processLeavingTail(ForEach.java:472) [java] at net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:701) [java] at net.sf.saxon.expr.instruct.Choose.processLeavingTail(Choose.java:879) [java] at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:687) [java] at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:347) [java] ... 37 more

The problem is probably related to fn:serialize() which we use for the first time.

where output parameters are defined as:

<xsl:variable name="p:output" as="map(*)" select=" map { 'method': 'html', 'indent': true(), 'html-version': 5.0, 'encoding': 'utf-8', 'omit-xml-declaration': true(), 'use-character-maps': map { '': ' ', '€': ' ', '': ' ', '‚': ' ', 'ƒ': ' ', '„': ' ', '…': ' ', '†': ' ', '‡': ' ', 'ˆ': ' ', '‰': ' ', 'Š': ' ', '‹': ' ', 'Œ': ' ', '': ' ', 'Ž': ' ', '': ' ', '': ' ', '‘': ' ', '’': ' ', '“': ' ', '”': ' ', '•': ' ', '–': ' ', '—': ' ', '˜': ' ', '™': ' ', 'š': ' ', '›': ' ', 'œ': ' ', '': ' ', 'ž': ' ', 'Ÿ': ' ' } }"/>

Regardless of whether we do it right or wrong, we did not expect this exception.


Replies (2)

RE: Internal error evaluating template rule - Added by Michael Kay over 6 years ago

Thanks, this seems to be such a simple coding error that we can fix it without needing a repro.

    (1-2/2)

    Please register to reply