[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

XHTML namespace and doc() function

Jason Hunter jhunter at xquery.com
Wed Jul 7 15:15:02 PDT 2004


doc function
> 	default element namespace = "http://www.w3.org/1999/xhtml"
> 
> 	<html>
> 	 <head><title>Test</title></head>
> 	 <body>
> 	 { doc("DPM0029.xml")//body//p }
> 	 </body>
> 	</html>
> 
> and discovered the problem that the doc() function here returns null

Are you sure the doc() function is returning the empty sequence? 
(There's actually no nulls in XQuery, just empty sequences).  You can 
check what doc's doing with count(doc("DPM0029.xml")) and see if it 
returns 1.

I bet doc() is returning the doc but it's the //body//p that's returning 
empty due to namespace mismatches on those path steps.  The fix is to 
declare the namespace e = "" and use //e:body to look for a body in no 
namespace.

BTW, a quick test you can use if you're having namespace problems is to 
try //*:body//*:p which matches any namespace.  That's probably slower 
in production on indexed engines, but good for a quick test.

-jh-



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
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-2011 All Rights Reserved.