Project

Profile

Help

Bug #4993

closed

java.lang.IllegalStateException: Prefix is bound to the wrong namespace {http://www.deltaxml.com/ns/mini-xhtml}

Added by Philip Fearon over 3 years ago. Updated over 3 years ago.

Status:
Duplicate
Priority:
Low
Assignee:
Category:
-
Sprint/Milestone:
-
Start date:
2021-05-18
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
10
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

This exception is thrown in Saxon 10.5 by an XSLT transform deep within our product's Java filter-chain class. The XML source file ([00-2]-dxml-whitespaceDetection.xml) for the transform (attached) has a root element in the default namespace (i.e. with no prefix).

I'm afraid I can't reproduce this exception yet in a simple test case outside our own products XSLT pipeline infrastructure.

Running the same transform from the command-line or a simplified Java Saxon API test does not reproduce the issue.

The full stack trace (when running testng) is shown at the end. The input file to the transform is attached.

A simplified version of the stylesheet that still throws the exception is shown below. Note that replacing the xsl:copy-of instruction and uncommenting the xsl:apply-templates instruction that is on the following line seems to be a viable workaround.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                exclude-result-prefixes="#all"
                version="3.0">
  
  <xsl:mode on-no-match="shallow-copy"/>
  
  <xsl:template match="/*">
    <xsl:copy>
      <xsl:copy-of select="node()"/>
      <!-- <xsl:apply-templates select="node()"/> -->
    </xsl:copy>
  </xsl:template>
  
</xsl:stylesheet>

Some additional context: We're in the process of adding Saxon 10.n compatibility to our Java project that currently supports Saxon 9.8 and 9.9. This problem appears in a number of our regression tests when run with Saxon 10.5, the same exception is not thrown with Saxon 9.8 or Saxon 9.9 versions. Here's the stack trace:

java.lang.RuntimeException: Internal error evaluating template rule  at line 8 in module file:/Users/philipf/dev/core/test/resources/xsl/formatting/rename-formatting.xsl
 at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:403)
 at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:568)
 at net.sf.saxon.trans.rules.ShallowCopyRuleSet.process(ShallowCopyRuleSet.java:73)
 at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:530)
 at net.sf.saxon.trans.XsltController.applyTemplates(XsltController.java:661)
 at net.sf.saxon.s9api.AbstractXsltTransformer.applyTemplatesToSource(AbstractXsltTransformer.java:360)
 at net.sf.saxon.s9api.XsltTransformer.transform(XsltTransformer.java:349)
	at com.deltaxml.cores9api.XsltStep.internalRunStep(XsltStep.java:173)
	at com.deltaxml.cores9api.RunnableFilterChain.runFilterChain(RunnableFilterChain.java:171)
	at com.deltaxml.cores9api.RunnableFilterChain.runFilterChain(RunnableFilterChain.java:353)
	at com.deltaxml.cores9api.PipelinedComparatorS9$Input1Runner.run(PipelinedComparatorS9.java:2383)
	at com.deltaxml.cores9api.PipelinedComparatorS9.compareXdmNode(PipelinedComparatorS9.java:1401)
	at com.deltaxml.cores9api.PipelinedComparatorS9.compare(PipelinedComparatorS9.java:1282)
	at com.deltaxml.cores9api.DocumentComparator.compare(DocumentComparator.java:1939)
	at com.deltaxml.cores9api.AbstractComparator.compare(AbstractComparator.java:387)
	at com.deltaxml.cores9api.DocumentComparator.compare(DocumentComparator.java:127)
	at com.deltaxml.cores9api.IgnorableWsPreservationTest.runSelectiveTestComparison(IgnorableWsPreservationTest.java:163)
	at com.deltaxml.cores9api.IgnorableWsPreservationTest.testIgnorableWsContent(IgnorableWsPreservationTest.java:85)
 at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
 at org.testng.internal.Invoker.invokeMethod(Invoker.java:583)
 at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:719)
 at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:989)
 at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
 at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
 at org.testng.TestRunner.privateRun(TestRunner.java:648)
 at org.testng.TestRunner.run(TestRunner.java:505)
 at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
 at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)
 at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)
 at org.testng.SuiteRunner.run(SuiteRunner.java:364)
 at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
 at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)
 at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208)
 at org.testng.TestNG.runSuitesLocally(TestNG.java:1137)
 at org.testng.TestNG.runSuites(TestNG.java:1049)
 at org.testng.TestNG.run(TestNG.java:1017)
 at org.testng.TestNG.privateMain(TestNG.java:1354)
 at org.testng.TestNG.main(TestNG.java:1323)
Caused by: java.lang.IllegalStateException: Prefix  is bound to the wrong namespace {http://www.deltaxml.com/ns/mini-xhtml}
 at net.sf.saxon.event.RegularSequenceChecker.startElement(RegularSequenceChecker.java:368)
 at net.sf.saxon.event.ComplexContentOutputter.startElement(ComplexContentOutputter.java:530)
 at net.sf.saxon.tree.tiny.TinyElementImpl.copy(TinyElementImpl.java:388)
 at net.sf.saxon.expr.instruct.CopyOf.copyOneNode(CopyOf.java:629)
 at net.sf.saxon.expr.instruct.CopyOf.lambda$processLeavingTail$1(CopyOf.java:561)
 at net.sf.saxon.om.SequenceIterator.forEachOrFail(SequenceIterator.java:136)
 at net.sf.saxon.expr.instruct.CopyOf.processLeavingTail(CopyOf.java:559)
 at net.sf.saxon.expr.instruct.Instruction.process(Instruction.java:142)
 at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:352)
 at net.sf.saxon.expr.instruct.Copy.processLeavingTail(Copy.java:429)
 at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:384)
 ... 42 more

Files

[00-2]-dxml-whitespaceDetection.xml (1.08 KB) [00-2]-dxml-whitespaceDetection.xml Philip Fearon, 2021-05-18 13:12
rename-formatting.xsl (417 Bytes) rename-formatting.xsl Philip Fearon, 2021-05-18 13:12

Please register to edit this issue

Also available in: Atom PDF