This is a modified BaseX distribution, provided by le-tex publishing services, with the following changes: * A Saxon PE Jar is included * The start scripts contain a default XML catalog location * The webapp directory contains an xslt module that provides an endpoint for XSLT transformations If you want to use Saxon PE features in your XSLT, you need to put a Saxon license file either into lib/custom/ or into ../a9s/common/saxon/ The latter location is the same that our XML Calabash distribution scans for Saxon license files. It assumes that there is a project directory with https://github.com/transpect/calabash-frontend as a Git submodule or https://subversion.le-tex.de/common/github-mirror/calabash_saxon_9.8/ as an svn external. Likewise, if this BaseX distribution is attached to a project directory as an svn external, it will not only look for a Saxon license at said location, but it will also use xmlcatalog/catalog.xml as the XML catalog. This location is given relative to the project directory. It is assumed that the BaseX HTTP server startup script is invoked from the project directory like this: basex/bin/basexhttp.bat -h5711 -p5710 -s5712 -S (assuming that we are on Windows and that we want to use the ports 5711, 5710, and 5712 for the HTTP server, the database server, and the stop service, respectively). If you don't use transpect libraries, you can do without a project directory, submodules/externals, and an XML catalog, and you can skip to the sample invocation URLs below. Catalog Resolution ================== In a transpect project, in addition to project-specific code in the a9s ("adaptations") directory, the project directory contains other submodules or externals, for example https://github.com/transpect/jats2html, https://github.com/transpect/hub2html, or https://github.com/transpect/xslt-util. The XSLT files in the adaptations and also in the transpect libraries themselves import other resources by canonical URIs, such as http://transpect.io/hub2html/xsl/hub2html.xsl. In order to resolve to local resources, in addition to being added to the project as submodules or externals, the modules' XML catalogs need to be referenced from the project's XML catalog using nextCatalog instructions. For example, the project catalog, xmlcatalog/catalog.xml, may look like this: assuming that http://transpect.io/hub2html/xsl/hub2html.xsl is mounted at [project_dir]/hub2html/ and https://github.com/transpect/xslt-util is mounted at [project_dir]/xslt-util/, where "mounted" here means "attached as svn external", "attached as git submodule", or just put there by any other means. XSLT Transformations ==================== You can invoke an XSLT transformation like this: http://localhost:5711/xslt/transform?s=file:///C:/path/to/data/some.docbook.xml&xsl=file:///C:/path/to/project/hub2html/xsl/xslt-only-orchestration.xsl&xslt-uri=file:///C:/path/to/project/a9s/common/hub2html/hub2html.xsl This is a Hub XML (essentially DocBook) to HTML transformation pipeline with some project-specific XSLT customization that resides at [project_dir]/a9s/common/hub2html/hub2html.xsl (and that very likely imports http://transpect.io/hub2html/xsl/hub2html.xsl). Currently, only an invocation by GET requests with URIs for XSLT and source document is implemented. In principle, the documents (and stylesheets) could also be POSTed. All other query parameters apart from s and xsl will be passed to the XSLT as parameters. Examples Included in This Distribution ====================================== 1. Test the presence of a valid Saxon license key: http://localhost:5711/xslt/transform?s=file:///C:/path/to/basex/etc/saxon-pe-test.xsl&xsl=file:///C:/path/to/basex/etc/saxon-pe-test.xsl The result should be an HTML page with a heading "success". As written above, saxon-license.lic is expected to reside in C:\path\to\a9s\common\saxon\ or in C:\path\to\basex\lib\custom\. 2. Render factbook.xml to a table etc/factbook.xml is included in the regular BaseX distribution as an example. We've added etc/factbook.xsl as an example rendering that creates a table out of factbook.xsl. The cities in factbook.xsl are sorted alphabetically in a table, grouped by starting letter. There is a link that uses Javascript to rewrite the location (page URL), causing the page to be reloaded with a different parameter. This parameter effects sorting the cities by opulation size. http://localhost:5711/xslt/transform?s=file:///C:/path/to/basex/etc/factbook.xml&xsl=file:///C:/path/to/basex/etc/factbook.xsl On a typical laptop it takes about 0.4 seconds when invoked with wget or curl, instead of 3.6 seconds when using Saxon on the command line (most of this is JVM startup time). The Saxon command line option -repeat:7 gives an execution time of approx 0.3 seconds per run. Compile time for the XSLT is about 0.08 seconds. Limitations =========== In contrast to fn:transform(), the BaseX xslt:transform() function does not support specifying an initial template or an initial mode, neither does it return a map with all result documents if there is more than a single primary output. You can overcome the initial template/mode limitations by writing a front-end XSLT that processes an input document and continues with the desired mode/template. Likewise you can also write a wrapper for stylesheets that expect parameters called s or xsl.