Skip to main content

 Publishing

Publishing PageSeeder data to print, the Web or both

Task split

This task was introduced in PageSeeder version 5.9703.

Split a single PSML file into separate documents and fragments according to the rules defined in a split config file.

  • Only the content of <fragment> elements is preserved. The elements <section>/<title>, <anchor>, <xref-fragment>, <properties-fragment> and <media-fragment> and their content is removed.
  • Any attributes on <fragment> elements are removed and replaced by those defined in the split config file.

Definition

Minimal definition:

<ps:split src="[source]"
          dest="[destination]"
          config="[config]" />

 Full definition:

<ps:split src="[source]"
          dest="[destination]"
          config="[config]" 
          mediafolder="[folder name]"
          working="[working]" />

Attributes

AttributeDescriptionRequiredDefault
src

The path of the file to split. For example:

c:\psml\download\mydoc.psml

Yes
dest

The destination folder or the main file path (if a folder, the src filename is used for the main file). For example:

c:\psml\split

c:\psml\split\mysplitdoc.psml

Yes
config

The path of the split config file. For example:

psml-split-config.xml

Yes
mediafolderThe name of the folder under src that contains images (all images must be in the same folder)Noimages
working

The path of the working folder for the split. For example:

c:\psml\temp

No

Examples

Split when importing a DocX document as PSML

The following example is designed to run inside PageSeeder so uses ps- properties.
The word-import-config.xml should have:

  • No <split> element so that it produces a single PSML file.
  • A <references psmlelement="link" /> element under <elements><default> so that references are preserved as links to anchors (because fragments are not split yet).

The splitting is then done by the split task which is much faster and more flexible than the import-docx task. The attribute working="${temp-split}" is not required but can be useful when debugging the psml-split-config.xml to see the PSML at different stages of the split.

<property name="download"
          value="${ps-working}/download" />
<property name="output"
          value="${ps-working}/psml" />
<property name="split"
          value="${ps-working}/split" />
<property name="temp"
          value="${ps-working}/temp" />
<property name="temp-split" 
          value="${ps-working}/temp-split" />
...

<!-- replace spaces with underscores
     because import-docx does -->
<script language="javascript">
  project.setProperty("filename",
    project.getProperty("ps-uploadFilenameNoExt")
    .replaceAll(" ", "_").toLowerCase());
</script>

<psd:import-docx
          src="${download}/${ps-uploadPath}"
          dest="${output}"
          working="${temp}"
          config="word-import-config.xml" />
 
<ps:split src="${output}/${filename}.psml"
          dest="${split}"
          working="${temp-split}"
          config="psml-split-config.xml" />

Re-split an existing publication in PageSeeder

The following example is designed to run inside PageSeeder so uses ps- properties. The process task collects all the exported publication files into a single PSML file. The split task requires all images in a single folder so the line <images src="filename" location="${process}/images" /> is used to do this while preserving their filenames (-[n] is added if there is a name clash).

<property name="download"
          value="${ps-working}/download" />
<property name="process"
          value="${ps-working}/process" />
<property name="split"
          value="${ps-working}/split" />
<property name="temp-split"
          value="${ps-working}/temp-split" />
...

<ps:process src="${download}"
            dest="${process}"
            processed="false">
  <xrefs types="embed,transclude">
    <include name="${ps-uriFilenameNoExt}.psml"/>
  </xrefs>
  <images src="filename"
          location="${process}/images" />
</ps:process>
 
<ps:split
     src="${process}/${ps-uriFilenameNoExt}.psml"
     dest="${split}"
     working="${temp-split}"
     config="psml-split-config.xml" />

To preserve transcludes use <xrefs types="embed"> in the process task. This preserves the <blockxref type="transclude" ... > elements instead of replacing them with their content.

Created on , last edited on