Project

Profile

Help

Bug #4117

Updated by Michael Kay about 5 years ago

**SUMMARY** 

 This problem was caused by attempting to inline a function call to a function in a different package, where the called function accessed global variables private to that package. 

 **ORIGINAL REPORT** 


 We are using Saxon 9.9 EE/N.  
 Following code throws exception java.lang.AssertionError  
 ~~~ 
  class Program 
     { 
         static Processor processor = new Processor(true); 

         static string p = 
             @"<xsl:package name='http://www.ctk.cz/keywords/' " + 
             @"    xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:xs='http://www.w3.org/2001/XMLSchema' version='3.0' " + 
             @"    xmlns:kw='http://www.ctk.cz/keywords/'>" + 
             @"    <xsl:variable name='keywords' as='document-node()' static='yes'    select='parse-xml(""&lt;Keywords&gt;&lt;/Keywords&gt;"")'/>" + 
             @"    <xsl:function name='kw:get-keyword-value' as='xs:string' visibility='final'>" + 
             @"       <xsl:param name = 'qcode' as= 'xs:string'/>" + 
             @"       <xsl:sequence select='$keywords/Keywords//Keyword[@qcode eq $qcode]/Value'/>" + 
             @"    </xsl:function>" + 
             @"</xsl:package>"; 
   
	
         static string s = 
             @"<xsl:transform version='3.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:kw='http://www.ctk.cz/keywords/'> " + 
             @"    <xsl:use-package name='http://www.ctk.cz/keywords/'/>" + 
             @"    <xsl:template name='xsl:initial-template'> " + 
             @"        <out x='{kw:get-keyword-value(""abc"")}'/>" + 
             @"    </xsl:template>" + 
             @"</xsl:transform>"; 

         static void Main(string[] args) 
         { 

             processor.SetProperty("http://saxon.sf.net/feature/optimizationLevel", "-j"); 
             XsltCompiler xsltCompiler = processor.NewXsltCompiler(); 
             xsltCompiler.XsltLanguageVersion = "3.0"; 
             var ms = new MemoryStream(Encoding.UTF8.GetBytes(p)); 
             XsltPackage pp = xsltCompiler.CompilePackage(ms); 
             xsltCompiler.ImportPackage(pp); 
             XsltExecutable exec = xsltCompiler.Compile(new StringReader(s)); 
             Xslt30Transformer transf = exec.Load30(); 
             XdmDestination dest = new XdmDestination();  
             transf.CallTemplate(null, dest); 
             Console.WriteLine(dest.XdmNode); 
                
            
         } 
 } 
 ~~~

Back