Skip to main content

 Publishing

Publishing PageSeeder data to print, the Web or both

Export citations to docx

To export citations stored in PageSeeder using the docx export Ant task, each citation must be in a properties fragment inside a single bibliography document.

PSML model

The recommended model has xrefs from the bibliography document to source documents in a library which contain the details of each source. In this way, the sources can be defined once and used by many different publications.

Example bibliography document

The following example contains the following properties, but any properties could be used:

  • link-text – The text that appears in the citation reference.
  • description – A temporary description that can be used until a proper source document is created.
  • source – An xref to the source details document. It must have type="alternate" so that the details can be transcluded into the bibliography when exporting.
<document type="bibliography" level="portable">
  <section id="title">
    <fragment id="0">
      <heading level="1">Bibliography</heading>
    </fragment>
  </section>
  <section id="content" fragmenttype="citation">
    <properties-fragment id="1" type="citation">
      <property name="link-text"
                title="Link text"
                value="Jacobson, 1992" />
      <property name="description"
                title="Description"
                datatype="markdown">
        <markdown>Object Oriented Software Engineering: A Use
                  Case Driven Approach 1st Edition
                  by Ivar Jacobson
        </markdown>
      </property>
      <property name="source"
                title="Source"
                datatype="xref">
        <xref frag="default"
              uriid="61107"
              documenttype="source">Object Oriented Software Engineering
        </xref>
      </property>
    </properties-fragment>
    <properties-fragment id="2" type="citation">
      <property name="link-text"
                      title="Link text"
                      value="Wikipedia" />
      <property name="description"
                      title="Description"
                      datatype="markdown">
        <markdown>Object-oriented design</markdown>
      </property>
      <property name="source"
                title="Source"
                datatype="xref">
        <xref frag="default"
              uriid="61108"
              documenttype="source">Object-oriented design
        </xref>
      </property>
    </properties-fragment>
  </section>
</document>

Example source document

The following example contains the following properties but any properties could be used:

  • first-name – The given/other name of an author.
  • middle-name – The middle name of an author.
  • last-name – The family name of an author.
  • title – The title of the book.
  • year – The year published.
  • publisher – The publisher.
<document type="source" level="portable">
  <section id="authors" title="Authors" fragmenttype="author">
    <properties-fragment id="2" type="author">
      <property name="first-name"
                title="First name"
                value="Ivar" />
      <property name="middle-name"
                title="Middle name"
                value="" />
      <property name="last-name"
                title="Last name"
                value="Jacobson" />
    </properties-fragment>
  </section>
  <section id="details" title="Details">
    <properties-fragment id="1" type="book">
      <property name="title"
                title="Title"
                value="Object Oriented Software Engineering:
                       A Use Case Driven Approach" />
      <property name="year"
                title="Year"
                value="1992" />
      <property name="publisher"
                title="Publisher"
                value="Addison-Wesley Professional" />
    </properties-fragment>
  </section>
</document>

Post-processing

The docx export Ant task includes the PSML properties for citation sources in the item1.xml file inside the docx. This PSML must then be transformed into OOXML so that the sources can be read by Microsoft Word. This can be done by running an XSLT style sheet in the Ant build.xml.

For a full example of post-processing, see How to configure publications.

Example build.xml

The <param name="expanded" value="true"/> outputs the docx in unzipped format so it can be post-processed. It is then zipped at another time.

<project name="Report publication export"
         xmlns:ps="antlib:com.pageseeder.publishapi.ant"
         xmlns:psd="antlib:org.pageseeder.docx.ant">
  <target name="create-consolidated-docx"
          description="Create Word Document"> ...
    <psd:export-docx
         src="${process}/${ps.config.default.uri.filename.no.ext}.psml"
         dest="${expanded}"
         working="${working}/docx"
         config="word-export-config.xml"
         wordTemplate="word-export-template.docx">
      <param name="expanded" value="true"/>
    </psd:export-docx>

    <echo>DocX post-transform</echo>
    <xslt in="${expanded}/customXml/item1.xml"
          out="${working}/item1.xml"
          style="docx-citation-transform.xsl"/>
    <copy todir="${expanded}/customXml"
          file="${working}/item1.xml"
          overwrite="true"/>

    <echo>Zipping</echo>
    <zip 
      destfile="${working}/${ps.config.default.uri.filename.no.ext}.docx"
      basedir="${expanded}"/>
      ...
  </target>
</project>

Example docx-citation-transform.xsl

This XSL must produce an XML that follows the OOXML bibliography schema (see following).

<xsl:stylesheet version="2.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:b="http://schemas.openxmlformats.org/officeDocument/2006/bibliography"
  exclude-result-prefixes="#all">

  <xsl:template match="/b:Sources">
    <xsl:copy>
      <xsl:copy-of select="@*" />
      <xsl:apply-templates />
    </xsl:copy>
  </xsl:template>

  <xsl:template match="properties-fragment[.//xref]">
    <b:Source>
      <b:Tag>
        <xsl:value-of select="@id" />
      </b:Tag>

      <b:SourceType>
        <xsl:choose>
          <xsl:when test=".//properties-fragment[@type='book']">
                         Book
          </xsl:when>
          <xsl:when
             test=".//properties-fragment[@type='website']">
                  InternetSite
          </xsl:when>
          <xsl:when
            test=".//properties-fragment[@type='periodical-article']">
                  ArticleInAPeriodical
          </xsl:when>
          <xsl:otherwise>Misc</xsl:otherwise>
        </xsl:choose>
      </b:SourceType>
      <b:Author>
        <xsl:if 
           test=".//properties-fragment[@type='author']">
          <b:Author>
            <b:NameList>
              <xsl:apply-templates 
                 select=".//properties-fragment[@type='author']" />
            </b:NameList>
          </b:Author>
        </xsl:if>
      </b:Author>
      <xsl:apply-templates
         select=".//properties-fragment[@type='book' or
                @type='website' or
                @type='periodical-article' or
                @type='misc']/property" />
    </b:Source>
  </xsl:template>

  <xsl:template match="properties-fragment[@type='author']">
    <b:Person>
      <xsl:apply-templates   mode="author" />
    </b:Person>
  </xsl:template>

  <xsl:template match="property[@name='first-name']"
                mode="author">
    <b:First>
      <xsl:value-of  select="@value" />
    </b:First>
  </xsl:template>
  <xsl:template match="property[@name='middle-name']"
                mode="author">
    <b:Middle>
      <xsl:value-of select="@value" />
    </b:Middle>
  </xsl:template>

  <xsl:template match="property[@name='last-name']"
                mode="author">
    <b:Last>
      <xsl:value-of select="@value" />
    </b:Last>
  </xsl:template>

  <xsl:template match="property[@name='title']">
    <b:Title>
      <xsl:value-of select="@value" />
    </b:Title>
  </xsl:template>

  <xsl:template match="property[@name='year']">
    <b:Year>
      <xsl:value-of select="@value" />
    </b:Year>
  </xsl:template>

  <xsl:template match="property[@name='publisher']">
    <b:Publisher>
      <xsl:value-of select="@value" />
    </b:Publisher>
  </xsl:template>
</xsl:stylesheet>

Example item1.xml after transform

<b:Sources
  xmlns:b="http://schemas.openxmlformats.org/officeDocument/2006/bibliography"
  xmlns="http://schemas.openxmlformats.org/officeDocument/2006/bibliography"
  SelectedStyle="\APA.XSL"
  StyleName="APA">
  <b:Source>
    <b:Tag>61105-1</b:Tag>
    <b:SourceType>Book</b:SourceType>
    <b:Author>
      <b:Author>
        <b:NameList>
          <b:Person>
            <b:First>Ivar</b:First>
            <b:Last>Jacobson</b:Last>
          </b:Person>
        </b:NameList>
      </b:Author>
    </b:Author>
    <b:Title>Object Oriented Software Engineering:
             A Use Case Driven Approach</b:Title>
    <b:Year>1992</b:Year>
    <b:Publisher>Addison-Wesley Professional</b:Publisher>
  </b:Source>
</b:Sources>

OOXML bibliography schema

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns="http://purl.oclc.org/ooxml/officeDocument/bibliography"
  xmlns:s="http://purl.oclc.org/ooxml/officeDocument/sharedTypes"
  targetNamespace="http://purl.oclc.org/ooxml/officeDocument/bibliography"
  elementFormDefault="qualified">
  <xsd:import namespace="http://purl.oclc.org/ooxml/officeDocument/sharedTypes"
              schemaLocation="shared-commonSimpleTypes.xsd"/>
  <xsd:simpleType name="ST_SourceType">
    <xsd:restriction base="s:ST_String">
      <xsd:enumeration value="ArticleInAPeriodical"/>
      <xsd:enumeration value="Book"/>
      <xsd:enumeration value="BookSection"/>
      <xsd:enumeration value="JournalArticle"/>
      <xsd:enumeration value="ConferenceProceedings"/>
      <xsd:enumeration value="Report"/>
      <xsd:enumeration value="SoundRecording"/>
      <xsd:enumeration value="Performance"/>
      <xsd:enumeration value="Art"/>
      <xsd:enumeration value="DocumentFromInternetSite"/>
      <xsd:enumeration value="InternetSite"/>
      <xsd:enumeration value="Film"/>
      <xsd:enumeration value="Interview"/>
      <xsd:enumeration value="Patent"/>
      <xsd:enumeration value="ElectronicSource"/>
      <xsd:enumeration value="Case"/>
      <xsd:enumeration value="Misc"/>
    </xsd:restriction>
  </xsd:simpleType>
  <xsd:complexType name="CT_NameListType">
    <xsd:sequence>
      <xsd:element name="Person"
                   type="CT_PersonType"
                   minOccurs="1"
                   maxOccurs="unbounded"/>
    </xsd:sequence>
  </xsd:complexType>
  <xsd:complexType name="CT_PersonType">
    <xsd:sequence>
      <xsd:element name="Last"
                   type="s:ST_String"
                   minOccurs="0"
                   maxOccurs="unbounded"/>
      <xsd:element name="First"
                   type="s:ST_String"
                   minOccurs="0"
                   maxOccurs="unbounded"/>
      <xsd:element name="Middle"
                   type="s:ST_String"
                   minOccurs="0"
                   maxOccurs="unbounded"/>
    </xsd:sequence>
  </xsd:complexType>
  <xsd:complexType name="CT_NameType">
    <xsd:sequence>
      <xsd:element name="NameList"
                   type="CT_NameListType"
                   minOccurs="1"
                   maxOccurs="1"/>
    </xsd:sequence>
  </xsd:complexType>
  <xsd:complexType name="CT_NameOrCorporateType">
    <xsd:sequence>
      <xsd:choice minOccurs="0"
                  maxOccurs="1">
        <xsd:element name="NameList"
                     type="CT_NameListType"
                     minOccurs="1"
                     maxOccurs="1"/>
        <xsd:element name="Corporate"
                     minOccurs="1"
                     maxOccurs="1"
                     type="s:ST_String"/>
      </xsd:choice>
    </xsd:sequence>
  </xsd:complexType>
  <xsd:complexType name="CT_AuthorType">
    <xsd:sequence>
      <xsd:choice minOccurs="0" maxOccurs="unbounded">
        <xsd:element name="Artist" type="CT_NameType"/>
        <xsd:element name="Author" type="CT_NameOrCorporateType"/>
        <xsd:element name="BookAuthor" type="CT_NameType"/>
        <xsd:element name="Compiler" type="CT_NameType"/>
        <xsd:element name="Composer" type="CT_NameType"/>
        <xsd:element name="Conductor" type="CT_NameType"/>
        <xsd:element name="Counsel" type="CT_NameType"/>
        <xsd:element name="Director" type="CT_NameType"/>
        <xsd:element name="Editor" type="CT_NameType"/>
        <xsd:element name="Interviewee" type="CT_NameType"/>
        <xsd:element name="Interviewer" type="CT_NameType"/>
        <xsd:element name="Inventor" type="CT_NameType"/>
        <xsd:element name="Performer" type="CT_NameOrCorporateType"/>
        <xsd:element name="ProducerName" type="CT_NameType"/>
        <xsd:element name="Translator" type="CT_NameType"/>
        <xsd:element name="Writer" type="CT_NameType"/>
      </xsd:choice>
    </xsd:sequence>
  </xsd:complexType>
  <xsd:complexType name="CT_SourceType">
    <xsd:sequence>
      <xsd:choice minOccurs="0" maxOccurs="unbounded">
        <xsd:element name="AbbreviatedCaseNumber" type="s:ST_String"/>
        <xsd:element name="AlbumTitle" type="s:ST_String"/>
        <xsd:element name="Author" type="CT_AuthorType"/>
        <xsd:element name="BookTitle" type="s:ST_String"/>
        <xsd:element name="Broadcaster" type="s:ST_String"/>
        <xsd:element name="BroadcastTitle" type="s:ST_String"/>
        <xsd:element name="CaseNumber" type="s:ST_String"/>
        <xsd:element name="ChapterNumber" type="s:ST_String"/>
        <xsd:element name="City" type="s:ST_String"/>
        <xsd:element name="Comments" type="s:ST_String"/>
        <xsd:element name="ConferenceName" type="s:ST_String"/>
        <xsd:element name="CountryRegion" type="s:ST_String"/>
        <xsd:element name="Court" type="s:ST_String"/>
        <xsd:element name="Day" type="s:ST_String"/>
        <xsd:element name="DayAccessed" type="s:ST_String"/>
        <xsd:element name="Department" type="s:ST_String"/>
        <xsd:element name="Distributor" type="s:ST_String"/>
        <xsd:element name="Edition" type="s:ST_String"/>
        <xsd:element name="Guid" type="s:ST_String"/>
        <xsd:element name="Institution" type="s:ST_String"/>
        <xsd:element name="InternetSiteTitle" type="s:ST_String"/>
        <xsd:element name="Issue" type="s:ST_String"/>
        <xsd:element name="JournalName" type="s:ST_String"/>
        <xsd:element name="LCID" type="s:ST_Lang"/>
        <xsd:element name="Medium" type="s:ST_String"/>
        <xsd:element name="Month" type="s:ST_String"/>
        <xsd:element name="MonthAccessed" type="s:ST_String"/>
        <xsd:element name="NumberVolumes" type="s:ST_String"/>
        <xsd:element name="Pages" type="s:ST_String"/>
        <xsd:element name="PatentNumber" type="s:ST_String"/>
        <xsd:element name="PeriodicalTitle" type="s:ST_String"/>
        <xsd:element name="ProductionCompany" type="s:ST_String"/>
        <xsd:element name="PublicationTitle" type="s:ST_String"/>
        <xsd:element name="Publisher" type="s:ST_String"/>
        <xsd:element name="RecordingNumber" type="s:ST_String"/>
        <xsd:element name="RefOrder" type="s:ST_String"/>
        <xsd:element name="Reporter" type="s:ST_String"/>
        <xsd:element name="SourceType" type="ST_SourceType"/>
        <xsd:element name="ShortTitle" type="s:ST_String"/>
        <xsd:element name="StandardNumber" type="s:ST_String"/>
        <xsd:element name="StateProvince" type="s:ST_String"/>
        <xsd:element name="Station" type="s:ST_String"/>
        <xsd:element name="Tag" type="s:ST_String"/>
        <xsd:element name="Theater" type="s:ST_String"/>
        <xsd:element name="ThesisType" type="s:ST_String"/>
        <xsd:element name="Title" type="s:ST_String"/>
        <xsd:element name="Type" type="s:ST_String"/>
        <xsd:element name="URL" type="s:ST_String"/>
        <xsd:element name="Version" type="s:ST_String"/>
        <xsd:element name="Volume" type="s:ST_String"/>
        <xsd:element name="Year" type="s:ST_String"/>
        <xsd:element name="YearAccessed" type="s:ST_String"/>
      </xsd:choice>
    </xsd:sequence>
  </xsd:complexType>
  <xsd:element name="Sources" type="CT_Sources"/>
  <xsd:complexType name="CT_Sources">
    <xsd:sequence>
      <xsd:element name="Source"
                   type="CT_SourceType"
                   minOccurs="0"
                   maxOccurs="unbounded"/>
    </xsd:sequence>
    <xsd:attribute name="SelectedStyle" type="s:ST_String"/>
    <xsd:attribute name="StyleName" type="s:ST_String"/>
    <xsd:attribute name="URI" type="s:ST_String"/>
  </xsd:complexType>
</xsd:schema>
Created on , last edited on