[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: simple XPath question
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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|