Re: [xsl] IE does not comprehend default namespace in XML

Subject: Re: [xsl] IE does not comprehend default namespace in XML
From: Michael Ludwig <mlu@xxxxxxxxxxxxx>
Date: Thu, 27 Aug 2009 09:26:01 +0200
denit thomas schrieb:

it does not render anyth= ing except the hardcoded text that I have in
the XSLT, when I have the xmln= s=3D"" attribute in the
root node of the xml. As soon as I r= emove this attibute, it works
fine and the xslt gets applied.

It is a namespace issue. The xmlns looks like an attribute (and it is), but namespace-aware XML parsers may not treat it like an attribute and will treat it as a namespace declaration.

Any XML namespace tutorial will teach you the basics. It's not too

So for developing/writing the xml, I need to keep the xmlns attribute
in the xml, while trying to render it using an xslt (defined in xml as
<?xml-stylesheet type="text/xsl" href="PIDRepresentation.xslt"?>), I
have to remove it from the xml.

No. Instead, add the namespace declaration to the XSL stylesheet.

<xsl:stylesheet version="1.0" xmlns:o="" ...

And then use match="o:some-name" and select="o:some/o:other/o:name".

Michael Ludwig

Current Thread