Bug #5791
closedCannot load expression with tag gcEE. The stylesheet uses Saxon-EE features
100%
Description
Reported by user here: https://saxonica.plan.io/boards/4/topics/9173
Loading an compiled SEF stylesheet in SaxonC HE created with EE fails with the following error:
Cannot load expression with tag gcEE. The stylesheet uses Saxon-EE features
Updated by Michael Kay almost 2 years ago
In principle this shouldn't happen if the stylesheet is compiled with target="HE".
Updated by Martin Honnen almost 2 years ago
Yes, Mike, but I currently only have access to the Python wheels and can only compile with the Python API and that results in an executable compiled for EE as there seems to be no way to set the target. And a Saxon EE 11.4 compiled HE targeted SEF didn't run through with SaxonC HE 11.99. So https://saxonica.plan.io/boards/4/topics/9173 is more about whether there is a way to set the target with the Python API or whether SaxonC needs a method to allow that.
Updated by O'Neil Delpratt almost 2 years ago
- Category changed from Saxon-C Internals to SaxonC API
- Status changed from New to Resolved
- % Done changed from 0 to 100
bug fixed and committed to repository. I have added the following methods on C++, Python and PHP:
void setXsltLanguageVersion(const char* version)
void setFastCompilation(bool fast)
void setTargetEdition(const char* edition)
void setRelocatable(bool relocatable)
Updated by Martin Honnen almost 2 years ago
O'Neil,
the SaxonC C++ API https://www.saxonica.com/saxon-c/doc12/html/classXslt30Processor.html#a9c57cd019a351b93a4fe801e6bff0582 documents e.g. setXsltLanguageVersion
for C++ but not for PHP and Python and with saxoncee from PyPi I don't find any method setXsltLanguageVersion
(or similar) in my Python API/IDE for the PyXslt30Processor.
Is that an intended omission for Saxon 12.0?
Updated by O'Neil Delpratt almost 2 years ago
See the Python doc: https://www.saxonica.com/saxon-c/doc12/html/saxonc.html#PyXslt30Processor-compile_stylesheet which has a number of keyword arguments: lang (str) should work.
**kwds: Possible keyword arguments: one of stylesheet_text (str), stylesheet_file (str),
associated_file (str) or stylesheet_node (PyXdmNode); save (bool) and output_file (str) can be used
to save the exported stylesheet (SEF) to file; lang (str) can be used to set the XSLT (and XPath)
language level to be supported by the processor (possible values: '3.0' and '4.0');
fast_compile (bool) which requests fast compilation.
The following additional keywords can be used with `save`: target (str) which sets the target edition
under which the compiled stylesheet will be executed; and relocate (bool) which says whether the
compiled stylesheet can be deployed to a different location, with a different base URI.
I admit the Python doc is not easy on the eye. We will look to improve it and add some more notes in the change history.
Updated by Martin Honnen almost 2 years ago
Sorry for not finding the keyword arguments in the documentation, guess I was understanding "I have added the following methods on C++, Python and PHP" too literally.
Nevertheless, I am encountering problems, the code
xslt30_processor.compile_stylesheet(stylesheet_file = 'pipeline-for-svrl.xsl', save = True, output_file = 'pipeline-for-svrl.xsl.SaxonEE12CompiledForHE.sef', target = 'HE')
gives me
SaxonC-EE 12.0 from Saxonica
Traceback (most recent call last):
File "C:\Users\marti\PycharmProjects\SaxonC1199EELocalWheelTest1\main.py", line 20, in <module>
xslt30_processor.compile_stylesheet(stylesheet_file = 'pipeline-for-svrl.xsl', save = True, output_file = 'pipeline-for-svrl.xsl.SaxonEE12CompiledForHE.sef', target = 'HE')
File "python_saxon\saxonc.pyx", line 1050, in saxoncee.PyXslt30Processor.compile_stylesheet
Exception: Error: compile_stylesheet should only contain one of the following keyword arguments: (associated_file|stylesheet_text|stylesheet_file|stylesheet_node) (with optional additional arguments: save, output_file)
The project name with SaxonC1199EE is kind of foolish now but I deleted the Saxon 11.99 package from the project and did python -m pip install saxoncee in it so I think I have the current release.
Perhaps I am just too tired for this evening to explore the new release properly so at this moment this is more a note-taking for myself to continue tomorrow with a fresh mind.
Updated by O'Neil Delpratt almost 2 years ago
- Status changed from Resolved to In Progress
Updated by O'Neil Delpratt almost 2 years ago
Yes there is a bug in the compile_stylesheet function. If the argument count is greater than 3 it throws the exception. We have now increased the possible options for the method. Therefore that logic is wrong.
Updated by O'Neil Delpratt almost 2 years ago
- Found in version changed from 11.4, 11.99 to 11.4, 11.99, 12
Bug issue reopened as found in SaxonC 12.0.
I have applied a fix for this issue, which you can pick up in the first maintenance release for SaxonC 12.
I was investigating a workaround, but the set_property
is not available on the PyXslt30Processor, but I think it should be available because we have introduced this method in the C++ API. I will create bug issue for that shortly.
Updated by O'Neil Delpratt almost 2 years ago
- Status changed from In Progress to Resolved
Updated by O'Neil Delpratt over 1 year ago
- Status changed from Resolved to Closed
- Fixed in version set to 12.1
Bug fixed applied in the SaxonC 12.1 maintenance release.
Please register to edit this issue