Project

Profile

Help

Bug #4117

closed

java.lang.AssertionError : Target of component reference variable keywords is undefined (caused by inlining function calls across a package boundary)

Added by Jiri Dolejsi almost 6 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
-
Start date:
2019-01-29
Due date:
% Done:

100%

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

Description

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);
                
            
        }
}

Please register to edit this issue

Also available in: Atom PDF