Subject: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.
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>