Project

Profile

Help

Bug #5791

closed

Cannot load expression with tag gcEE. The stylesheet uses Saxon-EE features

Added by O'Neil Delpratt almost 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Category:
SaxonC API
Start date:
2023-01-03
Due date:
% Done:

100%

Estimated time:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Found in version:
11.4, 11.99, 12
Fixed in version:
12.1
SaxonC Languages:
SaxonC Platforms:
SaxonC Architecture:

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
Actions #1

Updated by Michael Kay almost 2 years ago

In principle this shouldn't happen if the stylesheet is compiled with target="HE".

Actions #2

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.

Actions #3

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)
Actions #4

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?

Actions #5

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.

Actions #6

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.

Actions #7

Updated by O'Neil Delpratt almost 2 years ago

  • Status changed from Resolved to In Progress
Actions #8

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.

Actions #9

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.

Actions #10

Updated by O'Neil Delpratt almost 2 years ago

  • Status changed from In Progress to Resolved
Actions #11

Updated by O'Neil Delpratt almost 2 years 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

Also available in: Atom PDF