HACKER Q&A
📣 forgotmypw17

Do you remember a post about xpath-based HTML templating engine?


Could someone please help me find a post which I think I remember seeing here recently?

It was about a templating engine for HTML which used xpath to fill in certain parts of already existing HTML templates.

The cool thing about it was that the HTML was already "presentable" before the filling in took place.


  👤 benibela Accepted Answer ✓
XSLT/XQuery is like that

With XSLT you put the XPath on the outside and update the elements choosen by the XPath. With XQuery you put the XPath in the HTML (actually XML) and it inserts something.

I build my webpage with my own XQuery processor: https://github.com/benibela/site/blob/master/style.xq.html

The HTML code looks very presentable at first. Although it is not, since the browser dies at . Perhaps it was labeled as xhtml...


👤 webmaven
> Could someone please help me find a post which I think I remember seeing here recently?

> It was about a templating engine for HTML which used xpath to fill in certain parts of already existing HTML templates.

> The cool thing about it was that the HTML was already "presentable" before the filling in took place.

Not xpath based, but Template Attribute Language in its various implementations has that quality, plus the advantage that templates are valid HTML/XML even before rendering:

https://en.m.wikipedia.org/wiki/Template_Attribute_Language

This means that not only are templates "presentable" prior to rendering, they are round-tripable between developers' and designers' tools, facilitating collaboration.