On Thu, 01 Feb 2007 11:10:05 -0800, James A. Robinson
<[EMAIL PROTECTED]> wrote:
The reason I ask is that I've got an XDBC app-server set up to serve
the Documents database for an MLS instance, and I've got a file I
loaded using the path
/a.xml
which has inside of it
<reference href="b.xml"/>
I find that calling
for $ref in doc('/a.xml')//reference
return
resolve-uri($ref/@href, base-uri($ref))
returns an error
XDMP-RELURIBASEARG: resolve-uri("b.xml", "/a.xml") -- Relative URI
base argument to resolve-uri
This surprises me, as I thought the entire point of base-uri was to
return the ... well, base, something that resolve-uri can consume.
I'm probably misunderstanding something about how this is supposed to
be used, but I had assumed fn:base-uri would return something 'fully
qualified' given that the context it was passed was froma file loaded
via doc.
fn:base-uri() just returns you the most immediate encoding value of
xml:base, or if there is none, the URI under which the document is stored.
There is no requirement that it be an absolute URI or that it somehow be
resolved to one if it isn't. It is intended to be something you can
use with resolve-uri, and it is certainly a bad idea to attempt to
use it a relative base to resolve other relative URIs; and the specs say
this is an error. (The algorithms in the RFC don't work in this case.)
MarkLogic Server preserves the invariant fn:base-uri( doc($x) ) = $x
so that if you have "/a.xml" or "a.xml" the URI doesn't get munged to
something else.
Should I be:
Using a different type of path when loading files?
That is probably the most straightforward.
Setting a base in the module prolog?
Reading some documentation I've managed to overlook? :(
Jim
There are various workarounds, such as making your own version of
resolve-uri that does some explicit string munging to get the results
you want in the case where your base is not absolute. If you look at the
documentation for the "Generic Conversion" module, you'll see there
are some functions (basepath and basename) that can be handy for
this purpose.
//Mary
Mary Holstege
Lead Engineer
Mark Logic Corporation
2000 Alameda de las Pulgas
Suite 100
San Mateo, California 94403
+1 650 655 2336 Phone
[EMAIL PROTECTED]
www.marklogic.com
This e-mail and any accompanying attachments are confidential. The
information is intended solely for the use of the individual to whom it
is addressed. Any review, disclosure, copying, distribution, or use of
this e-mail communication by others is strictly prohibited. If you are
not the intended recipient, please notify us immediately by returning
this message to the sender and delete all copies. Thank you for your
cooperation.
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general