---
title: "Adding Metadata to Exported Documents"
slug: "adding-a-header-or-footer-to-documents-in-a-document-export-query"
updated: 2026-02-25T23:07:54Z
published: 2026-02-25T23:07:54Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://knowledge.technolutions.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Adding Metadata to Exported Documents

Third-party systems sometimes require document metadata to be included on the document itself, rather than in an associated index file.

To satisfy this requirement, we can add required information to the `pdf:xml` export in the [document export query.](/v1/docs/creating-a-document-export-query-with-configurable-joins)

## Step 1: Building the standard parts of the `pdf:xml` subquery export

Start by recreating the standard portions of the `pdf:xml` export.

1. In a [document export query](/v1/docs/creating-a-document-export-query-with-configurable-joins), select **Subquery**.

[![Subquery Button](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/subquery_button.png)](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/subquery_button.png)
2. Set the following configurations:
  - **Name**: `pdf:xml`
  - **Output**: XML
  - **Node**: `batch`
3. In the **Exports** area, click the **Export** button. An **Insert Query Part** popup appears. [![Edit Part Subquery Export](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/edit_part_subquery_export.png)](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/edit_part_subquery_export.png)
4. In the Direct Exports section, under the Document category, select **Record GUID.**
5. Click **Continue**. The export now appears on the Edit Part popup. [![GUID Export Selected](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/12626369768347.png)](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/12626369768347.png)
6. Hover over the Document Record GUID export and select the **Edit**(pencil) icon. An Edit Part popup appears. [![Edit Export Name](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/12626409235227.png)](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/12626409235227.png)
7. Change the Name value to `@id` and click **Save**. The export is renamed on the Edit Part popup. [![Rename Export](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/12626414407067.png)](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/12626414407067.png)
8. In the Exports area, to the right of the Export and subquery export buttons, click the **Literal**button. An Edit Part popup appears. [![Literal Button](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/literal_button.png)](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/literal_button.png)
9. Set the following values:
  - **Name:**`@mode`
  - **Literal:**`stream` [![Add Literal](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/add_literal_export.png)](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/add_literal_export.png)
10. Click **Save**. The literal appears on the Edit Part popup.
11. In the Exports section, select **Export**button. An **Insert Query Part**popup appears. [![Export Button](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/export_after_literal.png)](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/export_after_literal.png)
12. In the Direct Exports section, under the Document category, select **Scope**.
13. Click **Continue**. The export now appears on the Edit Part popup. ![](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/image-GN6PQ4T4.png)
14. Hover over the **Document Record Scope**export and select Edit. An Edit Part popup appears. [![](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/12626479325979.png)](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/12626479325979.png)
15. Change the Name value to `@scope` and click **Save**. The renamed export appears on the Edit Part popup. [![](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/12626514033947.png)](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/12626514033947.png)
16. In the Exports section, click the Export button. An Insert Query Part popup appears. [![Export Button](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/12626553530523.png)](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/12626553530523.png)
17. In the Direct Exports section, under the Document category, select **XML**.
18. Click **Continue**. The export now appears on the Edit Part popup. [![XML Export Selected](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/xml_export_selected.png)](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/xml_export_selected.png)
19. Hover over the **Document XML export**and select **edit**. An Edit Part popup appears. [![Edit XML Export](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/12626573662875.png)](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/12626573662875.png)
20. Change the Name value to `node()` and click **Save**. The renamed export appears on the Edit Part popup. [![Rename XML Export](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/rename_xml_export.png)](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/rename_xml_export.png)
21. Click **Save**to complete and save the query. [![Saving Subquery Export](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/12626611812123.png)](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/12626611812123.png)

## Step 2: Adding an `@header` attribute with desired metadata

Before adding the `@header` attribute to your `pdf:xml` export, consider which data needs to be included, and ensure that the joins to access the data are configured appropriately. See [Configurable Joins - Joining documentation](/v1/docs/joins) for more information.

Though we are adding a `@header` attribute to our `pdf:xml` export, this data appears only within the footer of the resulting document.

1. Open the **pdf:xml Subquery Export**created above.
2. Add a nested Subquery Export by selecting the **Subquery**icon next to the Export button:
  - **Name**: `@header`
  - **Output**: Concatenate

![](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/image-0A6Q7LCI.png)
3. Add the desired data with literal separators as needed for readability.

![](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/image-12RAIK8G.png)
4. Save the `@header` nested subquery export.

![](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/Save @header nested subquery export.png)
5. Reorder the exports within the `pdf:xml` subquery export so that the `node()` export is at the bottom.

![](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/image-421N527G.png)
6. Save the `pdf:xml` subquery export.

[![pdfxml_export_complete_full_query.png](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/pdfxml_export_complete_full_query.png)](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/pdfxml_export_complete_full_query.png)
