[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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
xsl source document namespace
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.