thanks for the immediate replies.
the "test" system id was hardcoded for testing purposes.  the idea is to set a URI that can be used to access the document directly using the doc function.
base-uri() does not seem to work even in the case where I use doc():

<xsl:value-of select="document-uri(doc('myScheme:documentName'))"/>
returns - myScheme:documentName, while
<xsl:value-of select="base-uri(doc('myScheme:documentName'))"/>
retuns nothing.

Michael Kay <> wrote:
I've still got a few problems with document-uri(), which are basically caused by problems in the spec. For example, your CollectionURIResolver returns "test" as the systemId of each document in the collection. Does that mean document-uri() should return "test"? If so, it doesn't satisfy the rule in the spec that doc(document-uri($d)) should return $d (unless your URIResolver takes care of this, of course).
I've raised bugs on the spec trying to get this sorted out. I think it's probably better if I make document-uri() return the systemId of such documents, regardless of the above rule, but I'd like to get the rules clarified. Meanwhile, you can use base-uri() which probably gives you what you want.
Michael Kay

From: [] On Behalf Of Steven Grossman
Sent: 22 June 2006 15:56
Subject: [saxon] fn:document-uri returns empty result when document isobtained by fn:collection()

I have implemented a CollectionURIResolver as follows (based on a message posted to this forum):
public SequenceIterator resolve(String href, String base,
                                    XPathContext context) throws XPathException {
        Document[] documents = ...;  // implementation specific
        StaticQueryContext queryContext =
                new StaticQueryContext(context.getConfiguration());
        List sequenceItems = new ArrayList(documents.length);
        for (int i = 0; i < documents.length; i++) {
            Source source = new DOMSource(documents[i]);
            DocumentInfo documentInfo =
        return new ListIterator(sequenceItems);
It succeeds in returning the appropriate documents but it fails to return anything when passed to document-uri().
My question is - should this work?  I would think I should be able to retrieve the document uri of a document returned from a collection.  Am I missing something? Is this a bug?

Yahoo! Groups gets better. Check out the new email design. Plus there’s much more to come.
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
saxon-help mailing list

Yahoo! Messenger with Voice. PC-to-Phone calls for ridiculously low rates.