Skip to content

h1alexbel/sxl

Repository files navigation

SXL - Simpler XML Transformation Language

Motivation. XSLT is a functional language for XML transformations. It is widely used in web development, ETL pipelines, and even in language design (EO-to-Java compiler is written in XSLT). However, the complexity of the language is often a barrier for programmers not familiar with XML. That's why we created a new language, with the same semantic as XSLT 3.0, but with a simpler syntax, and user-friendly tooling.

Quick Start

Consider this XML:

<books>
  <book author="Elliotte Rusty Harold">XML in a Nutshell</book>
  <book author="Steve McConnell">Code Complete</book>
</books>

In SXL, we might transform it like this:

match -> "/books"
  shelf
    apply-templates -> "book"

template -> "book"
  entry
    text()
    " by "
    @author

You should have this XML in the result:

<shelf>
  <entry>XML in a Nutshell by Elliotte Rusty Harold</entry>
  <entry>Code Complete by Steve McConnell</entry>
</shelf>

BTW, this is how XSLT stylesheet will look like to achieve the same:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0">
  <xsl:output method="xml"/>
  <xsl:template match="/books">
    <shelf>
      <xsl:apply-templates select="book"/>
    </shelf>
  </xsl:template>
  <xsl:template match="book">
    <entry>
      <xsl:value-of select="text()"/>
      <xsl:text> by </xsl:text>
      <xsl:value-of select="@author"/>
    </entry>
  </xsl:template>
</xsl:stylesheet>

About

XML transformation language, similar to XSLT, but simpler

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published