Namespace name of source document

Subject: Namespace name of source document
From: "Peter Stark" <stark@xxxxxxxxxxxxxx>
Date: Thu, 15 Jul 1999 12:43:13 -0700
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


Current Thread