# XPath

Get data in a XML document using XPath. Always returns a string even if it matches only one node. XPath lives in the **Custom** category of the `fx` menu. See [XPath](https://www.w3.org/TR/xpath-31/) for format details.

## Parameters

| Parameter           | Type    | Required | Default | Description                                                                          |
| ------------------- | ------- | -------- | ------- | ------------------------------------------------------------------------------------ |
| Input               | string  | yes      | —       | Value to transform. Previous step output or a literal.                               |
| Query               | string  | yes      | —       | The query string                                                                     |
| As value            | boolean | no       | —       | Return the match as value. Only work with last level node. Like a string for example |
| Unwrap single value | boolean | no       | `false` | Argument value.                                                                      |

`Input` is the primary value (previous step output or a literal).

## Returned value

| Type     | Description                         |
| -------- | ----------------------------------- |
| `string` | Result of the XPath transformation. |

## Example

<details>
<summary>Run XPath</summary>

Get data in a XML document using XPath. Adjust optional parameters when the defaults do not match your payload.

1. Set **Input** to the value to transform (previous step output or a literal).

2. Review **Query**, **As value**, **Unwrap single value** and keep defaults unless your format requires otherwise.

3. Confirm **Output value** shows the transformed result.

</details>
