Hi all,
My understanding is that if base-uri(.) is called when the context node is part of a raw XML file, then it should return the URI of the document containing the context node.

When using the collection() function, I am finding examples where base-uri(.) called when focus is on a node in one document evaluates to the URI of a different document in the collection.

Here is a test setup:

I have a folder with URI = $URI
THis folder has lots of raw XML files of the form:

To test the URIs, I process this with the following code. The first template is the initial template.

<xsl:template name="main">
<xsl:variable name="URI" select ="[foldername]" />
    </xsl:text><xsl:value-of select="base-uri(.)"/>
                                <xsl:apply-templates select="pedagogicalTrace/student"/>

    <xsl:template match="student">
        <xsl:value-of select="base-uri(.)"/>

When I run the above, the URIs printed out in the Main template appear correct, but the URIs printed out when base-uri(.) is applied to the student node inside the document are sometimes correct and sometimes wrong. Sometimes the evaluate to the URI of a different file in the collection.


"A false conclusion, once arrived at and widely accepted is not dislodged easily, and the less it is understood, the more tenaciously it is held." - Cantor's Law of Preservation of Ignorance.