Altova Mailing List Archives


Re: trying to get xslt to work with xml and xsd

From: Mark Johnson <102334.12@----------.--->
To: NULL
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?

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.