XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Budy AckermanSubject: How to query when a default namespace is specified
Author: Budy Ackerman
Date: 27 Jan 2006 08:19 PM
The query bar doesn't allow you to define a prefix for a default namespace so how do I implement a query when the source XML document has a default namespace.

Posttop
Minollo I.Subject: How to query when a default namespace is specified
Author: Minollo I.
Date: 27 Jan 2006 09:00 PM
Raw XPath doesn't let you define namespace prefixes; but you can do something like:

/*[local-name()='books' and namespace-uri()='myNSURI']/*[local-name()='book' and namespace-uri()='myNSURI']

If you click on the Tree view and right click on an item, you can ask Stylus Studio to compute the path to that element (Copy XPath query to clipboard).

Of course you could use XQuery...
declare namespace myns = "myNSURI";
for $book in /myns:books/myns:book
return $book
...or XSLT too:
<xsl:template match="/" xmlns:myns="myNSURI">
<xsl:for-each select="myns:books/myns:book">
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:template>

Minollo

 
Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

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