Subject: RE: [xsl] rogue xmlns="" in output xhtml From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Sat, 15 Oct 2005 20:17:15 +0100 |
> 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/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] rogue xmlns="" in output , Paul Spence | Thread | [xsl] Complicated transformation st, knocte |
RE: [xsl] rogue xmlns="" in output , Paul Spence | Date | [xsl] JAXP - Ignoring whitespaces f, Blue Gecko |
Month |