---
title: "Create document and attribute transformers"
slug: "create-document-and-attribute-transformers"
abstract: "How to create document and attribute transformers to use in sources in Sitecore Search."
---
# Create document and attribute transformers

Structured data like CSV, XML, and JSON, are objects or a list of objects. In Sitecore Search, you can use transformers on feed crawlers, API crawlers, advanced web crawlers, or API push sources. [Transformers](https://doc.sitecore.com/search/en/users/search-user-guide/index-items/additional-configurations-and-settings/transformers.html "Transformers") can access properties at the document level or those of every object in a list of objects.

There are two types of transformers:

- Document transformer
- Attribute transformer

## Add a document transformer

Document transformers can access properties at the document level and manipulate their values before assignment.

To add a document transformer:

1. On the menu bar, click **Sources** ![module.png](https://doc.sitecore.com/api/markdown-image/search/en/users/search-user-guide/images/module.png) and, on the **Source Settings** tab, in the left pane, click **Transformations**.
2. In the **Transformations** section, click ![pencil_grey.png](https://doc.sitecore.com/api/markdown-image/search/en/users/search-user-guide/images/pencil_grey.png) **Edit**.
3. Click ![Plus_add__grey.png](https://doc.sitecore.com/api/markdown-image/search/en/users/search-user-guide/images/Plus_add__grey.png) **Add Transformation**.
4. In the **Transformer Type** drop-down list, click one of the following options:
    - *HTML* - to transform a document using HTML functions.
    - *JavaScript* - to transform a document using a JavaScript function.
5. If you select the transformer type *HTML*, do the following:
    - In the transformation **Type** drop-down list, click **Escape** or **Unescape**.
    - In the **Fields** field, to add a field or tag, click ![Plus_add__grey.png](https://doc.sitecore.com/api/markdown-image/search/en/users/search-user-guide/images/Plus_add__grey.png) **Add Item** then, in the input field, enter a field name or a comma separated list of fields.
    - To add more fields, repeat the previous step and, when you have finished, click **Save**.
6. If you select the transformer type *JavaScript*, do the following:
    - (Optional) In the **Function Name** input field, enter a function name.
    - In the **JS Source** code input field, add valid JavaScript code and then click **Save**.
7. Click **Save**.

## Add an attribute transformer

Attribute transformers can access the same property of every object in a list and manipulate their property values before indexing the objects as entities.

To add an attribute transformer:

1. On the menu bar, click **Sources** ![module.png](https://doc.sitecore.com/api/markdown-image/search/en/users/search-user-guide/images/module.png) and select a source.
2. On the **Source Settings** tab, in the left pane, click **Transformations**.
3. In the **Transformations** section, click ![pencil_grey.png](https://doc.sitecore.com/api/markdown-image/search/en/users/search-user-guide/images/pencil_grey.png) **Edit**.
4. In the **Attribute Transformations** section, click ![Plus_add__grey.png](https://doc.sitecore.com/api/markdown-image/search/en/users/search-user-guide/images/Plus_add__grey.png) **New**.
5. In the **Attribute Name** input field, enter the name of the CSV column or JSON property.
6. In the **Transformations** section, click ![Plus_add__grey.png](https://doc.sitecore.com/api/markdown-image/search/en/users/search-user-guide/images/Plus_add__grey.png) **Add Transformation**.
7. In the **Add Transformation** dialog, in the **Transformation Type** drop-down list, select an option.

    For transformation type details, after selection, hover your mouse over the **Transformation Type** field label.

    > [!important]
    > Selecting *Javascript* transforms an attribute value using a JavaScript function that can access all the attribute values.

8. For the transformation type you selected, enter values for all the required fields and click **Save**.
9. Click **Save**.