[xsl] default namespace on input document

Subject: [xsl] default namespace on input document
From: "Merrilees, David" <David.Merrilees@xxxxxxxxxxxx>
Date: Tue, 15 Feb 2011 14:32:49 +0000
Hi

I'm having trouble matching a template in XSLT2. When I add a default
namespace to my input document, my templates no longer match any elements.

Input:


<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml";>
       <head>
              <title>Text Chybljmcm for key: Welcome in cs-CZ</title>
              <meta charset="utf-8" />
       </head>
       <body id="home">
              <div id="footer">
                     <p>
                           (c) Tesco.com 2011
                     </p>
              </div>
       </body>
</html>

XSL:

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

       <xsl:template match="/">
              <xsl:apply-templates select="." />
       </xsl:template>

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

       <xsl:template match="body">
              <!-- never matched -->
              hi
              <xsl:sequence select="."/>
       </xsl:template>

</xsl:stylesheet>

This is probably a trivial issue, but I'm new to XSL 2.

Thanks

David Merrilees

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