[xsl] template never matches

Subject: [xsl] template never matches
From: "Merrilees, David" <David.Merrilees@xxxxxxxxxxxx>
Date: Tue, 22 Feb 2011 12:39:00 +0000
Hi

I'm having trouble matching a named element vs using node(). Code below. Any
bright ideas?

Example input:

<?xml version="1.0" encoding="utf-8"?>
<html>
  <head>
    <title>Vmtejte</title>
    <meta charset="utf-8"/>
  </head>
  <body id="home">
  </body>
</html>

XSL:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
        exclude-result-prefixes="xs xsl">

        <xsl:template match="/">
                <xsl:copy>
                        <xsl:apply-templates select="@* | node()"
mode="test"/>
                </xsl:copy>
        </xsl:template>

        <xsl:template match="node() | @*" mode="test">
                <!-- always matched -->
                <xsl:sequence select="." />
        </xsl:template>

        <xsl:template match="head" mode="test">
                               <!-- never matched -->
                <xsl:copy>
                        <xsl:apply-templates select="@* | node()" mode="test"
/>
                        <link rel="shortcut icon" href="/favicon.ico" />
                </xsl:copy>
        </xsl:template>

</xsl:stylesheet>

This is a confidential email. Tesco may monitor and record all emails. The
views expressed in this email are those of the sender and not Tesco.

Tesco Stores Limited
Company Number: 519500
Registered in England
Registered Office: Tesco House, Delamare Road, Cheshunt, Hertfordshire EN8
9SL
VAT Registration Number: GB 220 4302 31

Current Thread