Skip to main content

XSLT Extensions

XSLT Extensions

In order for the following extensions to be used the following must be included in the XSL:

These have corresponding XSLT templated functions to be found in ewCommonFunctions.xsl so there is no need to use these directly on each XSLT.

CleanHTML

ew:CleanHTML(‘your html ’)

Uses tidy and converts entities to codes.

EonicConfigValue

ew:EonicConfigValue(ByVal SectionName As String, ByVal ValueName As String)

Returns a value form the Eonic Section within web.config

GetContentLocations

ew:GetContentLocations(ByVal nContentId As Integer)
Returns a comma separated list of locations for that specific type of content

ew:GetContentLocations(ByVal nContentId As Integer, ByVal bIncludePrimary As Boolean)
Includes the primary Id

ew:GetContentLocations(ByVal nContentId As Integer, ByVal bIncludePrimary As Boolean, ByVal bExcludeLocation As Integer)

ew:GetContentLocations(ByVal nContentId As Integer, ByVal bIncludePrimary As Boolean, ByVal nExcludeLocation As Integer, ByVal bShowHiddenPages As Boolean)
Shows locations that are hidden to the user

FlattenNodeXml

ew:FlattenNodeXml(ByVal oContextNode As Object)

VirtualFileExists

ew:VirtualFileExists(ByVal cVirtualPath As String)

ImageWidth

ew:ImageWidth(ByVal cVirtualPath As String)
Returns the width of the image specified

ImageHeight

ImageHeight(ByVal cVirtualPath As String)
Returns the height of the image specified

ResizeImage

ResizeImage(ByVal cVirtualPath As String, ByVal maxWidth As Long, ByVal maxHeight As Long, ByVal sSuffix As String)

ResizeImage(ByVal cVirtualPath As String, ByVal maxWidth As Long, ByVal maxHeight As Long, ByVal sSuffix As String, ByVal nCompression As Integer)

ResizeImage(ByVal cVirtualPath As String, ByVal maxWidth As Long, ByVal maxHeight As Long, ByVal sPrefix As String, ByVal sSuffix As String, ByVal nCompression As Integer)
Resizes the image and saves the new image to a new location as per the prefix and suffix supplied.

cVirtualPath    
The filename and path of the image to be resized from the website root
maxWidthThe maximum width of the resized image
maxHeightThe maximum height of the resized image (keeping aspect ratio)
suffixAfter the filename but before the file extension of the new file ie /image/picutresuffix .jpg
prefixAfter the filename but after the file extension of the new file ie /image/prefix picutre.jpg (can include / for directories)

 

StringCompare

 

TruncateString

TruncateString(ByVal input As String, ByVal limit As Long)

ReplaceString

replacestring(ByVal text As String, ByVal replace As String, ByVal replaceWith As String)

RandomNumber

randomnumber(ByVal min As Integer, ByVal max As Integer)

GetDate

getdate(ByVal dateString As String)

DateAdd

dateadd(ByVal dateString As String, ByVal Interval As Long, ByVal IntervalType As String)

formatDate

formatdate(ByVal dateString As String, ByVal dateFormat As String)

DateDiff

datediff(ByVal date1String As String, ByVal date2String As String, ByVal datePart As String)

TextAfterLast

textafterlast(ByVal text As String, ByVal search As String)

SubscriptionPrice

SubscriptionPrice(ByVal nPrice As String, ByVal cPriceUnit As String, ByVal nDuration As Integer, ByVal cDurationUnit As String)

ContentQuery

ContentQuery(ByVal cContentName As String, ByVal cXpath As String, Optional ByVal nPrimaryId As Long = 0)

Delete Content

DeleteContent(ByVal nContentId As Long)

SelectOptionQuery

SelectOptionQuery(Query)
Returns a XML node list of Xform style options for a dropdown.

Query Reference
SiteTree = Returns the site tree
Directory.x = Returns Directory Items where x is the Schema type. i.e.
Directory.Group
Directory.Role

Adding Additional XSLT Extensions

You can request the addition of XSLT extensions by contacting the eonicweb development team who will be very happy to consider your request.

Bespoke extensions can be added by overloading xsltExtensions in Eonic.xmltools in a .net dll that inherits eonic.web.