Project

Profile

Help

How to pass Configuration File in Saxon-EE/C

Added by santanu das 4 months ago

Hi,

I've passed the config file to the PySaxonProcessor constructor in the following way in Python. But seems it's not working.

proc = saxonc.PySaxonProcessor(license=True, config_file='/tmp/scripts/config-saxon-ee.xml')
proc.set_catalog('/tmp/catalogs/catalog.xml')
xsltproc = proc.new_xslt30_processor()
output = xsltproc.transform_to_string(source_file='/tmp/sample.xml', stylesheet_file='/tmp/scripts/xsl/sample.xsl')
print(output)

Am I doing any wrong here? Also, do I need to pass the license file to the constructor? What is the proper way. Kindly suggest.

Could not find the proper documentation here https://www.saxonica.com/saxon-c/doc/html/saxonc.html

Thanks, Santanu


Replies (6)

Please register to reply

RE: How to pass Configuration File in Saxon-EE/C - Added by Martin Honnen 4 months ago

Can you explain in more detail what is not working? Which result do you want to have, which one or which errors do you get?

RE: How to pass Configuration File in Saxon-EE/C - Added by santanu das 4 months ago

Hi Martin,

The following line specifies the error:

XTSE3000: Cannot find package http://www.abc.com/xsltPackages/pipeline (version 1.0)

SAMPLE.xsl contains the following line: This file maps the package name with the 'sourceLocation' mentioned in config-saxon-ee.xml file

<xsl:use-package name="http://www.abc.com/xsltPackages/pipeline" package-version="1.0">

CONFIG-SAXON-EE.xml:

Hope this helps.

Thanks, Santanu

RE: How to pass Configuration File in Saxon-EE/C - Added by santanu das 4 months ago

Error:

XTSE3000: Cannot find package http://www.test.com/xsltPackages/pipeline (version 1.0)

sample.xsl:

<xsl:use-package name="http://www.test.com/xsltPackages/pipeline" package-version="1.0">

config-saxon-ee.xml:

<?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns="http://saxon.sf.net/ns/configuration" edition="EE">
<xsltPackages>
<package name="http://www.test.com/xsltPackages/pipeline" version="1.0" sourceLocation="packages/pipeline.xsl"/>
</xsltPackages>
</configuration>

Package name from sample.xsl is mapped to the 'sourceLocation' mentioned in 'config-saxon-ee.xml' file.

RE: How to pass Configuration File in Saxon-EE/C - Added by O'Neil Delpratt 4 months ago

Thank you for providing the code. I am looking into this now

RE: How to pass Configuration File in Saxon-EE/C - Added by O'Neil Delpratt 4 months ago

Hi, Sorry for the delay in coming back to you on this issue. Currently configuration file support is missing from the Python API for the Saxon/C 1.2.1 release. I created a bug issue for this some time ago. See #4418 for details. I have also added patched files in the same bug issue. You will have to replace the files sxoncClasses.pxd and saxonc.pyx and rebuild the product to able to use config files.

RE: How to pass Configuration File in Saxon-EE/C - Added by santanu das 4 months ago

Thanks for your work, Neil.

I will let you know once I succeed.

Thanks, Santanu

    (1-6/6)

    Please register to reply