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. In PageSeeder version 6.1 and higher the source can be a single file and if so the destination is also a file.

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:

<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/file path of the XML file(s) to transform. For example:

c:\working\download
c:\working\myfile.xml

Yes
dest

The destination folder/file path for the output file(s). For example:

c:\working\transform
c:\working\mynewfile.xml

Yes
xslt

Path to the XSLT file to apply. For example:

mytransform.xsl

Yes
moveallWhether to move all untransformed files to the destination folder (applicable when using the <files> elementNofalse

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.

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 parameterYes
expression
The value expressionYes

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>

Transform single file

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

<ps:transform src="c:\working\export\manifest.xml"
              dest="c:\working\transform\refs.psml"
              xslt="mytransform.xsl" />
Created on , last edited on