Project

Profile

Help

Bug #5495

closed

java.lang.UnsupportedOperationException: Cannot copy a variable reference whose binding is unknown

Added by Rohit Gaikwad over 2 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
s9api API
Sprint/Milestone:
-
Start date:
2022-05-18
Due date:
% Done:

0%

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

Description

Issue : We are getting below " binding is unknown " exception as in stackTrace while using Saxon-HE 10.8 and 11.3. With version 10.7 no regression is found.

Analysis:
I think the issue is at "/" in xsl:template of our source.xml file. It used to work till 10.7

Steps to reproduce :
Execute command below command using attached source.xml and myXsl.xsl files

java -jar saxon.jar -s:source.xml -xsl:myXsl.xsl

using Saxon-HE 10.8 or higher .

source.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<servlet-mapping>
    <servlet-name>MyServlet</servlet-name>
    <url-pattern>/servlet/MyServlet/*</url-pattern>
</servlet-mapping>

myXsl.xsl file:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
                xmlns="http://java.sun.com/xml/ns/javaee"
                xpath-default-namespace="http://java.sun.com/xml/ns/javaee">
<xsl:output method="xml" indent="no" encoding="UTF-8"/>

<xsl:param name="servletName"/>
<xsl:param name="urlPattern" select='concat("/servlet/",$servletName,"/*")'/>  <!-- Default to normal servlet URL pattern -->

<xsl:template match="servlet-mapping[servlet-name=$servletName] /
                         url-pattern[position()=last()]">
</xsl:template>
</xsl:stylesheet>

StackTrace :

java.lang.UnsupportedOperationException: Cannot copy a variable reference whose binding is unknown
        at net.sf.saxon.expr.GlobalVariableReference.copy(GlobalVariableReference.java:43)
        at net.sf.saxon.expr.Atomizer.copy(Atomizer.java:348)
        at net.sf.saxon.expr.GeneralComparison20.copy(GeneralComparison20.java:43)
        at net.sf.saxon.expr.FilterExpression.copy(FilterExpression.java:1183)
        at net.sf.saxon.expr.SlashExpression.copy(SlashExpression.java:659)
        at net.sf.saxon.pattern.GeneralNodePattern.makeTopNodeEquivalent(GeneralNodePattern.java:61)
        at net.sf.saxon.pattern.GeneralNodePattern.<init>(GeneralNodePattern.java:47)
        at net.sf.saxon.expr.SlashExpression.toPattern(SlashExpression.java:855)
        at net.sf.saxon.expr.sort.DocumentSorter.toPattern(DocumentSorter.java:249)
        at net.sf.saxon.pattern.PatternMaker.fromExpression(PatternMaker.java:45)
        at net.sf.saxon.pattern.PatternParser30.parsePattern(PatternParser30.java:130)
        at net.sf.saxon.pattern.Pattern.make(Pattern.java:59)
        at net.sf.saxon.style.StyleElement.makePattern(StyleElement.java:723)
        at net.sf.saxon.style.XSLTemplate.prepareAttributes(XSLTemplate.java:371)
        at net.sf.saxon.style.StyleElement.processAttributes(StyleElement.java:594)
        at net.sf.saxon.style.StyleElement.processAllAttributes(StyleElement.java:531)
        at net.sf.saxon.style.XSLTemplate.processAllAttributes(XSLTemplate.java:428)
        at net.sf.saxon.style.PrincipalStylesheetModule.processAllAttributes(PrincipalStylesheetModule.java:589)
        at net.sf.saxon.style.PrincipalStylesheetModule.preprocess(PrincipalStylesheetModule.java:366)
        at net.sf.saxon.style.Compilation.compilePackage(Compilation.java:288)
        at net.sf.saxon.style.StylesheetModule.loadStylesheet(StylesheetModule.java:252)
        at net.sf.saxon.style.Compilation.compileSingletonPackage(Compilation.java:113)
        at net.sf.saxon.s9api.XsltCompiler.compile(XsltCompiler.java:851)
        at net.sf.saxon.Transform.doTransform(Transform.java:753)
        at net.sf.saxon.Transform.main(Transform.java:82)

Files

myXsl.xsl (626 Bytes) myXsl.xsl XSL file Rohit Gaikwad, 2022-05-18 15:10
source.xml (170 Bytes) source.xml Source XML Rohit Gaikwad, 2022-05-18 15:14

Related issues

Has duplicate Saxon - Bug #5633: Cannot copy a variable reference whose binding is unknown [Saxon 11]Duplicate2022-08-04

Actions

Please register to edit this issue

Also available in: Atom PDF