[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: simple XPath question

  • From: Aaron Skonnard <aarons@d...>
  • To: Richard Lanyon <rgl@d...>, Xml-Dev <xml-dev@l...>
  • Date: Wed, 25 Oct 2000 11:43:03 -0500

simple xpath
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@d...]
> Sent: Tuesday, October 24, 2000 5:18 AM
> To: xml-dev@l...
> 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.                  |
>


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.