Description
The functx:scheme-from-uri function returns the scheme part of a URI, for example http or ftp, which appears before the colon. If there is no scheme (because it is a relative URI), a zero-length string is returned.
Arguments and Return Type| Name | Type | Description |
$uri |
xs:string? |
the URI |
| return value |
xs:string? |
XQuery Function Declaration| See XSLT definition. | | XQuery Syntax for July 2004 - January 2007 (1.0): |
|---|
declare namespace functx = "http://www.functx.com";
declare function functx:scheme-from-uri
( $uri as xs:string? ) as xs:string? {
substring-before($uri,':')
} ; | | XQuery Syntax for May 2003: |
|---|
declare namespace functx = "http://www.functx.com"
define function scheme-from-uri
( $uri as xs:string? ) as xs:string? {
fn:substring-before($uri,':')
} |
Examples| XQuery Example | Results |
|---|
functx:scheme-from-uri(
'http://www.datypic.com')
|
http
|
functx:scheme-from-uri(
'ftp://ftp.datypic.com')
|
ftp
|
functx:scheme-from-uri('ftp.datypic.com')
|
zero-length string |
functx:scheme-from-uri('www.datypic.com')
|
zero-length string |
functx:scheme-from-uri('prod.html')
|
zero-length string |
See AlsoHistory |
|