home contribute faq download

FunctX XSLT Functions

functx:is-absolute-uri

Whether a URI is absolute

Google
Webxsltfunctions.com

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.

Arguments and Return Type

NameTypeDescription
$uri xs:string? the URI to test
return value xs:boolean

XSLT Function Declaration

See XQuery definition.
XSLT 2.0 Syntax:
<xsl:function name="functx:is-absolute-uri" as="xs:boolean" 
              xmlns:functx="http://www.functx.com" >
  <xsl:param name="uri" as="xs:string?"/> 
 
  <xsl:sequence select=" 
   matches($uri,'^[a-z]+:')
 "/>
   
</xsl:function>

Examples

XSLT ExampleResults
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

See Also

fn:resolve-uriResolves a relative URI to a base URI, returning an absolute URI
fn:base-uriThe base URI of a node
functx:scheme-from-uriReturns the scheme from a URI

History

Published OnLast UpdatedContributor(s)
2006-06-272007-02-26Priscilla Walmsley, Datypic, pwalmsley@datypic.com, http://www.datypic.com
Need XSLT Help?
D A T Y P I C
Training | Consulting | Development

XQuery by Priscilla WalmsleyGet the book!
XQuery by Priscilla Walmsley