Project

Profile

Help

Bug #4298

Updated by Michael Kay over 4 years ago

This problem is in 9.9 but not 9.8. I believe it may have been introduced in a recent minor release, because I believe I had been using an earlier 9.9 version without the problem. 

 Execute the following legal stylesheet against any input: 

 ~~~ 
 <xsl:stylesheet version="3.0" 
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 

   <xsl:template match="/"> 
     <xsl:variable name="node" select="//whatever"/> 
     <xsl:sequence select="$node/(/foo/string())"/> 
   </xsl:template> 

 </xsl:stylesheet> 
 ~~~ 

 Here is the error that resulted: 

 ~~~ 
 java.lang.UnsupportedOperationException: Cannot copy a variable reference whose binding is unknown 
         at net.sf.saxon.expr.LocalVariableReference.copy(LocalVariableReference.java:57) 
         at net.sf.saxon.expr.SlashExpression.rebuildSteps(SlashExpression.java:1039) 
         at net.sf.saxon.expr.SlashExpression.getLeadingSteps(SlashExpression.java:1068) 
         at net.sf.saxon.expr.HomogeneityChecker.typeCheck(HomogeneityChecker.java:58) 
         at net.sf.saxon.style.StyleElement.typeCheck(StyleElement.java:1555) 
         at net.sf.saxon.style.XSLSequence.validate(XSLSequence.java:95) 
         at net.sf.saxon.style.StyleElement.validateSubtree(StyleElement.java:1744) 
         at net.sf.saxon.style.StyleElement.validateChildren(StyleElement.java:1779) 
         at net.sf.saxon.style.StyleElement.validateSubtree(StyleElement.java:1748) 
         at net.sf.saxon.style.XSLTemplate.validateSubtree(XSLTemplate.java:595) 
         at net.sf.saxon.style.PrincipalStylesheetModule.preprocess(PrincipalStylesheetModule.java:404) 
         at net.sf.saxon.style.Compilation.compilePackage(Compilation.java:286) 
         at net.sf.saxon.style.StylesheetModule.loadStylesheet(StylesheetModule.java:259) 
         at net.sf.saxon.style.Compilation.compileSingletonPackage(Compilation.java:107) 
         at net.sf.saxon.s9api.XsltCompiler.compile(XsltCompiler.java:785) 
         at net.sf.saxon.Transform.doTransform(Transform.java:741) 
         at net.sf.saxon.Transform.main(Transform.java:80) 
 Fatal error during transformation: java.lang.UnsupportedOperationException: Cannot copy a variable reference whose binding is unknown 

 ~~~ 
 My workaround is to use the root() function as in root($node)/foo/string(). This successfully avoids the problem.

Back