RE: [xsl] Namespace declarations in XML

Subject: RE: [xsl] Namespace declarations in XML
From: "Andrew Welch" <ajwelch@xxxxxxxxxxxxxxx>
Date: Wed, 16 Mar 2005 13:28:04 -0000
> I have a client passing me a feed with a top-level element
> that looks like this:
> <ArrayOfProductType
> xmlns:xsd="";
> xmlns:xsi="";
> xmlns="";>
> Now, am I mistaken in thinking that namespace declarations
> are inappropriate in an XML feed? And if I am mistaken, how
> do I work with that? I even duplicated these namespace
> declarations in my xsl and then pointed them to resolve to
> the xsl namespace, but I am still getting nothing to output.

All elements in the above feed are in the ''
namespace, so in order to match them you will have to declare that
namespace in your stylesheet, give it a prefix and then match elements
with that prefix:

<xsl:stylesheet xmlns:foo=""; ......

And then:

<xsl:template match="foo:whatever">.....

Read here for more 'Matching nodes in the default namespace' info:


Current Thread