Subject: RE: [xsl] Default namespace problem From: "Khorasani, Houman" <houman_khorasani@xxxxxxxxxxxxxx> Date: Thu, 1 Sep 2005 16:22:12 +0100 |
You mean the second one is in no space, not the first one, correct? I mean this is a default namespace, right? <OrderRequest xmlns="http://www.csgsystems.com/bta"> And this one with prefix is specified namespace: <OrderRequest xmlns:bt="http://www.csgsystems.com/bta"> But I got your point. I have found this site: http://www.topxml.com/people/bosley/defaultns.asp This is exactly my problem, and as the author mentions: "thinking that leaving off the prefix from the foo element name, that it will match <foo> elements in the default namespace with the URI of urn:myuri. Instead, they are required to assign a non-null prefix name to their namespace URI and then match on "someprefix:foo" instead, which has proven to be far from obvious. XSLT 2.0 SHOULD provide an explicit way to handle this scenario to avoid further user confusion." I had thought exactly in the same way that using a default namespace in the XML file doesn't require any prefix in the XSLT's match. But it does! So namespaces link an XML and XSLT file thru the URI, not the prefix. But these seems to be confusing to many programmers, and that's why it should have been changed in XSLT 2.0. I still use XSLT 1.0 though. Regards, Houman -----Original Message----- From: Jacoby, Peter R. [mailto:PJACOBY@xxxxxxxxxxxx] Sent: 31 August 2005 21:07 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: [xsl] Default namespace problem > XML: > <OrderRequest xmlns:bt="http://www.csgsystems.com/bta"> > > Works fine!! > > But if XML has a default namespace instead: > > XML: > <OrderRequest xmlns="http://www.csgsystems.com/bta"> > Those two OrderRequest elements are *very* different. The first is in no namespace (or the same as its parent), the second is explicitly in the {ttp://www.csgsystems.com/bta} namespace. If your XSLT matches OrderRequest in no namespace (which it probably does if the first XML works) then when you try to run it against the second version it will not match. In order to match you would have to change your XSLT to match="bt:OrderRequest" where bt has been bound to the correct URI (which it has from the excerpt you originally posted). Hope this helps. -Peter
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] excluding descendants (an, Woods, Christopher | Thread | Re: [xsl] Default namespace problem, David Carlisle |
RE: [xsl] excluding descendants (an, Woods, Christopher | Date | Re: [xsl] Default namespace problem, David Carlisle |
Month |