About bem-xjst

What is bem-xjst?

bem-xjst is a template engine for web development using the BEM methodology.

It contains two engines:

  1. BEMHTML — for transforming BEMJSON to HTML.
  2. BEMTREE — for transforming BEMJSON with data to BEMJSON with a BEM tree for further transformation using BEMHTML.

The template engine is based on the declarative principles of XSLT (eXtensible Stylesheet Language Transformations). The name XJST (eXtensible JavaScript Transformations) was also created as an analogy to XSLT.

Before using the template engine, you should review:

  1. BEMJSON format for input data
  2. How to write templates
  3. Processes for selecting and applying templates


  1. Templates are extensible: they can be redefined or extended.
  2. Templates are written using pattern matching for the values and structure of input data.
  3. Traverses input data by default.
  4. Built-in rendering behavior is used by default, even if the user didn’t add templates.
  5. Written in JavaScript, so the entire JavaScript infrastructure is available for checking code quality and conforming to best practices.
  6. Doesn’t require compiling templates.
  7. API provided for adding templates in runtime.
  8. Runs on a server and client.

Read next: Quick Start

If you notice a mistake or want something to supplement the article, you can always write to us at GitHub, or correct an article using