Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#267 xsl:import doenst work with UNC-path

v7.9.1
closed
nobody
5
2012-10-08
2004-11-23
schnipp40
No

If access the stylesheet with UNC-path
(\host\path\style.xsl) an xsl:import doesnt work if the
href is relative (<xsl:import href="generic.xsl"/>).
Error:
java.io.FileNotFoundException: \host\path\generic.xsl
(Das System kann den angegebenen Pfad nicht finden)

Workaround:
in StandardURIResolver.java line 84-87
replace
url = (relativeURI.length()==0 ?
baseURL :
baseURL.resolve(relativeURI)
);
with
if ( baseURL.getScheme().compareTo("file")
== 0) {
String rawPath = baseURL.getRawPath();
File baseFile = new File(rawPath);
String parent = baseFile.getParent();
parent += File.separator;
parent += relativeURI;
File relativeFile = new File(parent);
url = new URI(relativeFile.toURI().toString()
);
} else {
url = (relativeURI.length()==0 ?
baseURL :
baseURL.resolve(relativeURI)
);
}

Discussion

  • Michael Kay
    Michael Kay
    2004-12-03

    Logged In: YES
    user_id=251681

    Firstly, this isn't the correct way to register a Saxon bug
    report. As the front page makes very clear, I try to keep
    this section of the site for confirmed bugs only. Please
    raise suspected bugs on the saxon-help list or forum.

    Secondly, I'm not going to touch this one. There's a lot of
    room for disagreement about the details of how URIs are
    resolved, especially when it comes to interpreting file
    names on different OSs - as the discussion on the Sun forum
    that you cited shows. As a matter of principle, I don't like
    coding around bugs in the Java platform, especially bugs
    that leave room for debate, and especially in cases where a
    circumvention is available at user level, by writing your
    own URIResolver. I've no way of testing, for example,
    whether the code you supply works on a Macintosh platform,
    let alone on stranger animals than that. I'll wait for Sun
    to fix it.

    But thanks anyway for telling me about it.

    Michael Kay