<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="xml/xslt" href="file:../../../eXml/tei/xsl/fo/tei.xsl"?>
<!DOCTYPE TEI.2 PUBLIC "-//TEI P4//ELEMENTS TEI Lite XML ver. 1//EN"
                      "http://www.tei-c.org/Lite/DTD/teixlite.dtd" [
<!ENTITY % TEI.XML 'INCLUDE'>
<!ENTITY sharp "">
<!ENTITY mdash "&#8212;">
<!ENTITY doc-templates-dialog-figure SYSTEM 'doc-templates-dialog.gif' NDATA gif>
<!ENTITY skeleton-TEI-document-figure SYSTEM 'skeleton-TEI-document.gif' NDATA gif>
<!ENTITY validation-errors-figure SYSTEM 'validation-errors.gif' NDATA gif>
<!ENTITY configureTransformation SYSTEM 'configureTransformation.gif' NDATA gif>
<!ENTITY XSL-FO-transformation-configuration-figure SYSTEM 'XSL-FO-transformation-configuration.gif' NDATA gif>
<!ENTITY XSLT-configuration-figure SYSTEM 'XSLT-configuration.gif' NDATA gif>
<!ENTITY FO-configuration-figure SYSTEM 'FO-configuration.gif' NDATA gif>
<!ENTITY output-file-configuration-figure SYSTEM 'output-file-configuration.gif' NDATA gif>
<!ENTITY external-FO-configuration-figure SYSTEM 'external-FO-configuration.gif' NDATA gif>
<!ENTITY adding-an-external-FO-processor-figure SYSTEM 'adding-an-external-FO-processor.gif' NDATA gif>
]>

<TEI.2>
    <teiHeader type="text">
        <fileDesc>
            <titleStmt>
                <title type="main">Editing TEI XML Documents in &lt;oXygen/&gt;</title>
              <title type="sub">How to Convert a TEI Document to PDF within the &lt;oXygen/> XML Editor</title>
                <author>syncRO soft ltd.</author>
            </titleStmt>
            <editionStmt>
                <edition>Copyrighted document prepared by SyncRO Soft ltd. staff for demonstration purposes</edition>
            </editionStmt>
            <extent>
                <seg type="size">Filesize uncompressed: 25 Kbytes.</seg>
                <seg type="format">XML TEI Lite</seg>
                <seg type="location">online</seg>
            </extent>
            <publicationStmt>
                <distributor>
                    <address>
                        <addrLine>
                            <name key="syncRO" type="organisation">SyncRO Soft ltd.</name>
                        </addrLine>
                        <addrLine>9 Gilort Street</addrLine>
                        <addrLine>
                            <name type="place">Craiova</name>
                        </addrLine>
                        <addrLine>1100</addrLine>
                        <addrLine>support@oxygenxml.com</addrLine>
                    </address>
                </distributor>
                <idno type="demo-article">oxy4</idno>
                <availability status="restricted">
                    <p>Freely available only for non-commercial use provided that this header is included
                        in its entirety with any copy distributed</p>
                </availability>
                <date>2007-04-06</date>
                <pubPlace>Craiova, Romania</pubPlace>
                <publisher>&copy; 2007, SyncRO Soft Ltd</publisher>
            </publicationStmt>
            <notesStmt>
                <note>This is a prototype header</note>
            </notesStmt>
            <sourceDesc>
                <p>Example TEI documents.</p>
            </sourceDesc>
        </fileDesc>
        <encodingDesc>
            <editorialDecl>
                <p>Paragraph, page divisions and punctuation have been checked before publication.
                    Unless otherwise indicated (by a REND attribute) all EMPH elements should be rendered
                    in italics, and all SOCALLED elements should be enclosed by quotation marks.</p>
            </editorialDecl>
            <refsDecl>
                <p>div sections bear IDs in the form Sn.</p>
            </refsDecl>
        </encodingDesc>
        <revisionDesc>
            <change>
                <date>2003-09-15</date>
                <respStmt>
                    <name>syncRO soft staff</name>
                    <resp>edt (Editor)</resp>
                </respStmt>
                <item>Created the initial version of the article</item>
            </change>
            <change>
                <date>2003-09-16</date>
                <respStmt>
                    <name>syncRO soft staff</name>
                    <resp>pfr (Proofreader)</resp>
                </respStmt>
                <item>check text</item>
            </change>
            <change>
                <date>2003-09-18</date>
                <respStmt>
                    <name>syncRO soft staff</name>
                    <resp>cvt (Converter)</resp>
                </respStmt>
                <item>convert to PDF using TEI XSL-FO stylesheets and Apache FOP</item>
            </change>
          <change>
            <date>2007-04-06</date>
            <respStmt>
              <name>syncRO soft staff</name>
              <resp>pfr (proofreader)</resp>
            </respStmt>
            <item>update content and screenshots for oXygen version 8.1</item>
          </change>
        </revisionDesc>
    </teiHeader>
    <text>
        <front>
            <titlePage>
                <docTitle>
                    <titlePart type="sub">How to Convert a <hi rend="roman">TEI</hi> XML document to
                      <hi rend="roman">PDF</hi> within the <hi rend="roman">&lt;oXygen/&gt; XML Editor</hi></titlePart>
                </docTitle>
                <docAuthor>
                    <name>SyncRO Soft ltd.</name>
                </docAuthor>
                <docDate>April 6, 2007</docDate>
            </titlePage>
        </front>
        <body>
            <divGen type="toc"/>
            <div type="abstract" id="S0" rend="italic">
                <head rend="italic">Abstract</head>
                <p rend="italic">
                    This article is intended to prove how easy it is to create a TEI XML (Text Encoding Initiative) document 
                    and then convert it to the PDF or HTML format, all from within the &lt;oXygen/&gt; XML editor. We will 
                    use the TEI Lite DTD, the TEI XSL-FO stylesheets and the Apache's FOP, all of which are integrated 
                    into the &lt;oXygen/&gt; installation kit.
                </p>
            </div>
            <div type="sect" id="S1">
                <head>Creating an XML Document in &lt;oXygen/&gt; Using the TEI Lite DTD</head>
                <p>
                    From the &quot;<hi rend="roman">File</hi>&quot; menu choose 
                    &quot;<hi rend="roman">New from Templates ...</hi>&quot;. The following window 
                    will be displayed, allowing you to choose from a list of built-in document
                    templates as starting points for your TEI XML documents:
                    <figure entity="doc-templates-dialog-figure">
                        <head>Document templates in &lt;oXygen/></head>
                    </figure>
                </p>
                <p>
                    Choose one of the TEI document templates from the list of built-in templates. If you select the 
                    TEI Lite template and click on the &quot;OK&quot; button &lt;oXygen/> will automatically generate 
                    and open a skeleton document with a DTD declaration and minimum markup conforming to the 
                    declared DTD. The encoding is automatically set to &quot;UTF-8&quot;.
                    <figure entity="skeleton-TEI-document-figure">
                        <head>Skeleton TEI document</head>
                    </figure>
                </p>
                <p>
                  If you wish to use a customized special-purpose TEI schema of type DTD, RELAX NG
                  and W3C XML Schema &lpar;for example generated with the <hi rend="roman">Roma
                  program, http://tei.oucs.ox.ac.uk/Roma/</hi>, available on the <hi rend="roman">TEI website, 
                  http://www.tei-c.org/Software/</hi>&rpar; you can manually modify the default 
                  document type declaration at the beginning of the document.
                </p>
                <note>
                    <p>The encoding can be changed at any time by editing the XML prolog, for instance,
                        changing to UTF-16:</p>
                    <p> &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-16&quot;?></p>
                </note>
            </div>
            <div type="sect" id="S2">
                <head>Editing the XML Document</head>
                <p>The editor will scan the DTD file and will initialize the Code-Insight assistant. By
                    pressing the &quot;&lt;&quot; key, it is displayed a window containing all the elements
                    that can be inserted at that point in the document. Notice that the window appears also
                    when adding new attributes or when an attribute has default values you can choose from.
                    In the first case the Code-Insight window is triggered by pressing the SPACE
                    keyor the TAB key, in the later by pressing &apos; or &quot; keys.</p>
                <p> A simple TEI document can be:</p>
                <p rend="roman" id="S3">

<lb/>
<![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE TEI.2 
    PUBLIC "-//TEI Consortium//DTD TEI Lite XML ver. 1//EN"
    "http://www.tei-c.org/Lite/DTD/teixlite.dtd" [
<!ENTITY % TEI.XML 'INCLUDE'>
]>
<TEI.2>
  <teiHeader type="text">
    <fileDesc>
      <titleStmt>
        <title type="main">Main title goes here</title>
        <title type="sub">Subtitle goes here</title>
        <author>syncRO soft Ltd.</author>
      </titleStmt>
      <editionStmt>
        <edition/>
      </editionStmt>
      <extent>
        <seg type="size">Filesize uncompressed: 10 Kbytes.</seg>
        <seg type="format">XML TEI Lite</seg>
        <seg type="location">online</seg>
      </extent>
      <publicationStmt>
        <distributor>
          <address>
    <addrLine>
    <name type="organisation">syncRO soft Ltd.</name>
    </addrLine>
    <addrLine>170 Nicolae Titulescu Street</addrLine>
    <addrLine>
    <name type="place">Craiova</name>
    </addrLine>
    <addrLine>1100</addrLine>
    <addrLine>support@oxygenxml.com</addrLine>
    </address>
        </distributor>
        <availability status="restricted">
          <p>Freely available for non-commercial use provided that
            this header is included in its entirety with any copy
            distributed</p>
        </availability>
        <date>2003-05-27</date>
        <pubPlace>Craiova, Romania</pubPlace>
        <publisher>&copy; 2003, syncRO soft Ltd</publisher>
      </publicationStmt>
      <notesStmt>
        <note>This is a prototype header</note>
      </notesStmt>
      <sourceDesc>
        <p>Compiled from existing internal syncRO documents.</p>
      </sourceDesc>
    </fileDesc>
    <encodingDesc>
      <editorialDecl>
        <p>Paragraph, page divisions and punctuation have been checked
          before publication. Unless otherwise indicated (by a REND
          attribute) all EMPH elements should be rendered in italics,
          and all SOCALLED elements should be enclosed by quotation
          marks.</p>
      </editorialDecl>
      <refsDecl>
        <p>div sections bear IDs in the form Sn.</p>
      </refsDecl>
    </encodingDesc>
    <revisionDesc>
      <change>
        <date>2003-05-25</date>
        <respStmt>
          <name>syncRO soft staff</name>
          <resp>edt (Editor)</resp>
        </respStmt>
        <item>Created the initial version of the article</item>
      </change>
      <change>
        <date>2003-05-26</date>
        <respStmt>
          <name>syncRO soft staff</name>
          <resp>pfr (Proofreader)</resp>
        </respStmt>
        <item>check text</item>
      </change>
      <change>
        <date>2003-05-27</date>
        <respStmt>
          <name>syncRO soft staff</name>
          <resp>cvt (Converter)</resp>
        </respStmt>
        <item>convert to PDF using TEI XSL-FO stylesheets and Apache
          FOP</item>
      </change>
    </revisionDesc>
  </teiHeader>
  <text>
    <front>
      <titlePage>
        <docTitle>
          <titlePart type="main">Main title to be displayed on screen</titlePart>
          <titlePart type="sub">Subtitle to be displayed on
          screen</titlePart>
        </docTitle>
        <docAuthor>
          <name>syncRO soft</name>
        </docAuthor>
        <docDate>May 27, 2003</docDate>
      </titlePage>
    </front>
    <body>
      <divGen type="toc"/>
      <div id="S0" rend="italic" type="abstract">
        <head rend="italic">Abstract</head>
        <p rend="italic"> This template is intended to prove how easy
          it is to create a TEI XML (Text Encoding Initiative)
          document and then convert it to the PDF or HTML format, all
          from within the &lt;oXygen/> XML editor. We can use the
          TEI Lite DTD, the TEI XSL-FO stylesheets and the Apache's
          FOP, all of which are integrated into the &lt;oXygen/>
          installation kit. </p>
      </div>
      <div id="S1" type="sect">
        <head>Title of first section</head>
        <p>First para</p>
        <p>Second para</p>
        <p>Third para</p>
        <note>
          <p>The encoding can be changed at any time by editing the
            XML prolog, for instance, changing to UTF-16:</p>
          <p> &lt;?xml version=&quot;1.0&quot;
            encoding=&quot;UTF-16&quot;?></p>
        </note>
      </div>
      <div id="S2" type="sect">
        <head>Title of second section</head>
        <p>First para of second section</p>
        <p>Second para of second section</p>
        <p id="S3" rend="roman">Third para of second section</p>
      </div>
    </body>
  </text>
</TEI.2>
]]>
<lb/>
        
                </p>
            </div>
            <div type="sect" id="S4">
                <head>Transforming to PDF</head>
                <p>
                    Before proceeding to the FO transformation you need to check the validity of the
                    document. For this, press the <hi rend="roman">Validate Document</hi> button
                    from the <hi rend="roman">Validate</hi> toolbar, or use the shortcut of the 
                    <hi rend="roman">Validate Document</hi> action, by default CTRL-SHIFT-V
                    (COMMAND-SHIFT-V on Mac). The validity report will be displayed in the 
                    status bar. If there are errors, they will be listed in a special panel at the
                    bottom of the &lt;oXygen/> window.
                    <figure entity="validation-errors-figure">
                        <head>Validation errors</head>
                    </figure>
                </p>
                <list type="bulleted">
                    <head>In order to configure your XSL-FO transformation the following steps need to be taken:</head>
                    <item>
                        <p>
                          Press the <hi rend="roman">Configure Transformation Scenario</hi> button from the
                          <hi rend="roman">Transformation</hi> toolbar. This will open the 
                          <hi rend="roman">Configure Transformation Scenario</hi> dialog where you
                          can create a new transformation scenario or edit an existing one. Also you
                          can use one of the predefined scenarios, for example the <hi rend="roman">TEI
                          PDF</hi> one which transforms a TEI XML document to PDF.
                        </p>
                        <figure entity="XSL-FO-transformation-configuration-figure">
                          <head>The XSL-FO transformation configuration dialog</head>
                        </figure>
                    </item>
                    <item>
                        <p>
                          On the XSLT tab of the <hi rend="roman">Edit scenario</hi> dialog in the XSL URL field
                          choose the <hi rend="roman">tei.xsl</hi> file. You can find it by browsing to the folder
                          <hi>${frameworks}/tei/xml/teip4/stylesheet/fo/tei.xsl</hi>, where
                          <hi>${frameworks}</hi> is the <hi>frameworks</hi> subfolder of the &lt;oXygen/> install
                          folder. An XML FO document is generated when applying this stylesheet. Next, the FO
                          processor can process it in order to generate output in the PDF format.
                        </p>
                      <figure entity="XSLT-configuration-figure">
                        <head>The XSLT configuration tab</head>
                      </figure>
                    </item>
                    <item>
                        <p>
                          On the <hi>FO Processor</hi> tab of the dialog make sure that the
                          <hi>Perform FOP</hi> checkbox is selected.
                        </p>
                      <figure entity="FO-configuration-figure">
                        <head>The FO configuration tab</head>
                      </figure>
                    </item>
                    <item>
                      <p>Make sure that the <hi rend="roman">XSLT result as input</hi> radio button is selected.</p>
                    </item>
                    <item>
                      <p>Let the FO processor set to <hi rend="roman">Built-in (Apache FOP)</hi>.</p>
                    </item>
                    <item>
                        <p>Let the method set to <hi rend="roman">pdf</hi>.</p>
                    </item>
                    <item>
                      <p>On the <hi rend="roman">Output</hi> tab of the dialog choose the output
                        file name and press the <hi rend="roman">OK</hi> button.</p>
                        <figure entity="output-file-configuration-figure">
                            <head>The Output configuration tab</head>
                        </figure>
                    </item>
                </list>
                <p>
                  Press the <hi rend="roman">Apply Transformation Scenario</hi> button from the
                  <hi rend="roman">Transformation</hi> toolbar or use CTRL-SHIFT-T (COMMAND-SHIFT-T on Mac)
                  shortcut. This way the XSLT and FO processing is started. In the status bar is presented the
                  current processing state. It will be displayed <hi rend="roman">FO transformation
                  successful</hi> when the FO processor ends. You can inspect the generated PDF file
                  using the <hi rend="roman">Acrobat Reader</hi> program.
                </p>
            </div>
            <div type="sect" id="S5">
                <head>Configuring an external FO processor, or other post processor.</head>
                <p>The built-in FO Processor is based on the Apache project, and is under development.
                    Problems may occur, depending on the complexity of the intermediate FO file.</p>
                <p>To avoid this kind of difficulties it is possible to configure one or more external FO
                    processors. (In other situations, you may need to run other post processors, not
                    necessarily FOP.) Go to Options -> Preferences -> XML -> XSLT/FO/XQuery -> FO
                    Processors to set up a post processor..</p>
                <p>
                    <figure entity="external-FO-configuration-figure">
                        <head>The external FO configuration dialog</head>
                    </figure>
                </p>

              <p>By default, the list is empty. By pressing the <hi rend="roman">New</hi> button
                  it can be created a new FO entry. The entry consists of:</p>
              <p>
                <list type="bulleted">
                  <item>
                      <p>
                        Name - This is the name that must be selected in the <hi rend="roman">Processor</hi>
                        combo box of the <hi rend="roman">Edit scenario</hi> dialog when this processor is used
                        in a transformation. 
                      </p>
                  </item>
                    <item>
                      <p>Description - A text description of the processor displayed in the 
                        <hi rend="roman">FO Processors</hi> preferences panel. </p>
                    </item>
                    <item>
                      <p>Output encoding - The encoding of the output stream of the processor.</p>
                    </item>
                    <item>
                      <p>Error encoding - The encoding of the error stream of the processor.</p>
                    </item>
                    <item>
                      <p>Working directory - The start directory of the command that runs the FO
                        processor.</p>
                    </item>
                    <item>
                      <p>Command line template - The command line is specifying the name of the FOP
                        executable and the command line parameters. Try not to use environment variables in its
                        expression, since those will not be expanded. Four editor variables can be used: 
                        <list>
                          <item>
                            <p>The FO method (the <hi rend="roman">${method}</hi> editor variable) - this
                              being replaced by the editor with <hi rend="roman">pdf</hi>,
                              <hi rend="roman">ps</hi> or <hi rend="roman">txt</hi>;</p>
                          </item>
                          <item>
                            <p> The FO input file (the <hi rend="roman">${fo}</hi> editor variable) - this can
                              be the edited file or the result of an XSLT transformation; </p>
                          </item>
                          <item>
                            <p> The file in which the result is stored (the <hi rend="roman">${out}</hi>
                              editor variable).</p>
                          </item>
                          <item>
                            <p> The directory of the current oXygen project (the <hi rend="roman">${pd}</hi>
                              editor variable).</p>
                          </item>
                        </list>
                      </p>
                      <p>
                        <figure entity="adding-an-external-FO-processor-figure">
                          <head>Adding an external FO processor</head>
                        </figure>
                      </p>
                      <note>
                        <p>Your editor may take as argument just one or two of the possible parameters. It is
                          not required to use all the macros in the command line.</p>
                      </note>
                    </item>
                </list>
              </p>
            </div>
        </body>
    </text>
</TEI.2>

