Enabling the XSLT extension for use in your XSLT templates.
Add the following XML snippet to your ~/config/xsltExtensions.config
file:
<XsltExtensions>
...
<ext assembly="uComponents.XsltExtensions" type="uComponents.XsltExtensions.IO" alias="ucomponents.io" />
...
</XsltExtensions>
Here are available methods in the IO
library:
Directories the exists. Returns: Returns true if the directory exists, otherwise false.
| Name | Type | Notes |
|——|——|——-|
| path | System.String
| |
<xsl:value-of select="ucomponents.io:DirectoryExists(path)" />
Files the exists. Returns: Returns true if the file exists, otherwise false.
| Name | Type | Notes |
|——|——|——-|
| path | System.String
| |
<xsl:value-of select="ucomponents.io:FileExists(path)" />
Gets the directories. Returns: Returns a node-set of the directories.
| Name | Type | Notes |
|——|——|——-|
| path | System.String
| |
| searchPattern | System.String
| |
| allDirectories | System.Boolean
| |
<xsl:value-of select="ucomponents.io:GetDirectories(path, searchPattern, allDirectories)" />
Gets the files. Returns: Returns a node-set of the files.
| Name | Type | Notes |
|——|——|——-|
| path | System.String
| |
| searchPattern | System.String
| |
| allDirectories | System.Boolean
| |
<xsl:value-of select="ucomponents.io:GetFiles(path, searchPattern, allDirectories)" />
Gets the extension. Returns: Returns the extension of the specified path string.
| Name | Type | Notes |
|——|——|——-|
| path | System.String
| |
<xsl:value-of select="ucomponents.io:GetExtension(path)" />
Gets the name of the file. Returns: Returns the file name and extension of the specified path string.
| Name | Type | Notes |
|——|——|——-|
| path | System.String
| |
<xsl:value-of select="ucomponents.io:GetFileName(path)" />
Gets the file name without extension. Returns: Returns the file name of the specified path string without the extension.
| Name | Type | Notes |
|——|——|——-|
| path | System.String
| |
<xsl:value-of select="ucomponents.io:GetFileNameWithoutExtension(path)" />
Gets the name of the directory. Returns: Returns the directory name for the specified path string.
| Name | Type | Notes |
|——|——|——-|
| path | System.String
| |
<xsl:value-of select="ucomponents.io:GetDirectoryName(path)" />
Gets the size of the file. Returns: Returns the filesize for the specified filepath.
| Name | Type | Notes |
|——|——|——-|
| path | System.String
| |
<xsl:value-of select="ucomponents.io:GetFileSize(path)" />
Gets the mapped path to the server. Returns: Returns the physical file path that corresponds to the specified virtual path on the web server.
| Name | Type | Notes |
|——|——|——-|
| path | System.String
| |
<xsl:value-of select="ucomponents.io:GetServerMapPath(path)" />
Gets the mapped path to the server. Returns: Returns the physical file path that corresponds to the specified virtual path on the web server.
| Name | Type | Notes |
|——|——|——-|
| path | System.String
| |
| useHttpContext | System.Boolean
| |
<xsl:value-of select="ucomponents.io:MapPath(path, useHttpContext)" />
Truncates the middle section of a string, this is ideal for long filepaths or URLs. Returns: Returns a shortened path of the string.
| Name | Type | Notes |
|——|——|——-|
| input | System.String
| |
<xsl:value-of select="ucomponents.io:PathShortener(input)" />
Formats the size of the file.
| Name | Type | Notes |
|——|——|——-|
| filesize | System.Int64
| |
<xsl:value-of select="ucomponents.io:FormatFileSize(filesize)" />
Loads and reads the contents of a file. Returns: Returns the contents of the specified file.
| Name | Type | Notes |
|——|——|——-|
| filepath | System.String
| |
<xsl:value-of select="ucomponents.io:LoadFile(filepath)" />
Gets the FileInfo. Returns: Returns the System.IO.FileInfo for the specified filepath.
| Name | Type | Notes |
|——|——|——-|
| path | System.String
| |
<xsl:value-of select="ucomponents.io:GetFileInfo(path)" />
Checks if the file path is a Uri, then returns the local file path. Returns: Returns the local file path.
| Name | Type | Notes |
|——|——|——-|
| path | System.String
| |
<xsl:value-of select="ucomponents.io:GetLocalFilePath(path)" />