MDN wants to learn about developers like you:

JavaScript templates

An alternative approach to XUL's own templating system is to use JavaScript templates.

This approach also provides a separation of formatting and structure from content, but relies on a JavaScript templating engine to have JavaScript-side business logic inject content into a template. And this does not require any use of RDF/XML, etc.

By syntax style

100% Standards-based (no custom syntax)

Pure JavaScript (JavaScript function calls generate HTML)

Note that such solutions can still allow for iteration to match other templating engines using succinct inline for-each constructs or the like by using Array iteration methods such as map or reduce.

Pure HTML (JavaScript selectors in business logic find normal HTML to populate)


  • XSLTJS (for cross-browser use of XSL for templates)


Standards-friendly (custom attributes or embedding syntax, but uses mostly standard-compatible approach)

X/HTML/E4X/XUL with Namespaced custom attributes and elements

Pure JavaScript embedded within HTML/XML design logic (ASP/JSP/PHP or curly braces style)

Custom approach

HTML+Curly braces {} with custom design logic

HTML + Non-namespaced custom elements or attributes

ASP/JSP-style custom design logic within <%...%>

By feature

Transforming an entire document into another through element/node matching templates


  • XSLTJS (for cross-browser use of XSL for templates)

Generating DOM tree via JavaScript

  • Monkberry with server precomiled templates, mustage-like syntax.

Document Tags and Contributors

 Last updated by: davidcana,