Is this technology still popular?
I want to make a website which automatically transforms XSLT files. It should work like this: When a user accesses the site, a single handler would accept his request and then find a suitable XML for it (according to the URL requested) and transform it using its attached XSL file.
I want to do this in order to make it easy to update the site using plain XML files (instead of using a full-fledged & expensive CMS system).
What do you say? good idea? bad idea? anyone has a recommendation?
Thanks!
Back in 2002-2003 I did a lot with XSLT (and some more in 2006-2007). Your mileage on this will vary but honestly I would avoid it, for several reasons:
The only place I can really see having an application for XSLT these days is in consuming Web services that produce XML (lots produce JSON and more easily consumed formats these days).
And even in that case I'd probably still manipulate the XML directly with, say, JAXB in Java (or similar technologies in other languages).
Update: I just came across The Death of XSLT in Web Frameworks. For example:
For example: how to hide the row in table (using different CSS style), based on some CONDITION, with XSLT? See:
<tr> <xsl:attribute name="style"> <xsl:choose> <xsl:when test="CONDITION"> <xsl:value-of select="'visibility: visible'"> </xsl:when> <xsl:otherwise> <xsl:value-of select="'visibility: collapse'"> </xsl:otherwise> </xsl:choose> </xsl:attribute> ... </tr>
and now the same with JSP 1.x:
<tr style='visibility:<%=CONDITION ? "collapse" : "visible"%>'> ... </tr>
or with JSP 2.x:
<tr style='visibility:${CONDITION ? "collapse" : "visible"}'> ... </tr>
summarized by:
So if you start new project, think twice (or ten times) before jumping into XSLT. And > if you use Eclipse, you can even think twice before using JSP/JSTL. Velocity or > FreeMarker might be a better option.
Answers based on "the syntax is hard" is no answer at all imho. A). It really isn't, and B). You're supposed to be a programmer, just learn it.
Definitely other technologies are advancing at a pace XSLT hasn't since 2005ish, but it remains a powerful tool which gives you a level of abstraction that, say, asp.net webforms don't, and allows you to provide a general scalable solution to trivially serialise to a range of output formats. It's easy to generate HTML with any given language, it's harder to now extend that to XML, now extend that to JSON, now extend that to CSV.
And cached transforms are plenty fast enough in an environment which is still I/O bound.
OTOH, storing data in XML is generally not a good idea. Far better to store in a DB/mem and serialise as required for all the reasons above.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With