Project

Profile

Help

New problem with saxon-he 9.7.0-1 java. Worked in previous release

Added by John Francis about 8 years ago

I have the following stylesheet which adds some additional definitions to a schema;



	
	
	
	

	
		
			
		
	

	
		
			
				
				
			
			
			
			

			Start inserted includes and imports

			
				
			
			
				
					
						 
					
					
						
					
				
			
			End inserted includes and imports

			
		
	
	
	
		
        	
        	
	            
	                
	            
	        
    	
	


I invoke it using JAXP (sorry);

        private static final File includesInsertionTransform  = new File("files/ae1130/InsertIncludesAndImports.xsl");

        @Test
        public void test1() throws TransformerConfigurationException  {
            StreamSource s = new StreamSource(includesInsertionTransform);
            TransformerFactory transformFactory = TransformerFactory.newInstance("net.sf.saxon.TransformerFactoryImpl", null);
            transformFactory.newTemplates(s);
        }

Prior to 9.7 this all worked okay, but now I am getting the following error;

java.lang.NullPointerException: Internal error: expression element() has no retained static context
	at net.sf.saxon.expr.Expression.getConfiguration(Expression.java:1080)
	at net.sf.saxon.expr.AxisExpression.typeCheck(AxisExpression.java:123)
	at net.sf.saxon.pattern.AncestorQualifiedPattern.typeCheck(AncestorQualifiedPattern.java:153)
	at net.sf.saxon.pattern.PatternWithPredicate.typeCheck(PatternWithPredicate.java:228)
	at net.sf.saxon.pattern.GeneralNodePattern.optimize(GeneralNodePattern.java:120)
	at net.sf.saxon.style.XSLTemplate.optimize(XSLTemplate.java:790)
	at net.sf.saxon.style.PrincipalStylesheetModule.optimizeTopLevel(PrincipalStylesheetModule.java:1347)
	at net.sf.saxon.style.PrincipalStylesheetModule.compile(PrincipalStylesheetModule.java:1197)
	at net.sf.saxon.style.Compilation.compilePackage(Compilation.java:244)
	at net.sf.saxon.style.StylesheetModule.loadStylesheet(StylesheetModule.java:256)
	at net.sf.saxon.style.Compilation.compileSingletonPackage(Compilation.java:101)
	at net.sf.saxon.s9api.XsltCompiler.compile(XsltCompiler.java:777)
	at net.sf.saxon.jaxp.SaxonTransformerFactory.newTemplates(SaxonTransformerFactory.java:152)
	at uk.co.his.test.cf.junit.tracs.ae1130.TestCase.test1(TestCase.java:19)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

I have attached the Maven test project and the individual files.

NOTE: The document('memory:additional') param initializer uses a custom URI scheme type to load data from a java.lan.String. But It doesn't seem to be causing this problem.

InsertIncludesAndImports.xsl (1.94 KB) InsertIncludesAndImports.xsl stylesheet which causes the problem
TestCase.java (708 Bytes) TestCase.java java test case
pom.xml (689 Bytes) pom.xml pom for test case
Project.zip (4.09 KB) Project.zip All the above in a zipped Maven project for testing

Replies (5)

Please register to reply

RE: New problem with saxon-he 9.7.0-1 java. Worked in previous release - Added by Michael Kay about 8 years ago

Thanks for reporting it. I've logged it as a bug here for tracking purposes:

https://saxonica.plan.io/issues/2582

The problem appears to arise in Saxon-HE only.

RE: New problem with saxon-he 9.7.0-1 java. Worked in previous release - Added by John Francis about 8 years ago

Thanks. For what its worth I managed to reduce it to this;



	
	
	 
	


@Test
	public void test5() throws TransformerConfigurationException, SaxonApiException  {
		StreamSource s = new StreamSource(micro);
		Processor p = new Processor(false);
		p.newXsltCompiler().compile(s);
	}

RE: New problem with saxon-he 9.7.0-1 java. Worked in previous release - Added by Michael Kay about 8 years ago

Thanks, that helps: I had already isolated it to this kind of match pattern, but the simpler the repro, the easier the debugging...

RE: New problem with saxon-he 9.7.0-1 java. Worked in previous release - Added by Michael Kay about 8 years ago

You can probably make progress by changing the pattern to (the equivalent of)

match="root/*[not(following-sibling::*)]"

which is in any case more efficient.

RE: New problem with saxon-he 9.7.0-1 java. Worked in previous release - Added by John Francis about 8 years ago

That fixed the compilation. Waiting on an integration test. Thanks

    (1-5/5)

    Please register to reply