XSLT Extension - IO

The IO library XSLT extension can be used to retrieve useful data from the FileSystem.

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.Core" type="uComponents.Core.XsltExtensions.IO" alias="ucomponents.io" />
	...
</XsltExtensions>

Methods

Here are available methods:

Method Returns Notes
DirectoryExists(string path) Returns true if the directory exists, otherwise false. Directories the exists.
FileExists(string path) Returns true if the file exists, otherwise false. Files the exists.
FormatFileSize(Int64) Formats the size of the file.
GetDirectories(string path, string searchPattern, bool allDirectories) Returns a node-set of the directories. Gets the directories.
GetFiles(string path, string searchPattern, bool allDirectories) Returns a node-set of the files. Gets the files.
GetServerMapPath(string path) Returns the physical file path that corresponds to the specified virtual path on the web server. Gets the mapped path to the server.
LoadFile(string filepath) Returns the contents of the specified file. Loads and reads the contents of a file.
MapPath(string path, bool useHttpContext) Returns the physical file path that corresponds to the specified virtual path on the web server. Gets the mapped path to the server.
PathShortener(string input) Returns a shortened path of the string. Truncates the middle sect of a string, this is ideal for long filepaths or URLs.

Last edited Aug 31, 2011 at 11:11 AM by leekelleher, version 3