Make Partition

Command line:
tlapi [‑l] ‑cMKPART [‑rsRel] ‑isInFile sPart sPprop [sTprop]
Library call:
nStatus = TLmkpart (sPart, sPprop, sTprop, sRel, sInFile, nCopy)
Scripting call:
nStatus = MakePartition (sPublication, sPartName, sTemplate, sInFile, bLink)

Function

Create a new partition.

Overview

A TopLeaf partition consists of a source document and a set of partition properties. Partition properties determine how TopLeaf will process the partition document. Partition properties can only be assigned from a TopLeaf workstation.

Partitions that share a common set of style sheet are known as a TopLeaf publication. Publication style sheets specify the page layout and tag mapping rules used when a partition is rendered by the TopLeaf composition engine. Style sheet and tag mapping rules can only be declared from a TopLeaf Workstation.

Before you can use the TopLeaf API to create new partitions you must use TopLeaf Workstation to create a publication style sheet and a template partition that references those style sheets.

Arguments

sPart

The path to the new partition. The partition must not already exist. This function will return an error if you create a partition that specifies a reference to an undefined TopLeaf style sheet, DTD, or OASIS catalog file.

A partition cannot be created in the root directory of a TopLeaf repository.

sPprop

The full pathname to a partition properties file. If you are using the command line or library API interface, pass the pathname of the part.ind file located in the template partition folder.

sTprop

The full pathname to a typesetting properties file. If you are using the command line or library API interface, pass the pathname of the typeset.ind file located in the template partition's 000 (initial) folder.

This parameter must be specified when creating a full looseleaf partition if you intend to set the initial page types, the page folio style, or the partition and leaf indicators.

For the library call, pass NULL to use the default typesetting indicators.

sInFile

The absolute or relative pathname of the data file to be loaded into the partition.

sRel

Specifies a release label to be assigned to the initial phase of the new partition.

For the library call, pass NULL to leave the release label empty.

nCopy

Controls whether the data file is linked or copied:

  • 0 = file is linked. The partition contains a pointer to the original file.

  • 4 = file is copied. A copy of the file is made and placed in the partition.

sPublication

This applies to the scripting interface only. The path to an existing publication (relative to the repository root).

sPartName

This applies to the scripting interface only. The name of the new partition. If this is the empty string a unique name will be generated.

Note that this is a name, not a path, so it must not contain “/” or "-" characters.

sTemplate

This applies to the scripting interface only. The name of an existing partition in the publication. The properties of this partition are used to initialise the new partition. If this is the empty string the partition named Template is used.

bLink

This applies to the scripting interface only. If this is true the new partition has a link to the file, otherwise the file is copied into the new partition.

-l

This applies to the command line interface only. If this flag is present, the new partition has a link to the file, otherwise the file is copied into the new partition.

For additional command line arguments see “Common Flag Arguments”.

Scripting Call Return

The return value is zero if the partition was successfully created, or one of the values listed in Status Codes if not. If successful, the Partition property is set to the path of the new partition and the Phase property is set to CURRENT.

Notes

It is recommended, but not essential, that you create new partitions within the template partition's publication folder. In the case where the target publication folder differs from the template publication folder then:

  • If the target publication folder declares a set of TopLeaf style sheets, the new partition will use the style sheets declared in the target publication folder. The publication style sheets referenced from the template partition will be ignored.

  • If the target publication folder does not declare a set of style sheet rules, then the new partition will reference the template partition style sheets using a full file path name. It is the user's responsibility to ensure that files (for example, graphics) referenced by the template publication style sheets can be resolved from the context of the new partition.

Examples

Command line:

tlapi ‑cMKPART ‑iC:\input.xml uguide/chap01 part.ind typeset.ind

Library call:

TLmkpart("uguide/chap01", "C:\\TopLeaf\\uguide\\Template\\part.ind", "C:\\TopLeaf\\uguide\\Template\\000\\typeset.ind", NULL, "C:\\Temp\\input.xml", 4L);

Scripting call:

status = topleaf.MakePartition("Manual", "NewPart", "", xmlFile, false);