Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions assets/data/xslt-functions/_index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"Pipeline" : {
"category" : "Pipeline",
"docFilename" : "pipeline.md",
"functionNames" : [ "bitmap-lookup" ]
},
"Conversion" : {
"category" : "Conversion",
"docFilename" : "conversion.md",
"functionNames" : [ "hash" ]
},
"Value" : {
"category" : "Value",
"docFilename" : "value.md",
"functionNames" : [ "random" ]
}
}
63 changes: 63 additions & 0 deletions assets/data/xslt-functions/bitmap-lookup.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"name" : "bitmap-lookup",
"aliases" : [ ],
"commonCategory" : [ "Pipeline" ],
"helpAnchor" : "",
"commonSubCategories" : [ ],
"commonDescription" : "The bitmap-lookup() function looks up a bitmap key from reference or context data a value (which can be an XML node set) for each set bit position and adds it to the resultant XML.\n\nIf the look up fails no result will be returned.\n\nThe key is a bitmap expressed as either a decimal integer or a hexidecimal value, e.g. `14`/`0xE` is `1110` as a binary bitmap.\nFor each bit position that is set, (i.e. has a binary value of `1`) a lookup will be performed using that bit position as the key.\nIn this example, positions `1`, `2` & `3` are set so a lookup would be performed for these bit positions.\nThe result of each lookup for the bitmap are concatenated together in bit position order, separated by a space.\n\nIf `ignoreWarnings` is true then any lookup failures will be ignored and it will return the value(s) for the bit positions it was able to lookup.\n\nThis function can be useful when you have a set of values that can be represented as a bitmap and you need them to be converted back to individual values.\nFor example if you have a set of additive account permissions (e.g Admin, ManageUsers, PerformExport, etc.), each of which is associated with a bit position, then a user's permissions could be defined as a single decimal/hex bitmap value.\nThus a bitmap lookup with this value would return all the permissions held by the user.\n\nFor example the reference data store may contain:\n\n| Key (Bit position) | Value |\n|--------------------|----------------|\n| 0 | Administrator |\n| 1 | Manage_Users |\n| 2 | Perform_Export |\n| 3 | View_Data |\n| 4 | Manage_Jobs |\n| 5 | Delete_Data |\n| 6 | Manage_Volumes |\n\nThe following are example lookups using the above reference data:\n\n| Lookup Key (decimal) | Lookup Key (Hex) | Bitmap | Result |\n|----------------------|------------------|-----------|-----------------------------------------|\n| `0` | `0x0` | `0000000` | - |\n| `1` | `0x1` | `0000001` | `Administrator` |\n| `74` | `0x4A` | `1001010` | `Manage_Users View_Data Manage_Volumes` |\n| `2` | `0x2` | `0000010` | `Manage_Users` |\n| `96` | `0x60` | `1100000` | `Delete_Data Manage_Volumes` |\n",
"commonReturnType" : [ "Sequence" ],
"commonReturnDescription" : "The hash of the value",
"signatures" : [ {
"subCategories" : [ ],
"returnDescription" : "",
"returnType" : [ ],
"args" : [ {
"minVarargsCount" : 0,
"allowedValues" : [ ],
"name" : "map",
"defaultValue" : "",
"isVarargs" : false,
"argType" : "String",
"description" : "The name of the map to perform the lookup in.",
"isOptional" : false
}, {
"minVarargsCount" : 0,
"allowedValues" : [ ],
"name" : "key",
"defaultValue" : "",
"isVarargs" : false,
"argType" : "String",
"description" : "The key to lookup in the named map.",
"isOptional" : false
}, {
"minVarargsCount" : 0,
"allowedValues" : [ ],
"name" : "time",
"defaultValue" : "",
"isVarargs" : false,
"argType" : "String",
"description" : "Determines which set of reference data was effective at the requested time.\nIf no reference data exists with an effective time before the requested time then the lookup will fail.\nTime is in the format `yyyy-MM-dd'T'HH:mm:ss.SSSXX`, e.g. `2010-01-01T00:00:00.000Z`.",
"isOptional" : true
}, {
"minVarargsCount" : 0,
"allowedValues" : [ ],
"name" : "ignoreWarnings",
"defaultValue" : "",
"isVarargs" : false,
"argType" : "Boolean",
"description" : "If true, any lookup failures will be ignored, else they will be reported as warnings.",
"isOptional" : true
}, {
"minVarargsCount" : 0,
"allowedValues" : [ ],
"name" : "trace",
"defaultValue" : "",
"isVarargs" : false,
"argType" : "Boolean",
"description" : "If true, additional trace information is output as INFO messages.",
"isOptional" : true
} ],
"description" : "",
"category" : [ ]
} ]
}
45 changes: 45 additions & 0 deletions assets/data/xslt-functions/hash.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name" : "hash",
"aliases" : [ ],
"commonCategory" : [ "Conversion" ],
"helpAnchor" : "",
"commonSubCategories" : [ ],
"commonDescription" : "Generates a hash of the passed value.",
"commonReturnType" : [ "String" ],
"commonReturnDescription" : "The hash of the value",
"signatures" : [ {
"subCategories" : [ ],
"returnDescription" : "",
"returnType" : [ ],
"args" : [ {
"minVarargsCount" : 0,
"allowedValues" : [ ],
"name" : "value",
"defaultValue" : "",
"isVarargs" : false,
"argType" : "String",
"description" : "The value to hash.",
"isOptional" : false
}, {
"minVarargsCount" : 0,
"allowedValues" : [ "MD5", "SHA", "SHA-224", "SHA-256", "SHA-384", "SHA-512" ],
"name" : "algorithm",
"defaultValue" : "SHA-256",
"isVarargs" : false,
"argType" : "String",
"description" : "The name of the hash algorithm to use.",
"isOptional" : true
}, {
"minVarargsCount" : 0,
"allowedValues" : [ ],
"name" : "salt",
"defaultValue" : "",
"isVarargs" : false,
"argType" : "String",
"description" : "The salt to use as input to the hashing function.\nThe salt will be hashed first followed by the value.",
"isOptional" : true
} ],
"description" : "Generates a hash of the supplied value using the named hash algorithm.\nThe SHA-256 algorithm will be used if not supplied.\n\nYou can optionally supply a salt value to prepend to the hash.",
"category" : [ ]
} ]
}
18 changes: 18 additions & 0 deletions assets/data/xslt-functions/random.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name" : "random",
"aliases" : [ ],
"commonCategory" : [ "Value" ],
"helpAnchor" : "",
"commonSubCategories" : [ ],
"commonDescription" : "Generates a random number greater than 0.0 and less than 1.0.",
"commonReturnType" : [ "Decimal" ],
"commonReturnDescription" : "The random number.",
"signatures" : [ {
"subCategories" : [ ],
"returnDescription" : "",
"returnType" : [ ],
"args" : [ ],
"description" : "",
"category" : [ ]
} ]
}
21 changes: 21 additions & 0 deletions assets/scss/_styles_project.scss
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,27 @@ span.key-bind {
}


/* Function signatures used in xslt-functions page for example */
p.function-definition-signature {
margin-top: 1.5em;

span code {
font-size: 1.2em;
font-weight: 900;
//line-height: 2em;
color: $code-color;
background: unset;
padding-left: unset;
letter-spacing: -0.04em;

span.function-definition-signature-arg {
font-weight: 500;
color: var(--blue-900);
}
}
}


/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Auto numbering start
Expand Down
7 changes: 6 additions & 1 deletion config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -319,4 +319,9 @@ latexDashes = true
disable = false
[[module.imports]]
path = "github.com/google/docsy/dependencies"
disable = false


# This is needed so we can read json files in the data dir
# [[module.mounts]]
# source = 'data'
# target = 'data'
93 changes: 93 additions & 0 deletions content/en/docs/reference-section/xslt-functions/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
title: "XSLT Functions"
linkTitle: "XSLT Functions"
#weight:
date: 2025-09-24
tags:
description: >
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 {{< pipe-elm "XSLTFilter" >}} [pipeline]({{< relref "docs/user-guide/pipelines" >}}) 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.

```xml
<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.

```xml
<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

{{< cardpane >}}

{{< card header="Conversion Functions" >}}
* [hash](conversion#hash)
{{< /card >}}

{{< card header="Date Functions" >}}
* [](date#)
{{< /card >}}

{{< card header="Network Functions" >}}
* [](network#)
{{< /card >}}

{{< card header="Other Functions" >}}
* [](other#)
{{< /card >}}

{{< /cardpane >}}

{{< cardpane >}}

{{< card header="Stroom Pipeline Functions" >}}
* [](pipeline#)
{{< /card >}}

{{< card header="String Functions" >}}
* [](string#)
{{< /card >}}

{{< card header="URI Functions" >}}
* [](uri#)
{{< /card >}}

{{< card header="Value Functions" >}}
* [random](value#random)
{{< /card >}}

{{< /cardpane >}}
17 changes: 17 additions & 0 deletions content/en/docs/reference-section/xslt-functions/conversion.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: "Conversion Functions"
linkTitle: "Conversion Functions"
#weight:
date: 2025-09-25
tags:
description: >
Functions for converting a value from one form to another, e.g. hexToString.
---

<!--
The xslt-func shortcode outputs all the XsltFunctionDef annotation content for the function.
You can add any additional content for the function (e.g. examples) underneath the shortcode call.
-->

## hash
{{< xslt-func "hash" >}}
14 changes: 14 additions & 0 deletions content/en/docs/reference-section/xslt-functions/date.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: "Date/Time Functions"
linkTitle: "Date/Time Functions"
#weight:
date: 2025-09-25
tags:
description: >
Functions for date/time parsing and manipulation.
---

<!--
The xslt-func shortcode outputs all the XsltFunctionDef annotation content for the function.
You can add any additional content for the function (e.g. examples) underneath the shortcode call.
-->
15 changes: 15 additions & 0 deletions content/en/docs/reference-section/xslt-functions/network.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: "Network Functions"
linkTitle: "Network Functions"
#weight:
date: 2025-09-25
tags:
description: >
Functions relating to networking (host names, IP addresses, etc.) or making remote calls.
---

<!--
The xslt-func shortcode outputs all the XsltFunctionDef annotation content for the function.
You can add any additional content for the function (e.g. examples) underneath the shortcode call.
-->

15 changes: 15 additions & 0 deletions content/en/docs/reference-section/xslt-functions/other.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: "Other Functions"
linkTitle: "Other Functions"
#weight:
date: 2025-09-25
tags:
description: >
Functions that don't fit into any other category.
---

<!--
The xslt-func shortcode outputs all the XsltFunctionDef annotation content for the function.
You can add any additional content for the function (e.g. examples) underneath the shortcode call.
-->

17 changes: 17 additions & 0 deletions content/en/docs/reference-section/xslt-functions/pipeline.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: "Stroom Pipeline Functions"
linkTitle: "Pipeline Functions"
#weight:
date: 2025-09-25
tags:
description: >
Functions for obtaining information about the current pipeline process.
---

<!--
The xslt-func shortcode outputs all the XsltFunctionDef annotation content for the function.
You can add any additional content for the function (e.g. examples) underneath the shortcode call.
-->

## bitmap-lookup
{{< xslt-func "bitmap-lookup" >}}
15 changes: 15 additions & 0 deletions content/en/docs/reference-section/xslt-functions/string.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: "String Functions"
linkTitle: "String Functions"
#weight:
date: 2025-09-25
tags:
description: >
Functions for string parsing and manipulation.
---

<!--
The xslt-func shortcode outputs all the XsltFunctionDef annotation content for the function.
You can add any additional content for the function (e.g. examples) underneath the shortcode call.
-->

15 changes: 15 additions & 0 deletions content/en/docs/reference-section/xslt-functions/uri.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: "URI/URL Functions"
linkTitle: "URI Functions"
#weight:
date: 2025-09-25
tags:
description: >
Functions relating to parsing and manipulating URI/URLs.
---

<!--
The xslt-func shortcode outputs all the XsltFunctionDef annotation content for the function.
You can add any additional content for the function (e.g. examples) underneath the shortcode call.
-->

Loading