xsl-list
[Top] [All Lists]

RE: Namespace declarations in XML

2005-03-16 09:28:36
Wow... That makes complete sense now... I still can't believe that I've never 
seen this before, but now I know how to handle it, so I guess there's always 
something new to learn!

Thank you so much for your response and this reference... Big help!

Cynthia

-----Original Message-----
From: Andrew Welch <ajwelch(_at_)piper-group(_dot_)com>
Sent: Mar 16, 2005 6:28 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Namespace declarations in XML



I have a client passing me a feed with a top-level element 
that looks like this:

<ArrayOfProductType 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns="http://catalog.9squared.com";>

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 'http://catalog.9squared.com'
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="http://catalog.9squared.com"; ......

And then:

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


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

http://www.dpawson.co.uk/xsl/sect2/N5536.html#d6408e1012

cheers
andrew

--~------------------------------------------------------------------
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>
--~--



--~------------------------------------------------------------------
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>
--~--



<Prev in Thread] Current Thread [Next in Thread>