SPFE Documentation | Collections > SPFE Function Reference > url-to-local
Function: url-to-local
url-to-local(url as item()*) as item()*
- Description
-
Converts a file URL into a local system path.
- Return value
-
Return type: item()*
The file URL as a local system path.
- Source file
-
$SPFEOT_HOME/1.0/scripts/common/utility-functions.xsl
Parameters
- url
-
Type: item()*
The URL to be converted to a system path.
Definition
<xsl:function name="sf:url-to-local"> <xsl:param name="url"/> <xsl:variable name="new-url"> <xsl:choose > <xsl:when test="matches($url, '^file:/[a-zA-Z]:/')"> <xsl:value-of select="substring-after($url,'file:/')"/> </xsl:when> <xsl:when test="matches($url, '^[a-zA-Z]:/')"> <xsl:value-of select="$url"/> </xsl:when> <xsl:when test="matches($url, '^file:/')"> <xsl:value-of select="substring-after($url,'file:')"/> </xsl:when> <xsl:when test="matches($url, '^[a-zA-Z]+:/')"> <xsl:message terminate="yes"> <xsl:text >ERROR: A URL with an unsupported protocol was specified. The URL is: </xsl:text> <xsl:value-of select="$url"/> </xsl:message> </xsl:when> <xsl:otherwise > <xsl:value-of select="$url"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:value-of select="replace($new-url, '%20', ' ')"/> </xsl:function>