*** Welcome to piglix ***

Tritium (programming language)

Tritium
Designed by Hampton Catlin
Filename extensions .ts
Website tritium.io
Influenced by
XSLT, Sass (stylesheet language)

Tritium is a simple scripting language for efficiently transforming structured data like HTML, XML, and JSON. It is similar in purpose to XSLT but has a syntax influenced by JQuery, Sass, and CSS versus XSLT’s XML based syntax.

Tritium was designed by Hampton Catlin, the creator of popular languages Sass and Haml and is currently bundled with the Moovweb mobile platform.

Open Tritium is the open source implementation of the Tritium language. It was presented at O'Reilly Open Source Convention 2014 and the compiler is implemented in Go (programming language).

Tritium takes as input HTML, XML, or JSON documents and outputs HTML, XML, or JSON data that has been transformed according to the rules defined in the Tritium script. Like JQuery, idiomatic Tritium code is structured around selecting a collection of elements via a CSS or XPath selector and then chaining a series of operations on them.

For example, the following script will select all the HTML table elements with id of foo and change their width attributes to 100%.

While Tritium supports both CSS or XPath selectors via the $() and $$() functions, the preferred usage is XPath. For example, the above code rewritten to use the equivalent XPath selector would be:

Both Tritium and XSLT are designed for transforming data. However Tritium differs in key ways to make it more familiar and easier to use for web developers:


...
Wikipedia

...