SaxonC “11.99” beta release

Welcome. This page contains a pre-release version of the Python wheels for (what will be) SaxonC HE 12.0. This test release is labeled “11.99” to distinguish it from the real release, but it’s built from the Saxon 12 code base. These files are being provided on an as-is basis for exploration and experimentation.

We appreciate any feedback that you might have, but please understand that we may be slow to respond over the upcoming holidays.

The following wheels are available:

ArchitecturePython version
Linux 3.8 3.9 3.10 3.11
MacOS (Intel) 3.8 3.9 3.10 3.11
MacOS (ARM) Unavailable in this pre-release
Windows 3.8 3.9 3.10 3.11

Installation

To install SaxonC, download the wheel that’s appropriate for your architecture and python version. For example, on Linux with Python 3.10, you would download saxonche-11.99.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (behind the “3.10” link above).

To install it, run

$ python -m pip install saxonche-11.99.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

For the actual release, we expect to publish SaxonC for Python through the standard PyPI package repositories. There will be additional installers for the C/C++ API and PHP. Those are not part of this pre-release.

Using SaxonC in Python

Now that it’s installed, you can use it in Python scripts. For example, this “smoke test” script, smoke.py:

from saxonc import *

with PySaxonProcessor(license=False) as saxon:
    print(saxon.version)

will print out the version of SaxonC:

$ python smoke.py 
SaxonC-HE 12.0 from Saxonica

(Why does that print 12.0 instead of 11.99? Congratulations, that’s the first 🪲)

For a more interesting example, start with doc.xml:

<doc>
  <title>Document title</title>
  <para>This is a test paragraph.</para>
</doc>

And doc2html.xsl:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
		xmlns="http://www.w3.org/1999/xhtml"
                exclude-result-prefixes="xs"
		expand-text="yes"
                version="3.0">

  <xsl:output method="xhtml" html-version="5"
	      encoding="utf-8" indent="yes"
	      omit-xml-declaration="yes"/>

  <xsl:strip-space elements="doc"/>
  
  <xsl:template match="/">
    <html>
      <head>
	<title>
	  <xsl:apply-templates select="doc/title/node()"/>
	</title>
      </head>
      <xsl:apply-templates/>
    </html>
  </xsl:template>

  <xsl:template match="doc">
    <body>
      <xsl:apply-templates/>
    </body>
  </xsl:template>

  <xsl:template match="title">
    <h1>
      <xsl:apply-templates/>
    </h1>
  </xsl:template>
  
  <xsl:template match="para">
    <p>
      <xsl:apply-templates/>
    </p>
  </xsl:template>

</xsl:stylesheet>

And the (just barely not quite trivial) Python script, xform.py:

from saxonc import *

with PySaxonProcessor(license=False) as saxon:
    xslt = saxon.new_xslt30_processor()
    xexec = xslt.compile_stylesheet(stylesheet_file="doc2html.xsl")
    node = saxon.parse_xml(xml_file_name="doc.xml")
    print(xexec.apply_templates_returning_string(xdm_value=node))

Running it will transform the document:

$ python xform.py 
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml">
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
      <title>Document title</title>
   </head>
   <body>
      <h1>Document title</h1>
      <p>This is a test paragraph.</p>
   </body>
</html>

We have published (but not linked to) the SaxonC 12.0 documentation. The Python API documentation is perhaps the most immediately relevant. We believe that documentation is correct with respect to this pre-release.