Skip to main content

 Publishing

Publishing PageSeeder data to print, the Web or both

Task transform

This task was introduced in PageSeeder version 5.9903.

Applies an XSLT transformation to files in the source folder (including all subfolders) and outputs them to the destination folder using the same folder structure.

This task should be used 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.

Definition

Minimal definition:

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

 Full definition:

<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

AttributeDescriptionRequiredDefault
src

The source folder on the file system of the XML files to transform. For example:

c:\working\download

Yes
dest

The destination folder on the file system for the output files. For example:

c:\working\transform

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.

Nofalse

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.

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.

AttributeDescriptionRequired
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.

AttributeDescriptionRequired
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.

AttributeDescriptionRequired
nameThe name of the parameter.Yes
expression
The value expression.Yes

Examples

Transform all files

The following example transforms all files in the export folder.

<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.

<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>
Created on , last edited on