SPFE Documentation | Collections > SPFE Function Reference > path-after-protocol-part

Function: path-after-protocol-part

path-after-protocol-part(path as item()*) as xs:string

Description

The path-after-protocol-part function takes a URL containing a protocol (file, http, etc) and returns the part after the protocol. For example, if will turn a URL like this:

file:/c:/Users/Joe/spfe-open-toolkit/spfe-ot/spfe.bat

into

c:/Users/Joe/spfe-open-toolkit/spfe-ot/spfe.bat

This is mostly useful for taking local file URLs returned by some tools and turning them into the local paths accepted by other tools.

Note that this function does not do URL decoding. If the URL you are using may be URL encoded (that is, if it uses %20 for spaces, and similar % encodings for other special characters), use local-path-from-uri.

Return value

Return type: xs:string

The path with the protocol part removed.

Source file

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

Parameters

path

Type: item()*

The path to be processed.

Definition

            <xsl:function name="sf:path-after-protocol-part" as="xs:string">
		               <xsl:param name="path"/>
		               <xsl:analyze-string select="$path" regex="^([a-zA-Z]{{2,}}://?/?)?(.+)">
			                   <xsl:matching-substring >
				                       <xsl:value-of select="regex-group(2)"/>
			                   </xsl:matching-substring>
		               </xsl:analyze-string>
	           </xsl:function>