It’s just data

Resurrecting Planet Mozilla

Reed Loden: For some reason, planet.m.o is not updating...

Apparently htmltmpl and NFS don’t get along.  Who knew?  Not wanting to get into the middle of that catfight, and knowing that Venus supports multiple templating languages, I offered to convert their template to XSLT.

Mostly what that means is that instead of constructs like this:

<TMPL_IF title>
<h4><a href="<TMPL_VAR link ESCAPE="HTML">"><TMPL_VAR title></a></h4>
</TMPL_IF>

You use constructs like this:

<xsl:if test='atom:title'>
<h4><a href='{atom:link[@rel="alternate"]/@href}'><xsl:value-of select='atom:title'/></a></h4>
</xsl:if>

Slightly more verbose, a lot more powerful, and runs a heck of a lot faster.

Knowing that I’ve had needs to do this before, and undoubtedly will need to do it again, I wrote a script based on HTML5lib and REXML which converts index.html.tmpl into index.html.xslt.

Could also come in as a handy migration aide to Mars.


Add your comment