[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] xml to xhtml namespace problem
Subject: Re: [xsl] xml to xhtml namespace problem From: Andrew Welch <andrew.j.welch@xxxxxxxxx> Date: Tue, 11 Jan 2011 10:48:39 +0000 |
> <h1 xmlns="">...</h1> > > How can I get rid of that empty namespace ?! When you have: <xsl:template match="/*"> <html xmlns="http://www.w3.org/1999/xhtml"> </html> </xsl:template> <xsl:template match="foo"> <h1> </h1> </xsl:template> It's tempting to think the <h1> in the 2nd template gets put in the xhtml namespace because it gets added beneath the <html> element in the result tree... however it needs to be put in the the xhtml in the stylesheet. You do this either by doing: <h1 xmlns="http://www.w3.org/1999/xhtml"> or by moving the default namespace change to a common ancestor of all the elements, usually the root element: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml"> If that doesn't make sense, try using a prefix - you will see that you need to need declare the prefix on a common ancestor. -- Andrew Welch http://andrewjwelch.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
AW: AW: [xsl] xml to xhtml namespac, Szabo, Patrick \(LNG | Thread | [xsl] can a function return an elem, Matthieu Ricaud-Duss |
AW: [xsl] xml to xhtml namespace pr, Szabo, Patrick \(LNG | Date | Re: AW: [xsl] xml to xhtml namespac, Martin Honnen |
Month |
Keywords