|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] XHTML namespace and doc() functionJason Hunter jhunter at xquery.comWed Jul 7 15:15:02 PDT 2004
> 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! 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
|

Cart








