I'm
guessing it has to do with the fact that I added the XTHML
namespace to the
code thus:
<html xmlns="http://www.w3.org/1999/xhtml" >
Yes. If you do this:
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml" >
<xsl:call-template name="t2"/>
</html>
</xsl:template>
<xsl:template name="t2">
<body/>
</xsl:template>
then you are generating an element whose name is
{http://www.w3.org/1999/xhtml}html, with a child whose name is {}body.
(Using "{uri}local" to indicate an expanded name.) To represent a body
element that's in no namespace as a child of an html element in the
http://www.w3.org/1999/xhtml namespace, the system has to add a namespace
undeclaration xmlns="". Whereas if you generate both elements in the same
namespace, the child element won't need any extra namespace declarations.
Remember that you choose what namespace to put your elements in; the system
then reflects this choice by generating suitable namespace declarations. If
the element is generated as a literal result element, then its name in the
result tree (uri + local-part) is the same as the name of the literal result
element in the stylesheet.
The mistake is to imagine that a namespace declaration in the stylesheet
such as xmlns="http://www.w3.org/1999/xhtml" is copied to become a namespace
declaration in the result tree. That's not the way it works.
Michael Kay
http://www.saxonica.com/
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--