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.

One Response to “A handy XSLT tip”

  1. Jennifer Grucza Says:

    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?