Re: Namespace name of source document

Subject: Re: Namespace name of source document
From: James Clark <jjc@xxxxxxxxxx>
Date: Fri, 16 Jul 1999 19:44:03 +0700
What you are seeing is the intended behaviour.  XPath does not apply the
default namespace to unprefixed names in patterns (see Section 2.1.2 in
the XPath WD).  It used to do this a few drafts ago, but this prevented
using the default namespace for literal result elements when the source
document didn't use namespaces.  The eventual solution will be to allow
the stylesheet to specify a default namespace to be used for unprefixed
element names in patterns.

Peter Stark wrote:
> 
> I am translating XHTML documents into other XHTML documents. The default
> namespace is "http://www.w3.org/TR/xhtml1"; in both the source document and
> the stylesheet.
> 
> First, I have the following XHTML source document..
> 
> <html xmlns="http://www.w3.org/TR/xhtml1";>
>         <head>
>                 <title>Hello</title>
>         </head>
> </html>
> 
> ..and use the following XTLS stylesheet...
> 
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0";
>                 xmlns="http://www.w3.org/TR/xhtml1";
>                 indent-result="yes" >
> <xsl:template match="html" >
> <html>
> <head>
>         <title>
>                 <xsl:value-of select="head/title" />
>         </title>
> </head>
> </html>
> </xsl:template>
> </xsl:stylesheet>
> 
> ..the resulting document will surprisingly be..
> 
>                 Hello
> 
> Why? Where are my html elements? Why does not "html" match "html" ?
> 
> If I instead use the following stylesheet..
> 
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0";
>                 xmlns="http://www.w3.org/TR/xhtml1";
>                     xmlns:h="http://www.w3.org/TR/xhtml1";
>                 indent-result="yes" >
> <xsl:template match="h:html" >
> <html>
> <head>
>         <title>
>                 <xsl:value-of select="h:head/h:title" />
>         </title>
> </head>
> </html>
> </xsl:template>
> </xsl:stylesheet>
> 
> ..the resulting document will be the expected...
> 
> <html xmlns:h="http://www.w3.org/TR/xhtml1";
> xmlns="http://www.w3.org/TR/xhtml1";>
> <head>
> <title>Hello</title>
> </head>
> </html>
> 
> Now it works. But I don't need the "h" namespace.
> 
> What is going on? Why must I use the "h" namespace to get this right?
> 
> I am using XT and have not tried any other translators.
> 
> Peter Stark
> 
> Phone.com
> +1(650)817-1618
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread