Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I need to agree. Using XSLT to write a XML -> HTML website is not a good idea - at least when a bunch of developers maintain it over time.

From the ground up, I admit I like XSLT. But: maintaining large sites that inherit templates (call-templates and apply-templates) and style through <xsl:include/> and <xsl:import/> over lots of files tends to become a template mess. After a while only the experienced devs are able to maintain the templates.

Then, it's a functional language, where lots of things are overly complicated to do; you can do just everything, but that doesn't mean you should.



Why is it a bad idea?

I work together with a bunch of developers on a website that renders its HTML output with XSLT. What you address is architecture.

What we basically did is we have one XSL file for each "element". Elements are: button, image, headline, etc. Each of those elements inputs "our own" XML syntax with wisely chosen defaults (some HTML attributes like class,id,style get just passed through) and outputs Twitter Bootstrap HTML. Writing responsive websites in our framework is extremely easy. So each element has a XSL file where the magic happens, an XML file with documentation and tests and additional files like scass/css/js files with the same name. Accessing them is extremely easy when you use something like Sublime Text (what we all do).

All those different templates get written into just one XSL file automatically with the help of node.js' gulp.

The website gets delivered in Apache Cocoon which has a pipeline concept similar to gulp. Once a page got rendered, it is cached until the next update (except for pages with dynamic content of course).

The whole frameworks documentation is basically a website written in this framework with automated tests.

We use XSLT 1.0 + EXSLT and have written around 30 (EXSLT) functions to make sure everything works like we expect.

Everybody in our team loves it.


Probably true; the architecture we had in the team was nonexistant, so it turned into a mess... XSLT then has nothing to improve upon.

If you start out "right", you probably will be able to enjoy XSL.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: