XSLT Extension - URLs

The URLs library XSLT extension can be used to ease those often tricky situations in XSLT.

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.Urls" alias="ucomponents.urls" />
	...
</XsltExtensions>

Methods

Here are available methods:

Method Returns Notes
AppendOrUpdateQueryString(String, String) The updated Url Appends or updates a query string value to the current Url
AppendOrUpdateQueryString(String, String, String) The updated Url Appends or updates a query string value to supplied Url
FormatUrl(String) Returns a 'safe' URL, removing illegal characters. Formats the URL - replacing characters in the string to make a 'safe' URL.
GetHostName(Int32) Returns the hostname for the node Id. Gets the hostname of the node Id.
GetNodeIdByUrl(String) Returns the node Id. Gets the node Id by URL.
GetXmlNodeByUrl(String) Returns the XML for the node. Gets the XML node by URL.
GuessNiceUrl(int nodeId) Guesses the NiceUrl for a given node id.
NiceUrl(Int32) The NiceUrl for the node id. Returns a nicely formated Url for a given node.
NiceUrl(Int32, String) The NiceUrl for the node id. Returns a nicely formated Url for a given node and alternative template.
NiceUrl(Int32, String, Boolean) The NiceUrl for the node id. Returns a nicely formated Url for a given node and alternative template.

Event Handlers

Here are available event handlers:

Event Notes
OnAfterNiceUrlGenerated(Int32, String) Dispatches an AfterNiceUrlGenerated event.
OnBeforeNiceUrlGenerated(Int32) Dispatches a BeforeNiceUrlGenerated event.

Last edited Oct 26, 2011 at 3:27 PM by leekelleher, version 5