Transform XML

Scripting call:
sOutFile = TransformXml (sPublication, sType, sXmlFile, sLocation)


Transform an XML file using formatting information generated during composition.

The publication must have a partition called Template. The properties of this partition are used to initialise the temporary partition.

If the output file is successfully created, the temporary partition is removed.

If the output cannot be generated, an empty string is returned. In this case the temporary partition is retained, and its name is stored in the Partition property. After investigating the cause of the error, you can use the RemovePartition method to remove it.

Note that any composition problems, including warnings, will prevent the output from being created, since the formatting information will be unreliable in this case.



The path to a publication, relative to the TopLeaf repository root. A temporary partition is created in this publication and the XML data in sXmlFile is linked to it.


A string identifying the type of transformation required, for example html or rtf.


The path to a file containing the XML data.


Determines where the output file is created:

  • If null or the empty string, the file is created in a directory designated for temporary files.

  • If it is the path to an existing directory, the file is created in this directory.

  • Otherwise, the file is created using sLocation as a path. Any existing file with this path will be overwritten.

Scripting Call Return

The return value is a string containing the path to the output file. This is always an absolute path. It is also available as the value of the OutputFile property.

If the output cannot be generated, an empty string is returned.


Scripting call:

file = topleaf.TransformXml("UserManual", "html", xmlFile, "C:\\Temp");