Skip to main content

 Configuration

Configuration manual for PageSeeder

PSML Ant scripts

The build.xml Ant script files on the Publish Engine are used to import, export, publish and process PSML documents.

These files can be accessed by Administrators under the Administration menu > [project] > Template > Publish scripts.

Before scripts can be created, they must be configured using the Configure links on the Publish scripts page, see the <publishing> element.

The Publish scripts page creates scripts with the following path:

[project template]/[source type]/[source extension/][action type]/build.xml

or for scripts specific to a PSML document type:

[project template]/psml/[document type]/[action type]/build.xml

or for scripts specific to a URL type:

[project template]/url/[URL type]/[action type]/build.xml

where project template must be the same one that the publish-config.xml, document-config.xml or url-config.xml files are under. URL scripts can only be defined under the global template.

Examples

myproject/document/psml/export/build.xml
myproject/document/docx/upload/build.xml
myproject/batch/process/build.xml
myproject/folder/publish/build.xml
myproject/group/export/build.xml
myproject/psml/mytype/publish/build.xml
myproject/url/mytype/process/build.xml

Details

PSML Ant scripts have the following characteristics:

  1. They do not need to clear the working folder at the start as is it is cleared automatically before the script is run.
  2. They do not need to clear the working folder after running as it is cleared automatically after 72 hours. Also any files in the output folder ${ps.config.default.web.root}/session are cleared after 12 hours.
  3. They can access user input  parameters using ${ps.param.[name]}.
  4. They should reference PageSeeder properties using ${ps.config.default.*}.
  5. They should only use non-deprectaed PageSeeder Ant tasks (i.e. not prefixed by ps-) and the only configuration required is <project ... xmlns:ps="antlib:com.pageseeder.publishapi.ant"> :
    1. Task config
    2. Task export
    3. Task process
  6. They might also use the following Ant extensions which are now included in the Publish Engine lib so only require the following configuration <project ... xmlns:psd="antlib:org.pageseeder.docx.ant" xmlns:psp="antlib:org.pageseeder.pdf.ant"> :
    1. ps-ant-docx
    2. ps-ant-pdf

There is a memory leak in the ANT <xslt> task when transforming many files in the same call, so to avoid an “out of memory” error. As of Pageseeder v5.9903 use the Task transform instead, otherwise use the ANT <java> task as shown below.

<xslt basedir="${source-folder}"
    destdir="${dest-folder}"
    style="mytransform.xsl"
    extension=".xml">
  <param name="myparam" expression="${my-value}"/>
</xslt>

Should be changed to the following (however, note that this WILL NOT process sub-folders):

<java classname="net.sf.saxon.Transform">
  <arg value="-s:${source-folder}"/>
  <arg value="-o:${dest-folder}"/>
  <arg value="-xsl:${basedir}/mytransform.xsl"/>
  <arg value="myparam=${my-value}"/>
</java>

If the source files were .psml, then they become .psml.xml, so you might also require a <move> task to rename them to just .xml after the transform as shown below.

<move todir="${dest-folder}">
  <fileset dir="${dest-folder}"/>
  <mapper type="glob" from="*.psml.xml" to="*.xml"/>
</move>

 

Example

The following example exports a PSML document to PDF format.

<project name="document-psml-export" 
         xmlns:ps="antlib:com.pageseeder.publishapi.ant"
         xmlns:psp="antlib:org.pageseeder.pdf.ant">
  <target name="create-consolidated-pdf"
          description="Create PDF Document">    
    <ps:config />   
    <property name="download" 
              value="${ps.config.default.working}/download" />
    <property name="process" 
              value="${ps.config.default.working}/process" />
    <property  name="temp" 
               value="${ps.config.default.working}/temp" />
    <mkdir  dir="${download}"/>
    <mkdir  dir="${process}"/>
    <mkdir  dir="${temp}"/>
    <echoxml>
      <progress percent="1" />
    </echoxml>
    <ps:export src="${ps.config.default.uri.path}"
               dest="${download}" 
               xrefdepth="${ps.param.depth}">
      <xrefs types="embed,transclude"/>
    </ps:export>
    <echoxml>
      <progress percent="50" />
    </echoxml>
    <ps:process src="${download}"
                dest="${process}" 
                generatetoc="${ps.param.toc}">
      <xrefs types="embed,transclude">
        <include name="${ps.config.default.uri.filename.no.ext}.psml" />
      </xrefs>
      <number numberconfig="numbering-config.xml"  />
    </ps:process>
    <echoxml>
      <progress percent="80" />
    </echoxml>   
    <psp:export-pdf
     src="${process}/${ps.config.default.uri.filename.no.ext}.psml"
     dest="${ps.config.default.working}/${ps.config.default.uri.filename.no.ext}.pdf"
     working="${temp}"/>
    <copy
     todir="${ps.config.default.web.root}/session/${ps.config.default.session.folder}${ps.config.default.group.folder.no.prefix}/export"
     file="${ps.config.default.working}/${ps.config.default.uri.filename.no.ext}.pdf" />
    <echoxml>
      <displayUriPath>${ps.config.default.engine.url}/session/${ps.config.default.session.folder}${ps.config.default.group.folder.no.prefix}/export/${ps.config.default.uri.filename.no.ext}.pdf
      </displayUriPath>
    </echoxml>
  </target>
</project>
Created on , last edited on