SPFE Documentation | Collections > SPFE Function Reference > local-to-url

Function: local-to-url

local-to-url(local-path as item()*) as item()*

Description

Converts a local path expression into a file URL. Useful for calling XSLT functions that expect a URL.

Return value

Return type: item()*

The path converted to a file URL.

Source file

$SPFEOT_HOME/1.0/scripts/common/utility-functions.xsl

Parameters

local-path

Type: item()*

The local path to be converted.

Definition

            <xsl:function name="sf:local-to-url">
		               <xsl:param name="local-path"/>
		               <xsl:choose >
			                   <xsl:when test="matches($local-path, '^[a-zA-Z]{2,}:/')">
				                       <xsl:value-of select="$local-path"/>
			                   </xsl:when>
			                   <xsl:otherwise >
				                       <xsl:value-of select="concat('file:///', normalize-space($local-path))"/>
			                   </xsl:otherwise>
		               </xsl:choose>
	           </xsl:function>