Skip to content
forked from egh/xjslt

An XSLT 2.0 compiler (targeting JavaScript) written in TypeScript.

License

Notifications You must be signed in to change notification settings

martin-honnen/xjslt

 
 

Repository files navigation

XJSLT - An XSLT compiler in TypeScript

XJSLT is an XSLT 2.0 compiler (targeting JavaScript) written in TypeScript, depending on fontoxpath for an XPath implementation.

XJSLT compiles stylesheets to runnable JavaScript, so you can create transforms for use in a browser.

Tested with node 20 and (less extensively) in Chrome and Firefox.

Installation:

  • npm install && npm run build

Use:

  • xjslt test/simple2.xslt test/simple.xml

Stylesheet compilation example:

  • xjslt compile jats-html.xsl (will generate a transform.js file)
  • Open example.html (will load the generated transform.js file)

Supported features

  • 1985 passing tests in the XSLT test suite (https://github.com/w3c/xslt30-test)

  • 2419 not passing

  • if/choose/when/otherwise - conditional evaluation

  • template

  • apply-templates/for-each - recursive evaluation

  • element/attribute/value-of - dynamic elements, attributes, and text

  • literal text and xml element output

  • variable

  • namespaces

  • sort

  • include

  • result-document

Incompletely supported features

  • for-each-group (only group-by supported)
  • import (precedence not supported)
  • function basically work, with better typing TBD

TODO (not yet implemented)

  • strip-space/preserve-space
  • output
  • attribute-set
  • … (probably other things I’m not aware of or forgot)

About

An XSLT 2.0 compiler (targeting JavaScript) written in TypeScript.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 53.4%
  • XSLT 42.3%
  • JavaScript 4.1%
  • HTML 0.2%