---
title: "Fix XML <// in Log to File & #if in CreateTextTemplate"
description: "Fix extra forward slashes (<//) in aggregated XML caused by Log to File's default escape character, and write #if conditions without parentheses in…"
url: https://kiweely.com/guides/workday-orchestrate-xml-double-slash-log-to-file-if-conditions
---

# Why Log to File Turns XML Closing Tags into <// and How to Write #if Conditions in CreateTextTemplate

Viewing aggregated XML through a Log to File step in Workday Orchestrate turns every closing tag ‘</’ into ‘<//’ because Log to File defaults its CSV escape character to ‘/’. Use Store Document for XML files, and omit outer parentheses around #if conditions in CreateTextTemplate.

-   **Checked** against Workday on November 6
-   Applies to **Workday Orchestrate**
-   3 min read
-   Published November 6
-   By Kiweely

## Why Aggregated XML Shows Double Forward Slashes (`<//bsvc:ID>`) in Output Files

When building a Workday SOAP payload inside a **Loop** (for example, generating `<bsvc:Enter_Time_Off_Data>` fragments in a **Create Text Template** and combining them with a Loop **Aggregation**), developers often attach a **Log to File** step to inspect the aggregated XML on the integration event. Opening the resulting log file reveals doubled forward slashes (`<//`) in every XML namespace URI and closing tag:

xml

```
<bsvc:Import_Time_Off_Request_Event_Batch_Request xmlns:bsvc="urn:com.workday//bsvc">
  <bsvc:Enter_Time_Off_Data>
    <bsvc:Worker_Reference>
      <bsvc:ID bsvc:type="Employee_ID">123456<//bsvc:ID>
    <//bsvc:Worker_Reference>
  <//bsvc:Enter_Time_Off_Data>
<//bsvc:Import_Time_Off_Request_Event_Batch_Request>
```

### Root Cause: `Log to File` Default CSV Escape Character Is `/`

The **Loop Aggregation** did **not** corrupt your XML. As documented in **Reference: Log to File**, the **Log to File** component always formats its output as a **CSV document** using three default special characters when no custom CSV format is selected:

-   **Separator:** `,`
-   **Escape character:** `/`
-   **Quote character:** `"`

Because the default CSV escape character in **Log to File** is `/`, the CSV serializer escapes every literal `/` character inside the logged XML string by doubling it to `//`!

### Why `.toString().replace("//", "/")` Does Not Fix It (and Risks Memory Failures)

Adding a **Create Values** step before **Log to File** that calls `xmlData.toString().replace("//", "/").asXML()` does **not** remove the `<//` in the output file, because the single `/` characters are still re-escaped to `//` at the moment **Log to File** writes the CSV row. Worse, converting a large aggregated `Xml` stream into an in-memory `String` via `.toString().replace(...)` bypasses Orchestrate’s streaming XML handler and can exceed string memory limits on large batches.

### Two Clean Fixes for Inspecting or Storing Aggregated XML

1.  **Use `Store Document` Instead of `Log to File` for XML Payloads (Recommended):** Replace **Log to File** with a **Store Document** component. Set **Document to Store** to your aggregated XML output (`data.LoopTransactions.AggregatedXml`) and **Document Title** to `"BatchPayload.xml"`. **Store Document** writes the raw `Xml` stream directly to the integration event without CSV escaping.
2.  **Override the Escape Character in a Custom CSV Format (If Logging XML Inside a CSV Column):** If you intentionally want to embed an XML snippet inside a multi-column **Log to File** CSV audit table, go to **Orchestration Settings > CSV Formats**, create a custom CSV format with the **Escape** character changed from `/` to `\`, and select that **Format** on your **Log to File** step.

Also ensure each upstream **Create Text Template** that produces an XML fragment has its **Content Type** set to `application/xml` or `text/xml`; when the template output is already typed as XML, you do not need to append `.asXML()` repeatedly.

* * *

## Writing `#if` Conditions Without Parentheses in `CreateTextTemplate`

When conditionally including XML elements inside a **Create Text Template** (`CreateTextTemplate`), wrapping the boolean expression after `#if` in round parentheses `( ... )` or adding nested curly braces causes a template compilation error:

handlebars

```
{{!-- INVALID — outer parentheses around the #if condition fail to compile --}}
{{#if (data.cvGovIDvalues.workerHasNoTFN == false)}}
  <bsvc:Tax_File_Number>{{data.cvGovIDvalues.tfn}}</bsvc:Tax_File_Number>
{{/if}}
```

### Valid `#if` Syntax in `CreateTextTemplate`

As specified in **Concept: Text Templates**, `CreateTextTemplate` requires the syntax `{{#if boolean_expression}} ... {{/if}}` **without** outer parentheses around the condition:

#### 1\. Checking a Boolean Variable (`true` vs. `false`)

To render an XML block when a boolean variable is `true`:

handlebars

```
{{#if data.cvGovIDvalues.workerHasNoTFN}}
  <bsvc:Tax_File_Number>{{data.cvGovIDvalues.tfn}}</bsvc:Tax_File_Number>
{{/if}}
```

To render the XML block only when the boolean variable is `false`, either negate it with `!` or compare directly against `false` without parentheses:

handlebars

```
{{#if data.cvGovIDvalues.workerHasNoTFN == false}}
  <bsvc:Tax_File_Number>{{data.cvGovIDvalues.tfn}}</bsvc:Tax_File_Number>
{{/if}}
```

#### 2\. Compound `&&` and `||` Conditions on Strings in XML Templates

You can combine `.isEmpty` checks and string inequality comparisons using `&&` or `||` directly inside `{{#if ...}}` without parentheses:

handlebars

```
{{#if data.SupplierValues.AddressLine2.isEmpty == false && data.SupplierValues.AddressLine2 != "NA"}}
  <wd:Address_Line_Data wd:Type="ADDRESS_LINE_2">{{data.SupplierValues.AddressLine2.escapeXml()}}</wd:Address_Line_Data>
{{/if}}
```

* * *

## Verifying XML Output and Conditional Tags in Your Tenant

1.  In **Orchestration Builder**, validate your **Create Text Template** step with conditional `{{#if ...}}` blocks and run **DebugOrchestrations** with both `true` and `false` test inputs to verify that optional XML tags are omitted cleanly when the condition is false.
2.  Attach a **Store Document** step (or inspect the aggregated XML directly in the debugger step output panel rather than a default **Log to File** CSV) and confirm all closing XML tags render with a single slash (`</bsvc:ID>`).

## Sources checked

-   [Reference: Log to File](https://developer.workday.com/documentation/GUID-fdeeaa27-ede6-442e-87f1-8487f44a3db9)
-   [Reference: Store Document](https://developer.workday.com/documentation/GUID-711d1624-0e00-45a4-98bd-38bf4b9c4419)
-   [Concept: Text Templates](https://developer.workday.com/documentation/GUID-e2785ee9-6d55-4f43-b375-a2e546da6503)
-   [Reference: Create Text Template](https://developer.workday.com/documentation/GUID-b77cf126-1a39-43a6-9661-c12e626969e4)
-   [Add Aggregations](https://developer.workday.com/documentation/GUID-6f98991a-326a-4fc7-9085-e3d9132f1cba)

## Related guides

[All guides](https://kiweely.com/guides)

-   [### Reading Integration Launch Attachments, Calling SOAP Integrations API, and Uploading ZIPs to Workday Drive in O4I In Orchestrate for Integrations (O4I), read launch files via an Integration Retrieval Service (‘Attach file at launch’) and documents.get(0). For Get\_Event\_Documents over SOAP, use /soap/v46.2/Integrations with .wrapSoapV11(), and test Workday Drive ZIP uploads outside Debug Mode.](https://kiweely.com/guides/workday-orchestrate-read-integration-attachment-retrieval-service)
-   [### Generating UUIDs with random.randomUUID() and Fixing stringAtJsonPath().toNumber() in Orchestrate Workday Orchestrate uses random.randomUUID() instead of PMD’s UUID() function to generate unique batch IDs, and requires chaining .toNumber() on the outer stringAtJsonPath() function rather than inside the JSONPath literal.](https://kiweely.com/guides/workday-orchestrate-randomuuid-stringatjsonpath-tonumber)
-   [### Why stripHtmlTags and htmlToPlainText Leave HTML Tags Over 2,003 Characters in Workday Orchestrate In Workday Orchestrate, stripHtmlTags and htmlToPlainText can silently leave individual HTML tags of 2,003 or more characters—such as inline base64 <img> tags—unaltered. Strip oversized base64 tags or use proper XML/HTML escaping before sending rich text downstream.](https://kiweely.com/guides/workday-orchestrate-striphtmltags-2003-character-limit)
-   [### Sorting JsonKeyValueIterator Collections and Numeric String Values in Workday Orchestrate Loops Workday Orchestrate fails at build time when sorting a JsonKeyValueIterator loop by item.key(), and sorts numeric strings lexicographically (‘1’, ‘1000’, ‘3’). Use a two-loop key extraction pattern for JSON objects and cast string IDs with toNumber() in Loop Sort By.](https://kiweely.com/guides/workday-orchestrate-sort-jsonkeyvalueiterator-numeric-sorting)

### More guides on Orchestrate

[All 86 guides](https://kiweely.com/guides#orchestrate)

-   [Waiting for Import\_Payroll\_Input\_Request Background Processes at Scale in Workday Orchestrate](https://kiweely.com/guides/workday-orchestrate-wait-background-process-import-payroll-input)
-   [Why Workday sub-orchestrations and BP orchestrations show Completed when an API call fails](https://kiweely.com/guides/workday-orchestrate-sub-orchestration-completed-on-api-error)
-   [Why SendWorkdayRaasRequest returns 401 Unauthorized or empty data via the cloud proxy](https://kiweely.com/guides/workday-orchestrate-sendworkdayraasrequest-401-cloud-proxy)
-   [Reusing and versioning sub-orchestrations across Workday Extend and O4I apps](https://kiweely.com/guides/workday-orchestrate-reuse-sub-orchestrations-across-apps)
-   [Picking up SFTP files from subfolders and reading IDs from PDF filenames in Orchestrate](https://kiweely.com/guides/workday-orchestrate-sftp-subfolders-pdf-files)
-   [Sending email from Orchestrate: the Connect sendMessage API and email connectors](https://kiweely.com/guides/workday-orchestrate-send-email)
-   [How to keep large Workday Orchestrate loads inside the runtime limits: templates, checkpoints, batches and child runs](https://kiweely.com/guides/workday-orchestrate-runtime-limit-large-loads)
-   [How to rebuild an XSLT transformation in Workday Orchestrate](https://kiweely.com/guides/workday-orchestrate-replace-xslt)

### From the blog on Orchestrate

[All posts](https://kiweely.com/blog)

-   [Orchestrate, an iPaaS, or Kiweely Roots](https://kiweely.com/blog/orchestrate-ipaas-or-kiweely-roots)
-   [Codex for Orchestration JSON: Catching the 25-Second Sync Trap Before Deploy](https://kiweely.com/blog/codex-orchestration-json-25-second-sync-trap)
-   [Keep in Studio, Move to Orchestrate, or Rebuild as an Extend App? A Practical Triage Matrix](https://kiweely.com/blog/migrating-legacy-workday-studio-integrations-to-orchestrate-decision-matrix)

## Let Workday check the work.

Kiweely writes WQL and builds orchestrations in your own tenant, and Workday, not Kiweely, says whether they passed.

[Start for free](https://kiweely.com/download) [See how it works](https://kiweely.com/vine/how-it-works)

## Get the next guide in your inbox.

One email a month with new guides and one Extend tip. Nothing else.
