[
Lists Home |
Date Index |
Thread Index
]
- From: Aaron Skonnard <aarons@develop.com>
- To: Richard Lanyon <rgl@decisionsoft.com>, Xml-Dev <xml-dev@lists.xml.org>
- Date: Wed, 25 Oct 2000 11:43:03 -0500
You need to establish a namespace binding in the XPath context for the
default namespace in the source document. For example, if you establish that
the prefix 'f' is mapped to the default namespace (e.g., 'uri-foo'), you
would write the location path as follows /f:foo/f:bar/f:baz.
How you establish the namespace bindings depends on the implementation that
you're working with. For example, MSXML (sept. release) provides the
setProperty method for doing this as follows:
doc.setProperty "SelectionNamespaces", "xmlns:f='uri-foo'"
If you're working in an XSLT document, you do this by simply supplying the
appropriate namespace declarations in the document itself:
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:f="uri-foo" version="1.0">
<xsl:template match="f:foo">
...
</xsl:transform>
All XPath implementations *should* provide a way to establish the context of
namespace bindings.
-aaron
> -----Original Message-----
> From: Richard Lanyon [mailto:rgl@decisionsoft.com]
> Sent: Tuesday, October 24, 2000 5:18 AM
> To: xml-dev@lists.xml.org
> Subject: simple XPath question
>
>
>
> I'm probably just being stupid here, but how do I refer to the default
> namespace within an XPath expression? I know that if I have a
> namespace declared with xmlns:foo="..." I can query its value with
> namespace::foo
> but it looks like a namespace declared with xmlns="..." is queried
> with
> namespace::
> which looks a bit odd for starters, and gives the impression of being
> a syntax error.
>
> --
> Richard Lanyon (Software Engineer) | "The medium is the message"
> XML Script development, | - Marshall McLuhan
> DecisionSoft Ltd. |
>
|