Project

Profile

Help

Bug #4280

closed

Failure in file:base-dir(): "URI has an authority component"

Added by Kevon Hayes over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Saxon extensions
Sprint/Milestone:
-
Start date:
2018-04-16
Due date:
2018-04-16
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
9.9, trunk
Fix Committed on Branch:
9.9, trunk
Fixed in Maintenance Release:
Platforms:

Description

There is an issue when calling:

var transformer = _xsltCompiler.Compile(new Uri(stylesheetPath)).Load();

These are the following lines I have that's dealing with the file system.

 <xsl:function name="pn:find-image-filepath">
        <xsl:param name="filename"/>

        <xsl:variable name="file-path"
                      select="file:list(file:parent(file:base-dir()), true(), concat($filename, '*'))[1]"/>

        <xsl:choose>
            <xsl:when test="$file-path">
                <xsl:value-of select="file:path-to-uri(concat(file:parent(file:base-dir()), $file-path)))"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:message terminate="no">Could not find image file "<xsl:value-of select="$filename"/>"
                </xsl:message>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:function>

Googling this issue states it's an issue when on Windows machines. When working with files I should prefix the file path with: file:/// with 3 slashes. When I look at the path (when processing this via the commandline and not .NET) the path is rendered as follows: "file:/C:/data/data/..." However, is there a way to tell omit or include he extra slashes without doing a string replace?


Files

UriFormat_001.png (20.1 KB) UriFormat_001.png Kevon Hayes, 2019-08-15 00:32
Line258SaxonPEXsltCompilerCodebase.png (29.7 KB) Line258SaxonPEXsltCompilerCodebase.png Kevon Hayes, 2019-08-16 21:36

Related issues

Follows Saxon - Bug #3745: file:path-to-uri() fails or works incorrectly with relative path and UNCClosedMichael Kay2018-04-14

Actions

Please register to edit this issue

Also available in: Atom PDF