URI/URL Functions
Functions relating to parsing and manipulating URI/URLs.
decode-url
decode-url(encodedUrl)➡String
Decodes a URL-encoded string.
Function Arguments:
| Param | Type | Mandatory | Default Value | Allowed Values | Multiple | Min Count | Description |
|---|---|---|---|---|---|---|---|
encodedUrl |
String | - | - | - | The URL-encoded string. |
Return Value:
| Type | Description |
|---|---|
| String | The decoded string, or an empty sequence if decoding fails. |
encode-url
encode-url(url)➡String
URL-encodes a string.
Function Arguments:
| Param | Type | Mandatory | Default Value | Allowed Values | Multiple | Min Count | Description |
|---|---|---|---|---|---|---|---|
url |
String | - | - | - | The string to encode. |
Return Value:
| Type | Description |
|---|---|
| String | The encoded string, or an empty sequence if encoding fails. |
parse-uri
parse-uri(uri)➡Sequence
The parse-uri() function takes a Uniform Resource Identifier (URI) in string form and returns
an XML node with a namespace of uri containing the URI’s individual components of authority,
fragment, host, path, port, query, scheme, schemeSpecificPart and userInfo.
Function Arguments:
| Param | Type | Mandatory | Default Value | Allowed Values | Multiple | Min Count | Description |
|---|---|---|---|---|---|---|---|
uri |
String | - | - | - | The URI string to parse. |
Return Value:
| Type | Description |
|---|---|
| Sequence | An XML document containing the URI components, or an empty sequence for an invalid URI. |
See Also
See either RFC 2306: Uniform Resource Identifiers (URI): Generic Syntax or Java's java.net.URI Class for details regarding the components.
Example Usage
Given that rURI contains the following text:
http://foo:bar@w1.superman.com:8080/very/long/path.html?p1=v1&p2=v2#more-details
XSLT:
<!-- Display and parse the URI contained within the text of the rURI element -->
<xsl:variable name="uri" select="stroom:parse-uri(rURI)" />
<URI>
<xsl:value-of select="rURI" />
</URI>
<URIDetail>
<xsl:copy-of select="$uri"/>
</URIDetail>
XML:
<URI>http://foo:bar@w1.superman.com:8080/very/long/path.html?p1=v1&p2=v2#more-details</URI>
<URIDetail>
<authority xmlns="uri">foo:bar@w1.superman.com:8080</authority>
<fragment xmlns="uri">more-details</fragment>
<host xmlns="uri">w1.superman.com</host>
<path xmlns="uri">/very/long/path.html</path>
<port xmlns="uri">8080</port>
<query xmlns="uri">p1=v1&p2=v2</query>
<scheme xmlns="uri">http</scheme>
<schemeSpecificPart xmlns="uri">//foo:bar@w1.superman.com:8080/very/long/path.html?p1=v1&p2=v2</schemeSpecificPart>
<userInfo xmlns="uri">foo:bar</userInfo>
</URIDetail>
Last modified October 20, 2026: Merge pull request #144 from gchq/add-7.14-rel-notes (2c6fb22)