home contribute faq download

FunctX XSLT Functions

functx:scheme-from-uri

Returns the scheme from a URI

Google
Webdatypic.com

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

NameTypeDescription
$uri xs:string? the URI
return value xs:string

XSLT Function Declaration

See XQuery definition.
<xsl:function name="functx:scheme-from-uri" as="xs:string?"
              xmlns:functx="http://www.functx.com">
  <xsl:param name="uri" as="xs:string?"/>

  <xsl:sequence select="
   substring-before($uri,':')
 "/>

</xsl:function>

Examples

XPath ExampleResults
functx:scheme-from-uri(
   'https://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 Also

functx:is-absolute-uriWhether a URI is absolute
functx:fragment-from-uriReturns the fragment from a URI

History

Published OnLast UpdatedContributor(s)
2006-06-272007-02-26Priscilla Walmsley, Datypic, pwalmsley@datypic.com, https://www.datypic.com
Datypic XSLT Services

Recommended Reading:

XQuery