• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jason-fox / com.here.validate.svrl / #75

pending completion
#75

push

jason-fox
Remove dependency.

735 of 961 relevant lines covered (76.48%)

25.78 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

63.64
/xsl/file-exists.xsl
1
<?xml version="1.0"?>
2
<!--
3
  This file is part of the DITA Validator project.
4
  See the accompanying LICENSE file for applicable licenses.
5
-->
6
<xsl:stylesheet
7
  exclude-result-prefixes="java xs"
8
  version="2.0"
9
  xmlns:java="http://www.java.com/"
10
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
11
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
12
>
13
        <!--
14
                Check whether a file exists with XSLT2 (a Java extension -powered function)
15

16
                This function was created by  Eero Helenius (http://stackoverflow.com/users/825783/eero-helenius) for Stack Exchange.
17
                Material on Stack Exchange is available under  the Creative Commons Attribution Share Alike license
18
                see: http://stackexchange.com/legal
19

20
                You are free to:
21

22
                Share — copy and redistribute the material in any medium or format
23
                Adapt — remix, transform, and build upon the material for any purpose, even commercially.
24

25
                https://gist.github.com/eerohele/4531924
26
                http://stackoverflow.com/questions/2917655/how-do-i-check-for-the-existence-of-an-external-file-with-xsl/14323873#14323873
27

28
        -->
29
        <xsl:function as="xs:boolean" name="java:file-exists" xmlns:file="java.io.File">
69✔
30
                <xsl:param as="xs:string" name="file"/>
69✔
31
                <xsl:param as="xs:string" name="base-uri"/>
69✔
32
                <xsl:choose>
69✔
33
                        <xsl:when test="starts-with($base-uri, 'file:C:')">
×
34
                                <xsl:variable name="base-uri-win" select="replace($base-uri, 'file:C:', '')"/>
×
35
                                <xsl:variable as="xs:anyURI" name="absolute-uri-win" select="resolve-uri($file, $base-uri-win)"/>
×
36
                                <xsl:sequence select="file:exists(file:new(concat('file:C:', $absolute-uri-win)))"/>
×
37
                        </xsl:when>
38
                        <xsl:otherwise>
69✔
39
                                <xsl:variable as="xs:anyURI" name="absolute-uri" select="resolve-uri($file, $base-uri)"/>
69✔
40
                                <xsl:sequence select="file:exists(file:new($absolute-uri))"/>
69✔
41
                        </xsl:otherwise>
42
                </xsl:choose>
43
        </xsl:function>
44
</xsl:stylesheet>
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc