The functions available within XSL are very limited. These extension functions provide additional capability to ease the process of writing XSL Stylesheets. The functions are divided into separate libraries of related functions. Each library can be referenced by defining its namespace at the top of the XSL Stylesheet, for example to use the string library the stylesheet declaration should look like this:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:str="http://www.orchestria.com/string">
N.B. The list of functions is not exhaustive but just comprises those functions that have been found useful to date.
Library |
Function Name |
Parameters |
Parameter Type |
Description |
---|---|---|---|---|
date |
nowUTC |
|
|
The time now in Universal Coordinated Time (UTC) in human readable form. |
date |
rangeUTC |
dateRange |
string |
The input string is two WgnDate values separated with a comma. The returned string is the date range converted to UTC in human readable form. |
date |
rangeUTCFrom |
dateRange |
string |
The input string is two WgnDate values separated with a comma. The returned string is the 'from' date converted to UTC in human readable form. |
date |
rangeUTCTo |
dateRange |
string |
The input string is two WgnDate values separated with a comma. The returned string is the 'to' date converted to UTC in human readable form. |
io |
fileExists |
filename |
string |
Returns true if the specified file exists. The filename path should be relative to the virtual directory. |
io |
fileList |
path |
string |
Returns a comma-separated list of filenames matching the specified pattern in the given directory path. |
|
|
pattern |
string |
|
math |
cos |
angle |
degrees |
Returns the cosine of the angle |
math |
min |
val1 |
double |
Returns the minimum of the two values |
|
|
val2 |
double |
|
math |
max |
val1 |
double |
Returns the maximum of the two values |
|
|
val2 |
double |
|
math |
sin |
angle |
degrees |
Returns the sine of the angle |
math |
tick |
range |
double |
Returns a suitable axis tick interval for the given axis range |
string |
compare |
str1 |
string |
Compares the two strings returning: |
|
|
str2 |
string |
|
string |
decodeName |
str |
string |
Decodes an XML name that has been encoded because it contains special characters (e.g. space) |
string |
elementStyle |
str |
string |
Returns the style component of a string in the form value::style. |
string |
elementValue |
str |
string |
Returns the value component of a string in the form value::style. |
string |
encodeName |
str |
string |
Encodes a name containing special characters in a form suitable for use as an XML name. |
string |
escapeString |
str |
string |
Returns the given string escaped using URL encoding |
string |
indexOf |
str1 |
string |
Returns the position of str2 within str1 or -1 if not found. |
|
|
Str2 |
string |
|
string |
JSescapeString |
str |
string |
Returns the given string escaped using backslashes. |
string |
replace |
str |
string |
Replaces the first occurrence of strold with strnew in str. If flags is set to 'g' all occurrences are replaced |
|
|
strold |
string |
|
|
|
strnew |
string |
|
|
|
flags |
string |
|
string |
toLowerCase |
str |
string |
Returns the given string converted to lower case characters |
string |
toUpperCase |
str |
string |
Returns the given string converted to upper case characters |
Copyright © 2014 CA.
All rights reserved.
|
|