Skip to content

oeuvres/teinte_xsl

Repository files navigation

Teinte, TEI shades, XSL pack

teinte_xsl is an XSLT-1.0 pack to transform XML texts, from, and to, different formats. The pivot format is a subset of TEI, an academic XML schema dedicated to all forms of texts. Some formats have a complex packaging (docx, epub…). Such agregations requires another programation language for file manipulation or zipping (php, java, python…), but some results are already possible with xslt only, see below for browser or command line.

Teinte xsl graph

This pack is compatible with xsltproc and other XSLT engines. Tested with

  • PHP: teinte_php
  • Java: alix
  • Python: a command line pilot for Python is planned, needs support teinte_py
  • Javascript: direct transformation in browser (see below)
  • Bash: (see below)

Browser

All modern browsers have the xsltproc library embedded. This allows to provide direct transformation in the browser. See this example XML file under a web server, you should see a nicely formatted theatre play, even if it’s an XML/TEI source.

Misanthrope

The magic rely on the XML prolog of the file

<?xml version="1.0" encoding="UTF-8"?>
<!-- Link to a transformation for the browser over https:// -->
<?xml-stylesheet type="text/xsl" href="https://oeuvres.github.io/teinte_xsl/tei_html.xsl"?>

This can be added to all TEI files to provide instant formatting online.

Offline, this feature is blocked for security reasons, see for example (image below) the result and the reason on the Google LLC proprietary browser. The open source Firefox browser offers a workaround to bypass this security setting (list below). This little manipulation is done for ever, is reversible, is a lot less risky than javascript through the web, but industry has more interests in JS than XSLT. For a TEI editor, this allows to see the results of its XML modifications by a simple reload in the browser.

Google.LLC.Chrome fileuri

  1. Firefox browser, in address bar, type about:config
  2. accept security alert
  3. search for the property: security.fileuri.strict_origin_policy
  4. set to false

Firefox fileuri

Bash

Under a linux box, or with a WSL linux on Microsoft.Windows, install xsltproc, and tranform your files.

sudo apt install xsltproc
cd teinte_xsl
xsltproc tei2html.xsl tests/moliere_misanthrope.xml

About

XSLT-1.0 pack to transform from, and to, TEI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published