Compiling XSLT to JavaScript with XJSLT
XML remains the best available way to markup text and is widely used in the publishing industry. XSLT, a declarative pattern matching language, remains the best way to transform XML from one form to another, and, importantly, to transform XML into HTML. Unfortunately, there have not been many implementations of XSLT 2 or 3 - the author only knows of one widely available (Saxon). With the release of fontoxpath, an XPath 3 implementation in TypeScript, it became feasible to implement an XSLT compiler that targets the JavaScript language. The JavaScript language has multiple implementations and can run on servers, browsers, and on “serverless” functions. With today’s JIT compilation, caching, and static analysis, we can target transform speeds comparable to other implementations. I will describe how compilation to JavaScript is achieved and some methods used for speeding up processing and present some possible uses for this project.
Presentation, 7 November 2024
Erik Hetzner is a staff software engineer at the
Public Library of Science (PLOS), a non-profit, open-access science
journal publisher, where he works on a variety of projects, including
the publishing platform, search, and systems to match papers to editors.
He lives in Berkeley, California. More information is available on his
website, https://www.e6h.org