Altova Mailing List Archives
>microsoft.public.xml Archive Home
>Thread Prev - Re: trying to get xslt to work with xml and xsd
>Thread Next - Re: trying to get xslt to work with xml and xsd
Re: trying to get xslt to work with xml and xsd
Date: 8/27/2003 7:26:00 PM
Oleg Tkachenko <oleg@N...> wrote: >default namespace is not hidden from XPath, instead XPath 1.0 enforce one to >use some prefix to address nodes in a namespace. But if the default doesn't have a prefix, and XPath requires a prefix . . . then how can XPath find those XML elements that have no prefix if a default ns is declared? >> I just tested that out. And some templates didn't get matched when a >> default ns was used in the root xml element, and the same uri in the >> xsl:stylesheet element. Suddenly, those templates weren't being >> triggered. But they could be revived by explictly using prefixes. >Have you used prefix in XPath expressions? In XPath 1.0 nonprefixed name means >node in no namespace. Null ns. But not if you declare a default ns. Or, if you declare a ns with a prefix, and then use the prefix in the XML on elements, XPath can then locate those elements. >> The solution seems a) don't use >> default and have the elements use the null ns, or b) use specific ns >> prefixes where needed. >c) find out how it works actuially :) I just ran the XSLT. If you use a default ns, the elements are 'hidden' from XPath. There's no prefix for a default ns. But it appears that XPath assumes a QName with no prefix refers only to the NULL ns. So there's no way for XPath to find a node in a default ns. I just MUST be misunderstanding all this. Exactly how would you write a match attribute test/value so that if the XML element is part of a default ns, not a NULL ns, then that template would be triggered?