Subject:Re: Accessing tags in the default namespace Author:Minollo I. Date:10 Jan 2004 11:10 AM
Are you talking about running XPath expression in the XML editor module or
from XSLT?
If it is in XML editor module, what you are hitting is a know limitation of
running XPath expressions in that context.
XPath expression in XML editor always assume the default XML namespace.
Your XML document might be overriding the default namespace in different
ways in multiple fragments of the documents; which one our module should
use is tricky to establish unless you use prefixes.
One workaround is to add a namespace declaration associated to the same URI
you are using to override the default namespace and then use it in the
query; for example, if you have:
{root xmlns="http://example.com" xmlns:help="http://example.com"}
{child1/}
{/root}
....you can run a /help:root/help:child1 XPath query without problems.
If instead you are talking about XPath expressions run in the XSLT context,
then you are seeing the specified behavior; according to the specs, XPath
expressions run in XSLT won't use default namespaces modified in the source
XML document; instead, you have to do something pretty similar to what I
mentioned above:
{xsl:template match="/" xmlns:help="http://example.com"}
{xsl:value-of select="/help:root/help:child1"/}
{/xsl:template}