I’ve made slight progress. I created a test project that isolates the transformation process so that I can eliminate some variables. My first test gave a different transform error that indicates that I reached an undefined parameter. It’s probably my mistake so I’m crawling down that rabbit hole right now.
I still have the name pool error in our development environment so I’m still working on what’s causing it and how to handle it.
Here are the steps that I take to create my XsltTransformer:
XsltExecutable executable = null;
XsltTransformer transformer = null;
XsltCompiler compiler = null;
Processor processor = null;
processor = new Processor();
compiler = processor.NewXsltCompiler();
compiler.ErrorList = new System.Collections.ArrayList();
compiler.BaseUri = new Uri(xsltSource);
// Create an executable stylesheet from a URI
executable = compiler.Compile(new Uri(xsltSource));
transformer = executable.Load();
The Transformer object is stored until it’s time to Run. As I understand it the Configuration that you refer to is created and stored in the Processor object. Your response prompted me to investigate these steps and right away I found that the Transformer had 2 properties with exceptions:
The BaseOutputUri property had an exception message “Value cannot be null.” The stacktrace look like this:
at System.Uri..ctor(String uriString)
The InitialMode property had an exception message “Unknown name code -1”
at net.sf.saxon.om.NamePool.unknownNameCode(Int32 i)
at net.sf.saxon.om.NamePool.getClarkName(Int32 i)
I didn’t notice these before and wonder how these exceptions weren’t thrown during initialization. So, at this point I began creating the test project so that I could test outside of our application source and also compare the differences between 8.6 and 8.9. I wanted to make sure these weren’t silly mistakes on my part before I posted more questions.
From: Michael Kay
Sent: Friday, May 18, 2007 12:55 PM
To: 'Mailing list for SAXON XSLT queries'
Cc: Harold Palacio
Subject: RE: [saxon] XsltTransformer DynamicError
I just realised I misinformed you slighly on this one. Since Saxon 8.9 it's no longer true that Saxon by default uses a single static NamePool: it now uses a different NamePool for each Configuration. It's still true that compiling the stylesheet and building the source document must be done under the same Configuration and therefore the same NamePool.
Have you made any progress with the problem?
From: firstname.lastname@example.org [mailto:email@example.com] On Behalf Of Michael Kay
Sent: 17 May 2007 00:11
To: 'Mailing list for SAXON XSLT queries'
Subject: Re: [saxon] XsltTransformer DynamicError
Saxon introduced some tighter checking, I think it was in 8.7 or perhaps 8.8, to ensure that the source document and the compiled stylesheet use the same mapping of integer name codes to actual QNames. Without this checking you could get some rare but very difficult to diagnose failures.
Saxon rarely creates a NamePool itself (by default it uses the same static NamePool all the time), so this is likely to mean that you are creating a NamePool from within your own code. I know that Hotsos uses stylesheet compilation extensively and the problem could be in that area (though I wasn't aware that stylesheet compilation worked on .NET...)
In fact it's much more common to get errors saying that the are multiple Configurations in use, rather than multiple NamePools. If the stylesheet and source document were built using the same Configuration (or the same TransformerFactory) then they will automatically use the same NamePool, unless you change the NamePools attached to the Configuration in mid-fllight, which would be fatal.
From: firstname.lastname@example.org [mailto:email@example.com] On Behalf Of Harold Palacio
Sent: 16 May 2007 22:10
Subject: [saxon] XsltTransformer DynamicError
I’ve recently upgraded from Saxon .Net 8.6 to 8.9 and during unit testing I reached an error that has gotten me a little stumped. The error is a DynamicError with the message “Source document and stylesheet must use the same name pool”. There are some other properties of the error which did not give me much help: URI=”” and LineNumber=-1.
I’ve searched the List archives and Google’d for this error and have found very little information to help troubleshoot this problem. Can somebody give me a hint to what would cause this error? Any help is much appreciated.