[Home] [By Thread] [By Date] [Recent Entries]

  • From: "clark.evans@s..." <cce@c...>
  • To: xml-dev@l...
  • Date: Wed, 25 Oct 2000 15:12:33 -0400 (EDT)

Richard Lanyon wrote: 
> [H]ow do I refer to the default namespace within an XPath expression? 



      select="namespace::node()[local-name(.)='']" 




For example, if you are given: 

      <?xml version="1.0"?> 
      <test xmlns="hello" /> 

Processed by: 

      <?xml version="1.0"?> 
      <xsl:stylesheet xmlns:xsl=" http://www.w3.org/1999/XSL/Transform
<http://www.w3.org/1999/XSL/Transform> " 
                      xmlns:h="hello" version="1.0"> 
        <xsl:template match="h:test"> 
          <xsl:value-of select="namespace::node()[local-name(.)='']" /> 
        </xsl:template> 
      </xsl:stylesheet> 

The output produced should be: 

      <?xml version="1.0" encoding="UTF-16"?>hello 

Both SAXON and the Microsoft XSLT processor perform 
this operation wonderfully.  XT, and Oracle's 
processor report "namespace axis not implemented". 
Sabaloton and Xalan produce just the XML declaration 
and fail to show any error.  
  
Kind Regards, 

Clark Evans 



Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member