XSLT Functions

A reference of all custom XSLT functions available in Stroom.

Stroom has a number of built in custom XSLT functions that can be called from within the XSLTFilter pipeline element. These functions provide additional capabilities and access to data held in Stroom.

Using Stroom XSLT Functions

To use a Stroom custom XSLT function you need to add the xmlns:stroom="stroom" namespace declaration to the XSLT document. The convention is to use the namespace prefix stroom to make it clear that function calls are to a Stroom built-in function, but any prefix can be used.

<xsl:stylesheet
  version="2.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:stroom="stroom"
  xmlns="event-logging:3"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  ...>

The following is an example of calling the hash custom XSLT function to produce a hash of the username value.

  <xsl:template match="/record">
    <HashedUser>
      <xsl:value-of select="stroom:hash(data[@name='username']/@value, 'SHA-256')"/>
    </HashedUser>
  </xsl:template>

Return Values

XSLT functions can return the following data types:

  • Boolean - True/false.
  • Date - A date value (xs:date).
  • Date-Time - A date and time value (xs:datetime).
  • Decimal - A decimal or floating point value (xs:decimal).
  • Integer - A number with no decimal part (xs:integer).
  • String - A simple string value (xs:string).
  • Sequence - Any sequence of nodes or atomic values, e.g. a single node, a list of nodes or a list of strings.

Functions

The following table lists all the Stroom XSLT functions.

Function Category
add-meta() Pipeline
ask-ai() Other
bitmap-lookup() Pipeline
cidr-to-numeric-ip-range() Network
classification() Pipeline
col-from() Pipeline
col-to() Pipeline
cosine-similarity() Other
current-time() Date
current-unixTime() Date
current-user() Value
decode-url() URI
dictionary() Pipeline
encode-url() URI
feed-attribute() Pipeline
feed-name() Pipeline
fetch-json() Network
format-date() Date
format-dateTime() Date
from-unixTime() Date
get() Pipeline
hash() Conversion
hex-to-dec() Conversion
hex-to-oct() Conversion
hex-to-string() Conversion
host-address() Network
host-name() Network
http-call() Network
ip-in-cidr() Network
json-to-xml() Conversion
line-from() Pipeline
line-to() Pipeline
link() String
log() Pipeline
lookup() Pipeline
manifest() Pipeline
manifest-for-id() Pipeline
meta() Pipeline
meta-attribute() Pipeline
meta-keys() Pipeline
meta-stream() Pipeline
meta-stream-for-id() Pipeline
numeric-ip() Network
parent-for-id() Pipeline
parent-id() Pipeline
parse-dateTime() Date
parse-uri() URI
part-no() Pipeline
pipeline-name() Pipeline
pointIsInsideXYPolygon() Other
put() Pipeline
random() Value
random-integer() Value
record-no() Pipeline
search-id() Pipeline
send-email() Other
source() Pipeline
source-id() Pipeline
split-document() Other
stream-id() Pipeline
to-unixTime() Date

Conversion Functions

Functions for converting a value from one form to another, e.g. hexToString.

Date/Time Functions

Functions for date/time parsing and manipulation.

Network Functions

Functions relating to networking (host names, IP addresses, etc.) or making remote calls.

Other Functions

Functions that don’t fit into any other category.

Stroom Pipeline Functions

Functions for obtaining information about the current pipeline process.

String Functions

Functions for string parsing and manipulation.

URI/URL Functions

Functions relating to parsing and manipulating URI/URLs.

Value Functions

Functions that simply supply a value.