XSLT extension class

Build 1501 on 14/Nov/2017  This topic last edited on: 4/Mar/2014, at 16:41

At the moment GN4 only supports XSLT 1 and some functionalities available only in XSLT 2 are not available.

To overcome this limitation GN4 uses an XSLT extension class. It is described in
http://tech.teradp.com/tech/html/gn4/docs/VSdoc/index.html?frlrfTeraDPGN4CommonXsltExtensionsClassTopic_members--.html

The required namespace is xmlns:fn="http://www.teradp.com/schemas/GN4/1/Xslt".

Name

Description

addDuration

Add a duration in seconds to a date-time

addTime

Add a time value from a date-time

applyRegExp

Apply a regular expression to text, returning the result as an XML fragment

cleanUserName

Cleans a user name: converts 'domain\name' or 'domain/name' or 'name@domain' into just 'name'

compareDateTime

Compare two dateTime

computeDuration

Compute a duration value in seconds from a pair value/scale

convertUnit

Converts a value with an associated dimension from a measurement unit to another

countText

Computes the number of words and characters contained in a text - that can be a string or an XML fragment. Note that if the XML fragment contains a list of nodes the function returns the number of words and characters in ALL the nodes - not just the first one.

createGuid

Creates a new global unique identifier (GUID)

dataIdFromString

Convert a binary data id string into the corresponding numeric value

dataIdToString

Converts a binary data numeric id into the corresponding string

dateRange

Calculate the difference between two dates and return the value as minutes or hours, etc...

dateTimetoUnixTime

Convert the input date to Unix Epoch Time. Unix time, or POSIX time, is a system for describing points in time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

dayOfWeek

Gets the name of the day in the week ('Monday', 'Tuesday', ...) corresponding to a date-time.

deadlineColor

Computes a color indicating how late a task with a certain deadline is

distinct

Compute the set of distinct (different) string values amongst a list of strings.

encryptUrlQueryString

Encrypt the Url query string

Equals

(Overloaded) Determines whether the specified Object is equal to the current Object. (inherited from Object).

estimateReadingTime

Estimates the reading time of a text

formatDateTime

Format a date-time

formatNumber

Format a number using the current culture

formatString

(Overloaded) Replaces the format item in a string with the corresponding values passed to the function

fromUTCToClientLocalTime

Converts the input objValue assumed to be a DateTime expressed in UTC (Coordinated Universal Time) to the time zone, which id is specified by objTimeZoneId.

GetHashCode

Serves as a hash function for a particular type. (inherited from Object).

getPubModeNameParamKey

Given the id of an object, get the key of the parameter, which value contains the name of the pubMode used to published that object.

getString

Gets the translation of a string

GetType

(Overloaded) Gets the Type of the current instance. (inherited from Object).

getUsersFolderPath

Get the complete path to the folder containing user home folders

maxDateTime

Compute the maximum (most recent) of a list of date-times. The date-times are represented as strings, the non-valid ones are ignored

maxNumber

Compute the maximum of a list of numbers. Non-valid numbers in the list are ignored

maxString

Compute the maximum of a list of strings

minDateTime

Compute the minimum (least recent) of a list of date-times. The date-times are represented as strings, the non-valid ones are ignored

minNumber

Compute the mainumum of a list of numbers. Non-valid numbers in the list are ignored

minString

Compute the minimum of a list of strings

objectIdFromString

Convert an object id string into the corresponding numeric value

objectIdToString

Converts an object numeric id into the corresponding string

paragraphs

(Overloaded) Converts text with end lines in a sequence of paragraphs nodes

parseDimension

Parses a string that contains a value and a measurement unit

parseXSDuration

Parse a string expressing a time interval in the xs:duration format ('PnYnMnDTnHnMnS') converting it to an XML node with separate years, months, days, hours, minutes and seconds values

pathFileName

Extracts the file name part (including the extension) from a complete file path

pathFileNameNoExt

Extracts the file name part without the the extension from a complete file path

ReferenceEquals

Determines whether the specified Object instances are the same instance. (inherited from Object).

relativeDateTime

Converts a date-time into a 'friendly' expression relative to the current date-time - e.g. '5 minutes ago', 'yesterday' etc.

replace

Within a specified input string, replaces all strings that match a regular expression pattern with a specified replacement string.

roundDateToTime

Calculate the DateTime before the <paramref name="objValue" /> param, with day and hour specified by <paramref name="startDay" /> and <paramref name="startHour" /> if these two value are 0 the returned date is <paramref name="objValue" />

shapeArea

Compute the total area of a list of polygons

subtractTime

Subtract a time value from a date-time - producing a new date-time.

toClientLocalTime

Convert the input DateTime to client local time.

DEPRECATED!

The conversion done by this method is based on the current offset between local time and UTC and may cause wrong results when the local time zone supports daylight saving time.

This method is sill available for compatibility purpose with old configuration files, but it is deprecated and the method fromUTCToClientLocalTime, which conversion is based on the client time zone, must be used instead.

toHex

Return the input number as hexadecimal string

toLocalTime

Convert the input date to server local time.

Note: the culturename on the server may affect the date time conversion. You can check the configuration gnpc_useroption for the users that are publishing generating the wrog date. In there you can read the settings for the TimeZoneId and CultureName. The culturename set to a specific Arabic may change also the year to be the Islamic one. When scheduling the publishing task the culture may affect the “ToLocalTime” function.

First verify the above, secondly you can try to replace the toLocalTime with:

fn:formatDateTime(fn:fromUTCToClientLocalTime($now,$context/lc:LoginContext/@ClientTimeZoneId),'yyyy')

And then test publishing again with the same user having specific culture.

ToString

Returns a string that represents the current object. (inherited from Object).

trimText

Reduces a text below a certain length, cutting it at the last position of specified separator characters

unixTimeToDateTime

Convert the input Unix Epoch Time to a date and time, in UTC. Unix time, or POSIX time, is a system for describing points in time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

urlEncode

Encodes a URL string

xmlLength

Compute the length (in characters) of an XML fragment converted to text in the same way used to store XML fragments in the database