Skip to content

Joining forces on Xee, the Rust XPath/XSLT library

Recently, an article has been making the rounds on social media around me (So.. Mastodon and top Hacker News posts 😁).
It is titled, "Google is killing the open web", and it analyzes the recent proposal to remove XSLT support from browsers.

Now, I'm not here to pronounce judgment on browser vendors concerning their desire to drop support for an open standard which underpins parts of the Internet. If it were up to me, we would have a wildly flexible plugin system which lets us use XSLT, RSS, Gemini, Gopher and dozens of other protocols/formats without the approval of browser developers—but alas, that's not the world we live in, today.

Neither am I here to exalt the benefits of preserving XSLT. Others have already done so elsewhere already. I myself have done so already, when I talked about how my Atom feed is themed with XSLT to look just like the rest of my site, or when I was considering templating engines to use for said site. Being able to style XML (and JSON!) data so that a piece of machine-readable data can also be displayed as a human-readable page has huge implications beyond just personal sites and Atom/RSS feeds—APIs could use that kind of interface to present a useful developer interface, technical listings could use that to provide pages you can browse with a browser or directly input into a program, and even rich web applications could be able to use the templating afforded by XSLT as a cheaper no-JS fallback option.

Instead, I am here to make a small observation, followed by an announcement:

Currently, there is no good, open-source, easily-embeddable library for XSLT 3.0.
So, I'll be working on bringing one about.

A paper airplane, because I needed a good title image, and saying that I'll be contributing to an open-source library feels a lot like sending an airplane flying out into the void

The current state of affairs (as far as I can see)

There are, granted, a few open-source libraries for XSLT, but none of them quite hit the spot, from what I can find:

Also, as far as I can see, there isn't much open-source tooling available for XSLT: ideally, we would have things like validators, typecheckers, command-line runners, language servers, and so on, so that we would be able to make XSLT part of build systems and pipelines.

I think that these two taken together are the reason for the lack of enthusiasm from browsers and developers for XSLT. Even if the idea of an XML- and JSON- capable templating language is amazing (and you can just look at the myriad of HTML templating languages, from Handlebars to Pug to JSX, to see how popular such ideas can be), without readily-available software implementations, it's hard to excuse the investment that supporting a specification of over half a million words total would entails (so like.. about as much as Tolkien's the Hobbit and Lord of the Rings stacked together, but made out of dense technical specifications).

That's why, rather than making the world better by using and explaining XSLT, I would rather make it better by.. contributing to an XSLT library: Xee.

Why Xee?

Why do I want to contribute to xee in particular?

Well, first off, xee is written in Rust, and I like Rust. Also, it being written in Rust mean it can be used by all programming languages that compile to native code. This in turn means that xee could even be useful for processing XML in embedded and performance-sensitive scenarios, one day. Also, due to the memory safety afforded by safe Rust, it's very likely that future browser engines like Servo will also be written in Rust.

Second off, the author of xee, Martijn Faassen, already put in the hard work of implementing the majority of XPath 3.1 (a specification XSLT 3.0 steps on) and researching and architecting the core parts of the XSLT frontend. That alone makes xee far ahead compared to some of the other XSLT libraries I've seen.

Thirdly, when I was looking for an XSLT templating engine for my website, I stumbled across the xee, and even back then, I found it very promising, and wished it was complete. If I could find it when I needed it, future users would be able to find it too. And if seeing it complete is something that I wished for, this is now an opportunity to make a wish come true.

And finally, the article announcing xee includes a call for volunteers that would implement XSLT. Rather than going off on my own (which, by the popular aphorism is a way to go somewhere fast, not to go somewhere far), I would love to work as part of a small community or team, and watch something slowly grow into more than it ever was. Now that I've decided I want to contribute to XSLT libraries, answering an existing call for contributors seems simpler than forcing myself on a different project which has not posted such a call.
(Not to mention the privilege of conversing with such a super-nerd as Martijn with his awesome work with succinct data structures! )

What will I be working on?

At first, my goal would be getting Xee up to... let's say, 50% conformance on the official XSLT test suite.

I already started making my way there with a few initial PRs clearing away a few things I spotted in the test runner.
Next up, I'll be tackling a few smaller, self-contained parts of the spec which are not yet implemented, as I slowly get more comfortable with the existing codebase—things like individual control structures, named templates, and the like.
Afterwards, I'll be taking the time to look at edge-cases that are not handled correctly yet, going by the failing test cases.
And finally, I would start taking up the large parts of the XSLT specification that are not implemented—things like shadow attributes, static variables, any missing typechecking, and so on.

My vision for Xee

If I find the time and energy to invest into Xee and the ecosystem that might form around it, I would love to turn it into a fully-featured open-source toolkit for processing XML files with XSLT and XPath. That would include a library that can be included into other projects, a command-line tool, perhaps even a WASM-backed compiler, and miscellaneous tools for authoring XSLT content.

To be more particular, here are my far-fetched dreams for Rust-based XSLT processing, at the moment:

Any one of those would be a major milestone, if it's even attainable. Seeing any of them complete would make me quite happy, I believe.
Yet, happiness is fleeting, and code related to XML seems effectively eternal, so here's to building out the future! 😂

How can you help?

Does any of that resonate with you? I'd be great to work together!

If you want to also contribute code and work to Xee, the more people joining in, the merrier. As I'm merely a wannabe contributor at this point, I would recommend directly getting in touch with Martijn, or perhaps jumping in on the issues list on GitHub.

If you want to sponsor any of that work, I'm not aware of anything being organized at the moment. I personally would be able to sink more time into this FOSS work if I had a sponsor, but at this stage, making sure the maintainer, Martijn, is doing less of a thankless job would be better for the project's long-term future, in my humble opinion.

And well, if you just want to cheer from the sidelines, that's awesome too. Every tiny bit of appreciation goes far! 😎 😊


(P.S. Something curious I noticed while looking at XSLT so far. The XSLT test system is actually implemented in XSLT/XPath itself! Here's the source code - it is a bit complicated, due to the heavy use of pattern matching, but it's a neat way to show off how powerful the language is!)

Articles tagged technology (14/14) →|

Articles tagged 100DaysToOffload (23/23) →|

Articles on this blog (30/30) →|

Comments?