Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

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)

XSL

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

E4X

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

XSL

  • 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,