A handy XSLT tip
XSLT gives me quite a headache. Learning any new language can be frustrating at first, but XSLT seems to be lacking in good documentation, which makes it orders of magnitude worse.
The other day, I was trying to pass some HTML in a parameter to an XSLT template. In my template, I was using <xsl:value-of select="$htmlParam"/> to access this HTML. What I couldn’t understand was that all the HTML was getting stripped out, leaving only the text.
Thanks to Tom at work, I now know that I needed to use xsl:copy-of instead of xsl:value-of.
It seems to make sense now, but I would have never figured it out on my own. I wonder how many other people get tripped up on this.
October 25th, 2004 at 4:58 am
On the other hand (of the one that agrees that there is not enough XSLT info out there), when you get to grips with XSLT, the power behind it starts to become apparent.
In the future I see XSLT as being a massive part of templating websites. When websites are built using well-formed XML in the mode of XHTML, we will be able to use XSLT to translate one XHTML document into another one, effectively re-templating it.
Needless to say, I like XSLT, even if I haven’t fully gotten to grips with it yet!
P.S. Any idea what happened to Hassan?
October 25th, 2004 at 6:31 pm
Hi Phil, I have no idea. I’ve been wondering what became of him, too. The last time I was able to access his website was a long time ago. Maybe he just got bored with the whole blogging thing?