[xquery-talk] XHTML namespace and doc() function

Michael Rys mrys at microsoft.com
Wed Jul 7 14:47:53 PDT 2004


The fn:doc() function does not (or at least should not :-)) use the
default element namespace to resolve relative URIs. It uses the base
URI.

So it looks like a bug in the XQuery engine that you are using.

Best regards
Michael

> -----Original Message-----
> From: talk-bounces at xquery.com [mailto:talk-bounces at xquery.com] On
Behalf
> Of David Sewell
> Sent: Wednesday, July 07, 2004 1:20 PM
> To: talk at xquery.com
> Subject: [xquery-talk] XHTML namespace and doc() function
> 
> I've just been wrestling with a problem that it turns out was
discussed
> last year on this list, in a brainteaser posted by Jason Hunter:
> 
>   http://xquery.com/pipermail/talk/2003-May/000009.html
> 
> The basic issue is that we want to generate valid XHTML with XQuery
code
> that makes use of doc() to retrieve things. So we started out trying
> something like this:
> 
> 	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
> because it is looking in the XHTML namespace instead of for a local
URI,
> as someone else pointed out in answer to the brainteaser.
> 
> Nobody suggested what the best workaround is, however. Of course we
> could omit the XHTML namespace reference and output a bare <html>
element,
> but let's say we want to be W3C-correct and include it. Are we always
> going to have to "shield" doc() calls by putting them in variables
> and/or functions external to the element constructors? Is there
another
> technique? (If not, do other navigation functions like id() have
similar
> issues?)
> 
> Thanks for helping a newbie,
> 
> David S.
> 
> --
> David Sewell, Editorial and Technical Manager
> Electronic Imprint, The University of Virginia Press
> PO Box 400318, Charlottesville, VA 22904-4318 USA
> Courier: 310 Old Ivy Way, Suite 302, Charlottesville VA 22903
> Email: dsewell at virginia.edu   Tel: +1 434 924 9973
> Web: http://www.ei.virginia.edu/
> _______________________________________________
> talk at xquery.com
> http://xquery.com/mailman/listinfo/talk



More information about the talk mailing list