URI (Uniform Resource Identifier) Processing

Jason Diamond

$Id: uri.html,v 1.5 2004/10/10 06:18:57 balls Exp $


Introduction

This module provides templates for processing URIs (Uniform Resource Identifers).

Table of Contents

uri:is-absolute-uri - Determines if a URI is absolute or relative.
uri:get-uri-scheme - Gets the scheme part of a URI.
uri:get-uri-authority - Gets the authority part of a URI.
uri:get-uri-path - Gets the path part of a URI.
uri:get-uri-query - Gets the query part of a URI.
uri:get-uri-fragment - Gets the fragment part of a URI.
uri:resolve-uri - Resolves a URI reference against a base URI.

Name

uri:is-absolute-uri — Determines if a URI is absolute or relative.

Synopsis

<xsl:template name="uri:is-absolute-uri"><xsl:param name="uri"/>  ...</xsl:template>

Absolute URIs start with a scheme (like "http:" or "mailto:").

Parameters
uri

An absolute or relative URI.

Returns

Returns 'true' if the URI is absolute or '' if it's not.



Name

uri:get-uri-scheme — Gets the scheme part of a URI.

Synopsis

<xsl:template name="uri:get-uri-scheme"><xsl:param name="uri"/>  ...</xsl:template>

The ':' is not part of the scheme.

Parameters
uri

An absolute or relative URI.

Returns

Returns the scheme (without the ':') or '' if the URI is relative.



Name

uri:get-uri-authority — Gets the authority part of a URI.

Synopsis

<xsl:template name="uri:get-uri-authority"><xsl:param name="uri"/>  ...</xsl:template>

The authority usually specifies the host machine for a resource. It always follows '//' in a typical URI.

Parameters
uri

An absolute or relative URI.

Returns

Returns the authority (without the '//') or '' if the URI has no authority.



Name

uri:get-uri-path — Gets the path part of a URI.

Synopsis

<xsl:template name="uri:get-uri-path"><xsl:param name="uri"/>  ...</xsl:template>

The path usually comes after the '/' in a URI.

Parameters
uri

An absolute or relative URI.

Returns

Returns the path (with any leading '/') or '' if the URI has no path.



Name

uri:get-uri-query — Gets the query part of a URI.

Synopsis

<xsl:template name="uri:get-uri-query"><xsl:param name="uri"/>  ...</xsl:template>

The query comes after the '?' in a URI.

Parameters
uri

An absolute or relative URI.

Returns

Returns the query (without the '?') or '' if the URI has no query.



Name

uri:get-uri-fragment — Gets the fragment part of a URI.

Synopsis

<xsl:template name="uri:get-uri-fragment"><xsl:param name="uri"/>  ...</xsl:template>

The fragment comes after the '#' in a URI.

Parameters
uri

An absolute or relative URI.

Returns

Returns the fragment (without the '#') or '' if the URI has no fragment.



Name

uri:resolve-uri — Resolves a URI reference against a base URI.

Synopsis

<xsl:template name="uri:resolve-uri"><xsl:param name="reference"/><xsl:param name="base"/><xsl:param name="document" select="$base"/>  ...</xsl:template>

This template follows the guidelines specified by RFC 2396.

Parameters
reference

A (potentially relative) URI reference.

base

The base URI.

document

The URI of the current document. This defaults to the value of the base URI if not specified.

Returns

The "combined" URI.