This is an XSLT FAQ: the default namespace does not apply to names in path expressions. You have to use an explicit prefix to match a namespaced name, for example /n:doc/n:foo
 
In XSLT 2.0 you can set the xpath-default-namespace attribute to provide a default namespace for names in path expressions.
 
Michael Kay
-----Original Message-----
From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of Gil Tayar
Sent: 09 December 2003 18:59
To: saxon-help@lists.sourceforge.net
Subject: [saxon] Specifying the default namespace for the template match

I have the following source document:
 
<n:doc xmlns:n="http://n">
    <n:foo>Some text</n:foo>
</n:doc>
 
Now, the spreadsheet:
 
<xsl:stylesheet xmlns:stylesheet="..." xmlns="http://n">
    <xsl:template match="/doc/foo">
        <xsl:message>Found!</xsl:message>
   </xsl:template>
</xsl:stylesheet>
 
I would have expected that the "Found!" message would have been outputted, but it didn't. The following did work:
 
<xsl:stylesheet xmlns:stylesheet="..." xmlns:n="http://n">
    <xsl:template match="/n:doc/n:foo">
        <xsl:message>Found!</xsl:message>
   </xsl:template>
</xsl:stylesheet>
 
Is there something wrong in my understanding, or is this a bug?
 
Gil Tayar
Chief Technology Officer
WebCollage
Business: +1 (212) 563 2643
Mobile:     +1 (917) 509 9663