Home Articles Books Search About
日本語
Fast TEI/XML Deployment on Vercel: Automating XSLT Transformation with saxon-js

Fast TEI/XML Deployment on Vercel: Automating XSLT Transformation with saxon-js

Introduction A common architecture in Digital Humanities is to transform TEI (Text Encoding Initiative) XML data into HTML using XSLT and publish it on the web. Traditionally, client-side XSLT transformation in the browser (via <?xml-stylesheet?> or JavaScript’s XSLTProcessor) has been the standard approach, but it comes with several challenges: The browser executes XSLT transformation on every page load, resulting in slow rendering Poor SEO and web crawler support Inconsistent XSLT implementations across browsers This article shows how to run XML-to-HTML transformation at build time on Vercel and serve pre-generated static HTML. ...

Fast TEI/XML Deployment on Vercel: Automating XSLT Transforms with saxon-js

Fast TEI/XML Deployment on Vercel: Automating XSLT Transforms with saxon-js

Introduction A common architecture in Digital Humanities is to encode texts in TEI (Text Encoding Initiative) XML and transform them to HTML via XSLT for web publication. Traditionally, this transformation is done client-side in the browser (using <?xml-stylesheet?> or JavaScript’s XSLTProcessor), but this approach has several drawbacks: The browser must run the XSLT transformation on every page load, slowing down rendering Poor SEO / crawler support Browser-specific XSLT implementation differences This article describes how to run XSLT transforms at build time on Vercel and serve pre-built HTML as a static site. ...

5x Faster XSLT Processing: Migrating from Saxon-JS to Saxon-HE

TL;DR By switching from npx xslt3 (Saxon-JS) to Java Saxon-HE for TEI XML → HTML transformation, build time dropped from 1m48s to 23s (~5x speedup). Background Kōi Genji Monogatari Text DB is a digital edition of The Tale of Genji with 54 TEI XML files (one per chapter). The build script (Python) invoked npx xslt3 54 times to transform each XML into HTML. python3 scripts/prebuild.py xsl # XSLT for all 54 chapters This was the slowest step in the entire build pipeline. ...

Declarative Multi-Format Conversion with TEI Processing Model

Declarative Multi-Format Conversion with TEI Processing Model

Introduction TEI (Text Encoding Initiative) is a widely used standard for digitizing humanities texts. This article introduces a case study of using the Processing Model feature introduced in TEI P5 to achieve conversion from TEI XML to multiple formats (HTML, LaTeX/PDF, EPUB3). https://www.tei-c.org/Vault/P5/3.0.0/doc/tei-p5-doc/en/html/TD.html#TDPM The target project uses texts published in the “Koui Genji Monogatari” (Collated Tale of Genji) as an example. https://kouigenjimonogatari.github.io/ Background Previously, conversion processes were performed individually, as introduced in the following articles. ...

Real-Time Preview of TEI/XML Using VSCode and XSLT

Real-Time Preview of TEI/XML Using VSCode and XSLT

Overview I prototyped a real-time preview environment for TEI/XML using VSCode and XSLT, so this is a memo of the process. Behavior An example of the operation is shown below. When you edit and save a TEI/XML file, the browser display is updated. https://youtu.be/ZParCRUc5AY?si=-aHHi3bIZGWoJYnP Preparation Install the following extensions: Live Server Trigger Task on Save When a TEI/XML file is saved, Trigger Task on Save executes the XSLT transformation, and the resulting HTML file is viewed with Live Server. ...

Creating PDFs from TEI/XML of the Koui Genji Monogatari Text Database

Creating PDFs from TEI/XML of the Koui Genji Monogatari Text Database

Overview The Koui Genji Monogatari (Collated Tale of Genji) Text Database publishes text data from “Koui Genji Monogatari.” https://kouigenjimonogatari.github.io/ This time, I added PDF files like the following to the database. https://kouigenjimonogatari.github.io/output/01/main.pdf This article describes how to create such PDF files using XSLT and TeX. Cloning the Repository Clone the repository as follows. git clone --depth 1 https://github.com/kouigenjimonogatari/kouigenjimonogatari.github.io Then install xslt3 with the following command. npm i xslt3 https://www.npmjs.com/package/xslt3 Creating the XSL File This time, we first convert the TEI/XML file to a TeX file. ...

Achieving Parallel Display of IIIF and TEI Using XSLT

Achieving Parallel Display of IIIF and TEI Using XSLT

Overview I had the opportunity to implement parallel display of IIIF and TEI using XSLT, so this is a memo of the process. The results can be viewed at the following link. It uses the “Koui Genji Monogatari Text DB.” https://kouigenjimonogatari.github.io/xml/xsl/01.xml Background For visualizing TEI/XML, I had previously often used CETEICean, a JavaScript library for converting TEI XML to HTML and displaying it in browsers. These efforts enabled flexible development when combined with JavaScript frameworks. ...

Created a Sample Repository for Running XSLT in Node.js

Created a Sample Repository for Running XSLT in Node.js

I created a sample repository for running XSLT in Node.js. https://github.com/ldasjp8/nodejs-xslt We hope this is helpful when processing TEI/XML files and similar in Node.js.