When comparing EJS vs XSLT in-browser implementation, the Slant community recommends EJS for most people. In the question“What are the best JavaScript templating engines?” EJS is ranked 6th while XSLT in-browser implementation is ranked 31st. The most important reason people chose EJS is:
EJS uses all the JS jargon and logic, so if you're proficient in JS, you can use EJS right away.
Ranked in these QuestionsQuestion Ranking
Pros
Pro Complete JavaScript logic
EJS uses all the JS jargon and logic, so if you're proficient in JS, you can use EJS right away.
Pro Same language before and after rendering
Your html/text remains pretty much the same before and after rendering. EJS filters out and performs its functions on any occurrences of its own <%= %>
tags in your template.
Pro Lightning-fast to learn
EJS introduces fairly small amount of new syntax that one has to learn to become fully proficient. The syntax itself is easy to comprehend for anyone who is even somewhat familiar with JavaScript and CSS.
Pro Consistently scores rather well in benchmarks
According to some benchmark tests, EJS is way faster than Jade or Haml.
Pro Powerful error handling
EJS has a really smart error handling mechanism built right into it. It points out to you, the line numbers on which an error has occurred, so that you don't end up looking through the whole template file wasting your time in searching for bugs.
Pro Permits pipelining
I.e. apply one template on top of another.
Pro AOP model
With ability to split feature implementation apart from main codebase, development became quite more manageable. Example: for data of particular type you could define own rendering or render refine rules; pipelining allows incrementally change UI by adding/removing elements depend of parameters, data values, previously rendered content.
Pro Native multithreaded implementation
Only template engine which utilizes multithreading.
Pro Native pre-compilation available
In some browsers(IE) XSLT during load is compiled into DLL. In others pre-loaded template allows to skip recurring parsing .
Pro Accept native data out of JS heap
XML when stored, saved outside of JS heap, capable to work with amount of data 100x larger of JSON.
Pro Native implementation
Supported in all browsers, starting from IE5.
Pro Server side rendering
XSLT is available as in browser as on server side via various libs including highly optimized for CPU.
Cons
Con No support for block by default
EJS has no support for the block
functionality which allows you to reuse pieces of templates across different files. Although it can be added to EJS through a third-party library.
Con Cryptic syntax
Much more difficult to read, especially for designer/HTML people who don't write JavaScript.
Con Lack of SDLC for in-browser development
It will take time to collect complete gentleman set: debugging, modular development, documenting, unit tests, etc. Please share if know the book on subject.
Con Verbose syntax
Takes time to get used to.
Con AOP model
Is complex to comprehend, justifiable on complex projects.