[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] xml:base URI ignored by document()


Subject: [xsl] xml:base URI ignored by document()
From: Lars Huttar <lars_huttar@xxxxxxx>
Date: Mon, 26 Jul 2010 20:52:52 -0500

Hello,

I have an XSLT 2.0 stylesheet that is using a document() call, whose
first argument is a relative URI:
                            select="document( $document-uri, if
(string-length($base-uri) > 0) then $base-uri-node else / )" />

I'm passing a second argument there to set the base URI for
$document-uri to be resolved against.
$base-uri is a parameter
    <xsl:param name="base-uri" select="/.." />
with a value of "file:c:/.../metamodel/data/validation/"

According to the XSLT 2.0 spec, "The second argument [to document()], if
present, is a node whose base URI is used to resolve any relative URI
references contained in the first argument."
So I construct a node whose base URI is set to the parameter $base-uri:
        <xsl:variable name="base-uri-node">
            <dummy xml:base="{$base-uri}" />
        </xsl:variable>

Is that correct, as a way to create a node whose base URI is a desired
value?
When I look at the value of this variable in a debugger, it's an XML
fragment. But I don't know how else to do this. Is there a better way?

When I actually do the document() call as shown above, it gives a "file
not found" warning:
SystemID: C:\...\test\process\iso_dsdl_include.xsl
Severity: warning
Description: java.io.FileNotFoundException:
C:\...\test\process\metamodel-bnf-fnf-rnf-cnf.sch (The system cannot
find the file specified)
Start location: 453:0
URL: http://www.w3.org/TR/2005/WD-xpath-functions-20050211/#ERRFODC0005

In particular, it's looking for the file relative to the base URI of the
XSLT stylesheet, instead of relative to the base URI of the node I
passed as the second argument.

Any suggestions are appreciated...

Lars


Current Thread
Keywords