I'm trying to delelop a stylesheet to add some tags to the top and bottom of HTML head and body nodes. So, I've started off with a stylesheet that looks like
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <xsl:apply-templates select="html"/> </xsl:template> <xsl:template match="html"> <xsl:comment> <xsl:value-of select="' Entered html template '"/> </xsl:comment> </xsl:template> </xsl:stylesheet>
which I apply to a random bit of HTML via
xsltproc sample.xslt sample.html . The problem is that I don't get any output. I've flooded my code with various
<xsl:comment> elements and as far as I can tell, my template for handling the root element is being entered, and that element has an html element as a child, yet when I
<xsl:apply-templates select="html"/> , my
<xsl:template match="html"/> desn't get executed. I am really confused.
I clearly have a blind spot - I've typed in the Hello, World example from chapter 2 of the O'Reilly XSLT book, and that behaves the same way as my own attempts - i.e. it doesn't work.
Of course, it could be that xsltproc doesn't work properly - I'm on Ubuntu 8.04 LTS - but a quick search on Google doesn't reveal dozens of other people saying the same sort of thing, so I think it's more likely that I'm being daft - again.
I'd _really_ appreciate a nudge in the right direction - ideally a gentle nudge :-)