SPFE Documentation | Collections > SPFE Function Reference > local-path-from-uri
Function: local-path-from-uri
local-path-from-uri(uri as item()*) as item()*
- Description
-
The local-path-from-uri function takes a URL containing a protocol (file, http, etc) and returns the part after the protocol, decoding the URL if required. For example, if will turn a URL like this:
file:/c:/Users/Joe%20Blogs/spfe-open-toolkit/spfe-ot/spfe.bat
into
c:/Users/Joe Blogs/spfe-open-toolkit/spfe-ot/spfe.bat
This is mostly useful for taking local file URIs returned by some tools and turning them into the local paths accepted by other tools.
This function is similar to path-after-protocol-part, except that path-after-protocol-part does not do URL decoding. This function calls path-after-protocol-part to do its work, after decoding the URI. Calling this function on a URI that is not URL encoded will work fine, so you can always call this function rather than path-after-protocol-part.
- Return value
-
Return type: item()*
A URL-decoded version of the input URI with the protocol part removed.
- Source file
-
$SPFEOT_HOME/1.0/scripts/common/utility-functions.xsl
Parameters
- uri
-
Type: item()*
The input URI.
Definition
<xsl:function name="sf:local-path-from-uri"> <xsl:param name="uri"/> <xsl:value-of select="sf:pct-decode(sf:path-after-protocol-part($uri))"/> </xsl:function>