functx:is-absolute-uri

Whether a URI is absolute

Description

The functx:is-absolute-uri function returns true if URI is absolute, meaning that it starts with a scheme name such as http or ftp. It returns false if it is a relative URI.

Parameters

Description

uri:string()

the URI to test

Examples

XPath

Results

functx:is-absolute-uri('http://www.datypic.com')

true

functx:is-absolute-uri('ftp://ftp.datypic.com')

true

functx:is-absolute-uri('ftp.datypic.com')

false

functx:is-absolute-uri('www.datypic.com')

false

functx:is-absolute-uri('prod.html')

false

In a generator

Copy the snippet below and paste it in Freemapper, under a language node inside the generators element. Each line of the pattern prints the result of one example; to see them, run mi generate <project> <language> example-functx-is-absolute-uri.

[e] example-functx-is-absolute-uri
    [e] start
        [e] match
            [v] /
        [e] body
            [e] write-pattern
                [v] examples
    [e] patterns
        [e] examples
            [v] E01: {{ functx:is-absolute-uri('http://www.datypic.com') }}
            [v] E02: {{ functx:is-absolute-uri('ftp://ftp.datypic.com') }}
            [v] E03: {{ functx:is-absolute-uri('ftp.datypic.com') }}
            [v] E04: {{ functx:is-absolute-uri('www.datypic.com') }}
            [v] E05: {{ functx:is-absolute-uri('prod.html') }}

See Also