---
title: Add or Manage Stylesheet - Transform Messages for Log Views
description: Create and manage XSLT and Liquid Stylesheets that transform log messages into user-friendly formats for Log Views and alarm notifications. Learn to associate them with Message Types, preview the output, and allow embedded scripts.
---

# Add or manage Stylesheet

Transform logged messages into user-friendly formats for self-service [Log Views][] and alarm notifications.

A [Stylesheet][Stylesheets] is associated with one or more [Message Types][] to render user-friendly output for logged messages ([Log Events][Log Event]) and alert notifications sent by [Alarm Plugins][].

## :fa-diagram-project: Understanding the Stylesheet Editor

<div class="mermaid">
graph LR
    A["fa:fa-square-plus Add Stylesheet<br/>Name and Description"] --> B["fa:fa-code Type<br/>XSLT or Liquid"]
    B --> C["fa:fa-tags Associate<br/>Message Types"]
    C --> D["fa:fa-file-lines Message Body<br/>Raw input, File upload, or Message Id"]
    D --> E["fa:fa-eye Preview"]
    E --> F["fa:fa-save Save"]
    style A fill:#2678BD,color:#fff
    style B fill:#2678BD,color:#fff
    style C fill:#2678BD,color:#fff
    style D fill:#E47528,color:#fff
    style E fill:#E47528,color:#fff
    style F fill:#93d16d,color:#000
</div>

*Define the Stylesheet (blue), test it against sample data (orange), and save it (green) so Log Views and Alarm Plugins can use it.*

### Key Capabilities

* Transform XML messages with XSLT into HTML or other XML formats
* Transform JSON messages with Liquid templates
* Preview output before deploying to production
* Associate one stylesheet with multiple Message Types
* Customize display for both Log Views and email alerts

| Option | Best for | Input |
| --- | --- | --- |
| **XSLT** | XML messages and the alarm object of the Email Alarm Plugins | XML |
| **Liquid** | JSON messages, flat files, and the [Event Log Alarm Plugin][] | JSON, or the raw body as text |

## Stylesheets shipped with an Alarm Plugin

:new7.12:

The [Alarm Plugins][] ship their own Stylesheets: *Email Alarm Plugin*, *Email options Alarm Plugin*, and *Event Log Alarm Plugin*. They work like a shipped [Document Profile][Document Profiles]: they are read only and can never be deleted, and every upgrade of the plugin replaces their content. To change the alert e-mail, you clone the shipped Stylesheet, edit the clone, and select the clone on the Alarm Plugin entry.

![Find the shipped Stylesheets in the list, open Email options Alarm Plugin with its lock notice, preview the alert e-mail, and clone it to an editable copy, animated walkthrough (7.12)][18]  
*Animated walkthrough: from the **Shipped** badge in the list to an editable clone of *Email options Alarm Plugin*.*  

1. In the [Stylesheets Overview][], the shipped Stylesheets carry the **Shipped** badge, and their **Action** menu has no **Delete**.
2. Click *Email options Alarm Plugin*. The edit page shows the lock notice, and the fields and the template are read only.
3. Click **Message Body** and paste an alarm object, for example the [Alarm Plugin Object sample data][]: the preview shows the alert e-mail.
4. Click **Clone to customize** in the notice, or **Clone** in the header, then click **Duplicate**.
5. The clone opens, and you can edit it.

![Edit page of Email options Alarm Plugin with the notice Shipped by Nodinite: clone to customize, its Clone to customize button, and Clone in the header (7.12)][19]  
*The lock notice of a shipped [Stylesheet][Stylesheets]. Only its Message Type bindings can still be changed.*  

| What | On a shipped Stylesheet | On your clone |
| --- | --- | --- |
| Name, Description, Type, template | ❌ Read only | ✅ Editable |
| [Message Types][] and **Message Types By Name** | ✅ Can be changed: the bindings don't change the Stylesheet itself | ✅ Can be changed; a clone starts without bindings |
| **Delete** | ❌ No Delete, never deleted | ✅ Delete and Restore, like any Stylesheet |
| An [Alarm Plugin][Alarm Plugins] upgrade | ⚠️ Replaces the content, so direct edits would be lost | ✅ Keeps your content |
| [Preview](#preview-with-a-test-message-body) with **Message Body** | ✅ Works | ✅ Works |

**Clone Stylesheet** suggests the name *&lt;name&gt; (copy)*, and the clone's description says it is your copy of the shipped Stylesheet. Change the name if you keep several clones.

![Clone Stylesheet: Email options Alarm Plugin dialog with the suggested name Email options Alarm Plugin (copy) and the Duplicate button (7.12)][20]  
*Click **Duplicate** to create the clone and open it.*  

To use the clone, select it in the **Stylesheet** list on the **Basic** tab of the Alarm Plugin entry, for example an [Email with Options][] entry. A Stylesheet selected on the default entry is kept when :Nodinite: is updated. The [Web API][] answers `409` with *Stylesheet '…' cannot be edited. Shipped by Nodinite: clone to customize.* to a change of a shipped Stylesheet.

## Add Stylesheet

Click the 'Add stylesheet' button to create a new Stylesheet for use with selected [Message Types][].  

![Add Stylesheet button in the Stylesheets list][1]  
*The Add Stylesheet button sits in the upper right corner of the [Stylesheets Overview][].*  

![Add the Liquid Stylesheet Contoso - Invoice view with Render as HTML and a short template, then find it in the list, animated walkthrough (7.12)][14]  
*Animated walkthrough: a new Liquid Stylesheet, from **Add Stylesheet** to the list.*  

1. Click **Add Stylesheet**.
2. Enter the **Name** *Contoso - Invoice view* and a **Description**.
3. Choose the **Type** *Liquid*. A new Stylesheet starts as XSLT.
4. Tick **Render as HTML**. **Message Body is Json** is already checked for a new Liquid Stylesheet.
5. Paste the template: the invoice, the order, the customer, the lines, and the total.
6. Click **Save and close**. The new Stylesheet is in the list.

The **Add Stylesheet** form opens with these fields and options, top to bottom:

![Empty Add Stylesheet form with Name, Description, Type, Render as HTML, the Stylesheet editor, and the Message Types panels (7.12)][2]  
*A new [Stylesheet][Stylesheets] defaults to XSLT; only the Name is mandatory, and the Save buttons are greyed out on the empty form.*  

| Field or option | Where | Description |
| --- | --- | --- |
| **Name** \* | Main form | Mandatory name of the [Stylesheet][Stylesheets], shown in the Stylesheets list and when you pick a Stylesheet elsewhere. |
| **Description** | Main form | Optional details about the Stylesheet's purpose. |
| **Type** | Main form | The template language: **XSLT** (default) or **Liquid**, see [below](#xslt). |
| **Render as HTML** | Main form | Checkbox. When checked, the output is rendered as HTML. |
| **Message Body is Json** | Main form | Shown when **Type** is **Liquid**, and checked by default on a new Stylesheet. When checked, the message body is treated as JSON; when unchecked, it is available as `{{data}}`, see [Liquid](#liquid). |
| [Stylesheet][Stylesheets] | Main form | The code editor for the template (left pane) next to the rendered preview (right pane); drag the divider between them to resize. Above the editor sit the **Message Body** button, which opens the test message dialog (see [Preview with a test message body](#preview-with-a-test-message-body)), an icon for full-screen editing, and an icon that rotates the two panes between side by side and stacked. This split editor is shared across :Nodinite:: [Articles][], and the [BPM][BPMs] and [C4 Diagram][C4 Diagrams] views opened from a [Log View][Log Views], work the same way. |
| **Message Types** | Right panel | Click **Edit** to bind specific [Message Types][], see [Associate with Message Types](#associate-with-message-types). |
| **Message Types By Name** | Right panel | Click **Edit** to bind Message Types by a name pattern, see [Bind by name](#bind-message-types-by-name). |
| **Save**, **Save and close**, **Close** | Bottom right | **Save** keeps the editor open, **Save and close** returns to the list, and **Close** leaves the editor. The header also holds **Add Stylesheet**, **Save**, and :new7.12: **Clone**, which copies the Stylesheet, see [Stylesheets shipped with an Alarm Plugin](#stylesheets-shipped-with-an-alarm-plugin). |

Next, select the type of stylesheet. Currently, the following two formats are supported:

1. [XSLT](#xslt) - for XML transformations
2. [Liquid](#liquid) - for JSON transformations

![Type dropdown with the XSLT and Liquid options (7.12)][3]  
*The editor below the Type field switches to the selected language.*  

### XSLT

XSLT stands for E**X**tensible **S**tylesheet **L**anguage **T**ransformations, and is a style sheet language for XML documents.

Use **XSLT** to format **XML** messages into other XML formats or **HTML**. Set the output MIME type with `xsl:output`, see [Output Content-Type][Stylesheets Overview - Content-Type].

### Liquid

If the message body is **JSON** you can use [Liquid](https://github.com/dotliquid/dotliquid)<sup>:fa-arrow-up-right-from-square:</sup> instead of XSLT to produce your output. With **Message Body is Json** checked, :Nodinite: injects the JSON properties as Liquid variables; unchecked, the raw body is available as `{{data}}` (see [Line break an EDIFACT][] for an example).

>[!WARNING]
>A Stylesheet's JavaScript (script tags, event handlers, and `javascript:` links) runs only when the [StylesheetScriptsEnabled][] [System Parameter][System Parameters] is `true`, and :new7.12: always in an isolated frame that can't reach the [Web Client][]. With `false`, the default on a new installation (an upgrade keeps its value), the output shows without its scripts. `msxsl:script` blocks in XSLT never run in :Nodinite: 7.

## Associate with Message Types

Click one of the **Edit** buttons to open a new dialogue to enter one or more [Message Types][]. The include option by name (**Message Types By Name**, with `%` wildcards) is new with :Nodinite: version 7 :new7.x:.  

![Message Types panel with O2C.Order.Invoice/1.0 bound and the Message Types By Name panel with the filter O2C.Order.Invoice/%, each with Edit (7.12)][4]  
*Two ways to bind: **Message Types** one by one, here `O2C.Order.Invoice/1.0`, or **Message Types By Name**, here `O2C.Order.Invoice/%`. Each bound Message Type has an edit icon, [Show in Mapify][Mapify], and **Show in Mermaid**; click the red minus to remove a binding.*  

>[!TIP]
>Multiple [Message Types][] can be associated with the same [Stylesheet][Stylesheets].

![Bind O2C.Order.Invoice/1.0 to the Stylesheet Contoso - Invoice view, then every version of it by the name pattern O2C.Order.Invoice/%, animated walkthrough (7.12)][15]  
*Animated walkthrough: bound twice, to the invoice Message Type and to every version of it by name.*  

1. Open the Stylesheet. It isn't bound to any Message Type yet.
2. Click **Edit** on **Message Types**, find *O2C.Order.Invoice/1.0*, tick it, and click **Confirm and close**.
3. Click **Edit** on **Message Types By Name**, and type the pattern *O2C.Order.Invoice/%*. **Preview** lists *O2C.Order.Invoice/1.0*.
4. Click **Confirm and close**, then **Save**. Both cards show their binding.

### Bind specific Message Types

Click **Edit** on the **Message Types** panel to open **Assign Message Types to Stylesheet**.

![Assign Message Types to Stylesheet dialog filtered on O2C.Order, with the All and Selected tabs, Include deleted, and O2C.Order.Invoice/1.0 ticked (7.12)][5]  
*Filter the list of [Message Types][], check the ones the [Stylesheet][Stylesheets] should format, and click **Confirm and close**. The **Selected** tab shows what is bound.*  

### Bind Message Types by name

Click **Edit** on the **Message Types By Name** panel to open **Assign Message Types by name to Stylesheet**. A name filter also binds Message Types created later, as long as their names match.

![Assign Message Types by name to Stylesheet dialog with the filter O2C.Order.Invoice/%, the Add Filter button, and the Preview pane (7.12)][13]  
*Each filter uses the SQL `LIKE` operator, so `%` is a wildcard: `%test` matches every Message Type whose name ends with "test". **Preview** shows the first 10 Message Types that match the most recently changed or clicked filter.*  

1. Type a name or pattern in the filter box.
2. Click **Add Filter** to add more patterns; a Message Type that matches any filter is bound.
3. Check the matches in **Preview**, then click **Confirm and close**.

The pattern follows SQL `LIKE`, and the match ignores case:

* `%` matches any run of characters, so `O2C.Order.Invoice/%` matches every version.
* `_` matches exactly one character; write `[_]` for a literal underscore.
* `[abc]` and `[^abc]` match one character from, or not from, a set.
* Regular expressions don't work.

## Preview with a test message body

Test the [Stylesheet][Stylesheets] against a sample message before you save it. The editor shows the template on the left and the rendered output on the right; until you supply a message body, the right pane says *Please enter a **message body** to load the preview*.

![Stylesheet editor for the Liquid Stylesheet Contoso - Invoice view, bound to O2C.Order.Invoice/1.0 and by name to O2C.Order.Invoice/%, with the Message Body button above the two-pane editor (7.12)][6]  
*An existing Liquid Stylesheet. The preview pane stays empty until you load a message body.*  

![Load the Message Id of the ORD-10001 invoice as the test message body, and the editor renders the invoice, animated walkthrough (7.12)][16]  
*Animated walkthrough: a real logged invoice as the test message, and the rendered invoice in the editor.*  

1. Open the [Stylesheet][Stylesheets] (or start a new one) and click **Message Body** above the editor.

   ![Message Body button of the Stylesheet editor (7.12)][7]  
   *The button sits to the right of the **Stylesheet** label, next to the full-screen icon.*  

2. The **Edit Stylesheet** dialog opens with the template on the left. Under **Step 1 - Select data input**, choose where the test message comes from: **Raw input** (default), **File upload**, or **Message Id**.

   ![Edit Stylesheet dialog with Step 1 - Select data input set to Raw input and the Step 2 - Raw input text box (7.12)][8]  
   *With **Raw input**, paste the sample message into the **Step 2 - Raw input** box ("The message to preview").*  

3. Under **Step 2**, supply the message body for the option you chose:
   * **Raw input** – paste or type the message data.
   * **File upload** – click **Browse**, or drop one file on the drop zone, to load a file that contains the message data.
   * **Message Id** – pick a [Log Database][Log Databases] in **Select Log Database**, enter the **Message Id** of a logged message ([Log Event][]), and click **Get Message**. Use the event's Message Id, as the Log View shows it in the event details; an Event Id doesn't work. The message appears in **Message data**. The **locate in Admin view** link opens the [Admin view][Log Views list], which helps you find the Message Id.

   ![Step 2 - File upload with the Browse button, the drop zone, and No file selected (7.12)][9]  
   *Upload a sample file when the message is too large to paste.*  

   ![Message Id option with Step 2 - Message Id, Select Log Database, the Message Id field, Get Message, and the Message data box (7.12)][10]  
   *Fetch a real logged message to test the Stylesheet against production data.*  

4. Leave **Auto-close after input** checked to close the input menu and open the preview as soon as the message body is in place. Uncheck it to stay on the input steps.
5. Click **Preview** in the dialog header to switch from the message body input to the rendered output. The button then reads **Message Body**; click it to go back and change the message.

   ![Preview button in the header of the Edit Stylesheet dialog, next to the rotate, full-screen, and close icons (7.12)][11]  
   *The **Preview** button toggles the right side of the dialog between the message body and the rendered preview.*  

6. Click **Close** to return to the Stylesheet editor. The test message stays loaded, and the editor's right pane keeps rendering it as you change the template. **Confirm** and **Confirm and close** are active only after you change the template inside the dialog: they copy that edit to the editor.

>[!TIP]
>With [StylesheetScriptsEnabled][] set to `false`, the preview shows the output without the Stylesheet's scripts, so a chart drawn by JavaScript stays empty. A Stylesheet that calls an `msxsl:script` function shows *Error transforming message with Stylesheet: it calls a script (msxsl:script), and scripts in XSLT Stylesheets can't run in Nodinite 7.* Use the built-in functions instead. For ready-made templates to test with, see the [Stylesheet Examples][].

![The View message body formatted as dialog with the message that the Stylesheet calls an msxsl:script, which cannot run in Nodinite 7 (7.12)][17]  
*A Stylesheet that calls an `msxsl:script` function: the dialog explains why, instead of showing the formatted body.*  

## :fa-hand-point-right: Next Steps

* :fa-hard-drive: How to [Add or manage Log Views][Add or manage Log View]  
* :fa-bell: [Add or manage Alarm Plugin][]  
* :fa-code: [Stylesheet Examples][]  

## :fa-link-horizontal: Related Topics

* :fa-file: [Message Types][]  
* :fa-clone: [Stylesheets][]  
* :fa-list: [Stylesheets Overview][]  
* :fa-hard-drive: [Log Views][]  
* :fa-bell: [Alarm Plugins][]  
* :fa-gears: [StylesheetScriptsEnabled][]  
* :fa-database: [Log Databases][]  
* :fa-user: [See what happened to an order (Getting Started)][See what happened to an order]  

[1]:{ndm}/Documentation%20Pictures/IM/WebClient/Admin/Customize/Stylesheets/AddStylesheetButton.png
[2]:{ndm}/Documentation%20Pictures/IM/WebClient/Admin/Customize/Stylesheets/EmptyStylesheet.png
[3]:{ndm}/Documentation%20Pictures/IM/WebClient/Admin/Customize/Stylesheets/Type.png
[4]:{ndm}/Documentation%20Pictures/IM/WebClient/Admin/Customize/Stylesheets/BindToMessageTypesOptions.png
[5]:{ndm}/Documentation%20Pictures/IM/WebClient/Admin/Customize/Stylesheets/BindMessageTypes.png
[6]:{ndm}/Documentation%20Pictures/IM/WebClient/Admin/Customize/Stylesheets/ManageStylesheetModal.png
[7]:{ndm}/Documentation%20Pictures/IM/WebClient/Admin/Customize/Stylesheets/MessageBodyButton.png
[8]:{ndm}/Documentation%20Pictures/IM/WebClient/Admin/Customize/Stylesheets/MessageBody_Modal.png
[9]:{ndm}/Documentation%20Pictures/IM/WebClient/Admin/Customize/Stylesheets/MessageBody_FileUploadOption.png
[10]:{ndm}/Documentation%20Pictures/IM/WebClient/Admin/Customize/Stylesheets/MessageBody_MessageIDOption.png
[11]:{ndm}/Documentation%20Pictures/IM/WebClient/Admin/Customize/Stylesheets/PreviewButton.png
[13]:{ndm}/Documentation%20Pictures/IM/WebClient/Admin/Customize/Stylesheets/AssignMessageTypesByName.png
[14]:{ndm}/Documentation%20Pictures/IM/WebClient/Admin/Customize/Stylesheets/Stylesheet_Add.gif
[15]:{ndm}/Documentation%20Pictures/IM/WebClient/Admin/Customize/Stylesheets/Stylesheet_BindMessageTypes.gif
[16]:{ndm}/Documentation%20Pictures/IM/WebClient/Admin/Customize/Stylesheets/Stylesheet_Preview.gif
[17]:{ndm}/Documentation%20Pictures/IM/WebClient/Admin/Customize/Stylesheets/XsltScriptNotSupported.png
[18]:{ndm}/Documentation%20Pictures/IM/WebClient/Admin/Customize/Stylesheets/Stylesheet_ShippedLocked.gif
[19]:{ndm}/Documentation%20Pictures/IM/WebClient/Admin/Customize/Stylesheets/ShippedStylesheetNotice.png
[20]:{ndm}/Documentation%20Pictures/IM/WebClient/Admin/Customize/Stylesheets/CloneStylesheetDialog.png

[Add or manage Alarm Plugin]:{ndr}/Administration/5.%20Settings/1.%20Alarm%20Plugins/Features/Add%20or%20manage%20Alarm%20Plugin.md
[Add or manage Log View]:{ndr}/Administration/1.%20Log%20Management/1.%20Log%20Views/Features/Add%20or%20Manage%20Log%20View.md
[Alarm Plugin Object sample data]:{ndr}/Administration/4.%20Customize/2.%20Stylesheets/Examples/Alarm%20Plugin%20Object%20Sample%20Data.md
[Alarm Plugins]:{ndr}/Administration/5.%20Settings/1.%20Alarm%20Plugins/Features/What%20is%20an%20Alarm%20Plugin.md
[Articles]:{ndr}/Repository%20Model/Knowledge%20base%20Articles/Overview.md
[BPMs]:{ndr}/Repository%20Model/BPMs/Overview.md
[C4 Diagrams]:{ndr}/Repository%20Model/C4%20Diagrams/Overview.md
[Document Profiles]:{ndr}/Repository%20Model/Knowledge%20base%20Articles/Features/Document%20Profiles.md
[Email with Options]:{ndr}/Administration/5.%20Settings/1.%20Alarm%20Plugins/Features/Email%20with%20Options.md
[Event Log Alarm Plugin]:{ndr}/Administration/5.%20Settings/1.%20Alarm%20Plugins/Features/Event%20Log.md
[Line break an EDIFACT]:{ndr}/Administration/4.%20Customize/2.%20Stylesheets/Examples/Line%20break%20an%20EDIFACT.md
[Log Databases]:{ndr}/Core%20Services/Log%20Databases/Overview.md
[Log Event]:{ndr}/Core%20Services/Log%20Event/Overview.md
[Log Views]:{ndr}/Administration/1.%20Log%20Management/1.%20Log%20Views/Features/What%20is%20a%20Log%20View.md
[Log Views list]:{ndr}/Administration/1.%20Log%20Management/1.%20Log%20Views/Overview.md
[Mapify]:{ndr}/Mapify/Overview.md
[Message Types]:{ndr}/Repository%20Model/Message%20Types/Overview.md
[See what happened to an order]:{ndr}/Getting%20Started/Scenarios/Order%20flow/See%20what%20happened%20to%20an%20order.md
[Stylesheet Examples]:{ndr}/Administration/4.%20Customize/2.%20Stylesheets/Examples/Overview.md
[Stylesheets]:{ndr}/Administration/4.%20Customize/2.%20Stylesheets/Features/What%20is%20a%20Stylesheet.md
[Stylesheets Overview]:{ndr}/Administration/4.%20Customize/2.%20Stylesheets/Overview.md
[Stylesheets Overview - Content-Type]:{ndr}/Administration/4.%20Customize/2.%20Stylesheets/Overview.md#fa-file-code-output-content-type
[StylesheetScriptsEnabled]:{ndr}/Administration/5.%20Settings/5.%20System%20Parameters/StylesheetScriptsEnabled.md
[System Parameters]:{ndr}/Administration/5.%20Settings/5.%20System%20Parameters/Overview.md
[Web API]:{ndr}/Core%20Services/Web%20API/Overview.md
[Web Client]:{ndr}/Getting%20Started/Overview.md