Project

Profile

Help

Does Saxon 12 have different rules for context item persistance?

Added by Syd Bauman almost 2 years ago

I have not tried very hard to narrow down this problem yet. But in running the TEI Stylesheets, both for building the TEI Guidelines and for building a custom schema, using Saxon 10 or Saxons 10 or 11, respectively, I got no error messages. On switching to Saxon 12 in both cases I got (different versions of) “No context item”. (In all cases I am using the Java version of HE from the commandline.)

Because the TEI Stylesheets are large and, by some definitions, poorly written (at least 1 entire academic paper has been written on how problematic they are; they occupy 2 of the 3 lowest spots in Gerrit Imsieke’s list of HOAXCoQS scores), I cannot easily tell whether the context item is available, Saxon 10 is right, and Saxon 12 is screwing up; or the context item is not available, Saxon 10 was too permissive, and Saxon 12 is correctly complaining; or something else.

So I thought that before I dive in and try to recreate the problem in a smaller way such that it could usefully be posted to xsl-list or as a bug report (which will likely take hours, not minutes), I would ask here a) if anyone else has noticed similar behavior, or b) if Saxon has changed how it looks for context items?


Replies (7)

Please register to reply

RE: Does Saxon 12 have different rules for context item persistance? - Added by Michael Kay almost 2 years ago

I'm not immediately aware of anything that would cause this. It might be useful to see the exact error message. Given that 12.0 is brand new, and that there's a lot of internal re-engineering, it's entirely likely that it's a bug.

Feel free to post the whole thing as a bug report. The important thing in a bug report is to make the test case easy to run (which means cutting out unnecessary dependencies); it doesn't really matter if the stylesheet or source document is large, that's something we can usually cope with.

RE: Does Saxon 12 have different rules for context item persistance? - Added by Syd Bauman almost 2 years ago

Will be working on a bug report version soon. (I am not even sure what all the dependencies are at the moment. For the build, the Makefile generates an ant file that is then run. I think if I send you an input file, the Stylesheets suite, and the ant file you may have enough.) In the meantime the two messages are

  • “Fatal Error! Cannot call the key() function when there is no context item”; and
  • “Fatal Error! The context item is absent”.

RE: Does Saxon 12 have different rules for context item persistance? - Added by Syd Bauman almost 2 years ago

Ooh, got one! Here is a procedure to replicate one of the error messages:

$ cd /tmp/
$ git clone git@github.com:TEIC/Stylesheets.git   # or “git clone https://github.com/TEIC/Stylesheets.git” or “gh repo clone TEIC/Stylesheets”
$ cd Stylesheets
$ java -jar /YOUR/PATH/TO/saxon-he-12.0.jar -xsl:html/html.xsl -s:Test2/inputFiles/testRendition1.xml -o:/tmp/erase.me.xml

The template being complained about starts on line 701 of the file ./common/verbatim.xsl. All 5 calls to that template are from the same file (3 in template "verbatim-processAttributes", 2 in template "verbatim-nextAttribute"), thus making this a (comparatively) self-contained case.

RE: Does Saxon 12 have different rules for context item persistance? - Added by Michael Kay almost 2 years ago

Thanks. I've reproduced it and caught the failure in the debugger, so it shouldn't be too difficult to solve. It's something to do with lazy evaluation of the with-param value string(@name) - lazy evaluation involves saving enough of the context to enable the expression to be evaluated later, and it looks like this hasn't happened for some reason.

RE: Does Saxon 12 have different rules for context item persistance? - Added by Syd Bauman almost 2 years ago

P.S. The output file is XHTML, so I suppose I should have used the extension “.xhtml” or “.html”, not “.xml”. But since no output is generated …

RE: Does Saxon 12 have different rules for context item persistance? - Added by Syd Bauman almost 2 years ago

Excellent! I am inclined to hold off on poking around to try to replicate the other error condition in the hopes that whatever fix there is to this one fixes that one, too. And do you want me to submit this as a bug on https://saxonica.plan.io/projects/saxon/issues?

    (1-7/7)

    Please register to reply