---
title: "Task transform"
source: https://dev.pageseeder.com/guide/publishing/ant_api/tasks/task_transform.html
description: "The `ps:transform` task applies XSLT transformations to XML files in PageSeeder, converting source files to destination folders while maintaining structure. It supports file filtering, parameters, and single-file transformations while avoiding memory issues of standard ANT tasks."
last_updated: 2026-09-14T15:58:39+10:00
tokens: ~1023
---

# Task transform

*This task was introduced in PageSeeder version 5.9903.  
*

Applies an [XSLT](/reference/sample_code/xslt.md) transformation to files in the source folder (including all subfolders) and outputs them to the destination folder using the same folder structure. *In PageSeeder version 6.1 and higher the source can be a single file and if so the destination is also a file.*

> **Note:** Use this task instead of the ANT `<xslt>` task to avoid an “out of memory” error when transforming many files which is caused by a memory leak in the in-built ANT task. It also has better error logging when run inside PageSeeder.

## Definition

Minimal definition:

```xml

<ps:transform src="[source]"
              dest="[destination]"
              xslt="[XSLT file path]"/>
```

 Full definition:

```xml

<ps:transform src="[source]"
              dest="[destination]"
              xslt="XSLT file path]"
              moveall="[true|false]">
  <files>
    <include name="[name]" />
    <exclude name="[name]" />
  </files>
  <param name="[x]"
         expression="[y]" />
  ...
</ps:transform>
```

## Attributes

| **Attribute** | Description | Required | Default |
| --- | --- | --- | --- |
| **src** | The source folder/file path of the XML file(s) to transform. For example: `c:\working\downloadc:\working\myfile.xml` | Yes |  |
| **dest** | The destination folder/file path for the output file(s). For example: `c:\working\transformc:\working\mynewfile.xml` | Yes |  |
| **xslt** | Path to the XSLT file to apply. For example: `mytransform.xsl` | Yes |  |
| **moveall** | Whether to move all untransformed files to the destination folder (applicable when using the `<files>` element | No | `false` |

## Elements

The `<ps:transform>` element might contain a `<files>` element and multiple `<param name="x" expression="y" />` elements.

### Element \<files\>

Used to only transform only certain files in the `src` folder (not applicable to single source file).

This element might contain multiple nested `<include name="" />` or `<exclude name="" />` elements as defined in the following sections.

#### Element \<include\>

A pattern matching documents/folders to include. If not present, then **all** documents/folders are included.

| Attribute | Description | Required |
| --- | --- | --- |
| **name** | The pattern with format is similar to the file selection in other Ant tasks. Examples: `*.psml` `archive` `folder1/*.psml` `**/*.psml`  ????/\*```` | Yes |

#### Element \<exclude\>

A pattern matching documents/folders to exclude. If not present, then **no** documents/folders are excluded.

| Attribute | Description | Required |
| --- | --- | --- |
| **name** | The pattern with format is similar to the file selection in other Ant tasks. Examples: `_local/**` `_external/**` | Yes |

### Element \<param\>

Defines a parameter to pass to the XSLT transformation.

| Attribute | Description | Required |
| --- | --- | --- |
| **name** | The name of the parameter | Yes |
| **expression ** | The value expression | Yes |

## Examples

**Transform all files  
**

The following example transforms all files in the `export` folder.

```xml
<ps:transform src="c:\working\export"
              dest="c:\working\transform"
              xslt="mytransform.xsl" />
```

**Only transform certain folders and use parameters  
**

The following example only transforms PSML files but moves all files (for example graphics) to the destination and also passes two parameters to the XSLT.

```xml
<ps:transform src="c:\working\export"
         dest="c:\working\transform"
         xslt="mytransform.xsl"
         moveall="true">
  <files>
    <include name="**.psml" />
  </files>
  <param name="color"
         expression="red" />
  <param name="format"
         expression="simple" />
</ps:transform>
```

**Transform single file  
**

The following example transforms the file `manifest.xml` into the file `refs.psml`.

```xml
<ps:transform src="c:\working\export\manifest.xml"
              dest="c:\working\transform\refs.psml"
              xslt="mytransform.xsl" />
```

