<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xslt" href="../../frameworks/tei/xml/tei/stylesheet/html/tei.xsl"?>
<?oxygen RNGSchema="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/teilite.rng" type="xml"?>

<!-- 
        For HTML transforms use the ${frameworks}/tei/xml/tei/stylesheet/html/tei.xsl stylesheet. 
-->

<!-- 
        For PDF transforms use the ${frameworks}/tei/xml/tei/stylesheet/fo/tei.xsl stylesheet. 
-->

<TEI xmlns="http://www.tei-c.org/ns/1.0">
    <teiHeader type="text">
        <fileDesc>
            <titleStmt>
                <title type="main">Writing TEI XML Documents</title>
                <title type="sub">How to create a TEI XML document and convert it 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 KB.</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>44 Nicolae Titulescu 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 non-commercial use provided that this header is included
                        in its entirety with any copy distributed</p>
                </availability>
                <date>2003-09-18</date>
                <pubPlace>Craiova, Romania</pubPlace>
                <publisher>Copyright 2003, 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>
                <name>syncRO soft staff</name>
                <note>Created the initial version of the article</note>
            </change>
            <change>
                <date>2003-09-18</date>
                 <name>syncRO soft staff</name>
                <note>Converted to PDF using TEI XSL-FO stylesheets and Apache FOP</note>
            </change>
        </revisionDesc>
    </teiHeader>
    <text>
        <front>
            <div/>            
            <titlePage>
                <docTitle>
                    <titlePart type="sub">How to create a <hi rend="bold">TEI</hi> XML document and convert it to 
                                <hi rend="bold">PDF</hi> within the <hi rend="bold">&lt;oXygen/> XML Editor</hi></titlePart>
                </docTitle>
                <docAuthor>
                    <name>syncRO soft</name>
                </docAuthor>
                <docDate>September 15, 2003</docDate>
            </titlePage>
        </front>
        <body>
            <divGen type="toc"/>
            <div type="abstract" xml:id="S0" rend="bold">
                <head rend="bold">Abstract</head>
                <p rend="bold">
                    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/> 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/> installation kit.
                </p>
            </div>
            
            <div type="sect" xml:id="S1">
                <head>Creating an XML Document in &lt;oXygen/> Using the TEI Lite DTD</head>
                <p>
                    From the "<hi rend="bold">File</hi>" menu choose 
                    "<hi rend="bold">New from Templates ...</hi>". It will be displayed a window, 
                    allowing you to choose from a list of built-in document templates as starting points for 
                    your TEI XML documents:
                </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 "Ok" 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 "UTF-8".
                </p>
                <p>
                    If you wish to use a customized special-purpose TEI DTD, for example generated with the 
                    PizzaChef program (<hi rend="bold">http://www.tei-c.org/pizza.html</hi>), available on the  
                    TEI website (<hi rend="bold">http://www.tei-c.org/</hi>), 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="1.0" encoding="UTF-16"?></p>
                </note>
            </div>
            <div type="sect" xml: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 "&lt;" 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 key, in the
                    later by pressing &apos; or " keys.</p>
                <p> A simple TEI document can be:</p>
                <p rend="bold" xml:id="S3">

<lb/>
&lt;?xml version="1.0" encoding="UTF-8"?><lb/>
&lt;!DOCTYPE TEI.2 PUBLIC "-//TEI Consortium//DTD TEI Lite XML ver. 1//EN"<lb/>
                       "http://www.tei-c.org/Lite/DTD/teixlite.dtd" [<lb/>
&lt;!ENTITY % TEI.XML &apos;INCLUDE&apos;><lb/>
]><lb/>
<lb/>
&lt;TEI.2><lb/>
    &lt;teiHeader type="text"><lb/>
        &lt;fileDesc><lb/>
            &lt;titleStmt><lb/>
                &lt;title type="main">Main title goes here&lt;/title><lb/>
                &lt;title type="sub">Subtitle goes here&lt;/title><lb/>
                &lt;author>syncRO soft Ltd.&lt;/author><lb/>
            &lt;/titleStmt><lb/>
            &lt;editionStmt><lb/>
                &lt;edition>&lt;/edition><lb/>
            &lt;/editionStmt><lb/>
            &lt;extent><lb/>
                &lt;seg type="size">Filesize uncompressed: 10 Kbytes.&lt;/seg><lb/>
                &lt;seg type="format">XML TEI Lite&lt;/seg><lb/>
                &lt;seg type="location">online&lt;/seg><lb/>
            &lt;/extent><lb/>
            &lt;publicationStmt><lb/>
                &lt;distributor><lb/>
                    &lt;address><lb/>
                        &lt;addrLine><lb/>
                            &lt;name type="organisation">syncRO soft Ltd.&lt;/name><lb/>
                        &lt;/addrLine><lb/>
                        &lt;addrLine>170 Nicolae Titulescu Street&lt;/addrLine><lb/>
                        &lt;addrLine><lb/>
                            &lt;name type="place">Craiova&lt;/name><lb/>
                        &lt;/addrLine><lb/>
                        &lt;addrLine>1100&lt;/addrLine><lb/>
                        &lt;addrLine>support@oxygenxml.com&lt;/addrLine><lb/>
                    &lt;/address><lb/>
                &lt;/distributor><lb/>
                &lt;availability status="restricted"><lb/>
                    &lt;p>Freely available for non-commercial use provided that this header is included<lb/>
                        in its entirety with any copy distributed&lt;/p><lb/>
                &lt;/availability><lb/>
                &lt;date>2003-05-27&lt;/date><lb/>
                &lt;pubPlace>Craiova, Romania&lt;/pubPlace><lb/>
                &lt;publisher>&amp;copy; 2003, syncRO soft Ltd&lt;/publisher><lb/>
            &lt;/publicationStmt><lb/>
            &lt;notesStmt><lb/>
                &lt;note>This is a prototype header&lt;/note><lb/>
            &lt;/notesStmt><lb/>
            &lt;sourceDesc><lb/>
                &lt;p>Compiled from existing internal syncRO documents.&lt;/p><lb/>
            &lt;/sourceDesc><lb/>
        &lt;/fileDesc><lb/>
        &lt;encodingDesc><lb/>
            &lt;editorialDecl><lb/>
                &lt;p>Paragraph, page divisions and punctuation have been checked before publication.<lb/>
                    Unless otherwise indicated (by a REND attribute) all EMPH elements should be rendered<lb/>
                    in italics, and all SOCALLED elements should be enclosed by quotation marks.&lt;/p><lb/>
            &lt;/editorialDecl><lb/>
            &lt;refsDecl><lb/>
                &lt;p>div sections bear IDs in the form Sn.&lt;/p><lb/>
            &lt;/refsDecl><lb/>
        &lt;/encodingDesc><lb/>
        &lt;revisionDesc><lb/>
            &lt;change><lb/>
                &lt;date>2003-05-25&lt;/date><lb/>
                &lt;name>syncRO soft staff&lt;/name><lb/>
                &lt;note>Created the initial version of the article&lt;/note><lb/>
            &lt;/change><lb/>
            &lt;change><lb/>
                &lt;date>2003-05-27&lt;/date><lb/>
                &lt;name>syncRO soft staff&lt;/name><lb/>
                &lt;note>Converted to PDF using TEI XSL-FO stylesheets and Apache FOP&lt;/note><lb/>
            &lt;/change><lb/>
        &lt;/revisionDesc><lb/>
    &lt;/teiHeader><lb/>
    &lt;text><lb/>
        &lt;front><lb/>
            &lt;titlePage><lb/>
                &lt;docTitle><lb/>
                    &lt;titlePart type="main">Main title to be displayed on screen&lt;/titlePart><lb/>
                    &lt;titlePart type="sub">Subtitle to be displayed on screen&lt;/titlePart><lb/>
                &lt;/docTitle><lb/>
                &lt;docAuthor><lb/>
                    &lt;name>syncRO soft&lt;/name><lb/>
                &lt;/docAuthor><lb/>
                &lt;docDate>May 27, 2003&lt;/docDate><lb/>
            &lt;/titlePage><lb/>
        &lt;/front><lb/>
        &lt;body><lb/>
            &lt;divGen type="toc"/><lb/>
            &lt;div type="abstract" id="S0" rend="bold"><lb/>
                &lt;head rend="bold">Abstract&lt;/head><lb/>
                &lt;p rend="bold"><lb/>
                    This template is intended to prove how easy it is to create a TEI XML (Text Encoding Initiative) document <lb/>
                    and then convert it to the PDF or HTML format, all from within the &lt;oXygen/> XML editor. We can <lb/>
                    use the TEI Lite DTD, the TEI XSL-FO stylesheets and the Apache&apos;s FOP, all of which are integrated <lb/>
                    into the &lt;oXygen/> installation kit.<lb/>
                &lt;/p><lb/>
            &lt;/div><lb/>
            &lt;div type="sect" id="S1"><lb/>
                &lt;head>Title of first section&lt;/head><lb/>
                &lt;p>First para&lt;/p><lb/>
                &lt;p>Second para&lt;/p><lb/>
                &lt;p>Third para&lt;/p><lb/>
                &lt;note><lb/>
                    &lt;p>The encoding can be changed at any time by editing the XML prolog, for instance,<lb/>
                        changing to UTF-16:&lt;/p><lb/>
                    &lt;p> &lt;?xml version="1.0" encoding="UTF-16"?>&lt;/p><lb/>
                &lt;/note><lb/>
            &lt;/div><lb/>
            &lt;div type="sect" id="S2"><lb/>
                &lt;head>Title of second section&lt;/head><lb/>
                &lt;p>First para of second section&lt;/p><lb/>
                &lt;p>Second para of second section&lt;/p><lb/>
                &lt;p rend="bold" id="S3">Third para of second section&lt;/p><lb/>
            &lt;/div><lb/>
        &lt;/body><lb/>
    &lt;/text><lb/>
&lt;/TEI.2><lb/>
<lb/>
        
                </p>
            </div>
            <div type="sect" xml: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 Validate button from the left of the view toolbar, or
                    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.
                </p>
                <list type="bulleted">
                    <head>Configuring the XSL-FO transformation</head>
                    <item>
                        <p>Press the Transformation Configuration button from the toolbar. This will open
                            the Transformation Configuration window.</p>
                    </item>
                    <item>
                        <p>In the XSL URL choose the "tei.xsl" file. You can find it by
                            browsing to {OxygenInstallDir}/tei/xsl/fo/. 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>
                    </item>
                    <item>
                        <p>Make sure that "Perform FOP" checkbox is selected.</p>
                    </item>
                    <item>
                        <p>Make sure that "XSLT result as input" radio button is selected.</p>
                    </item>
                    <item>
                        <p>Let the processor set to "Built-in". This means the use of the
                            Apache FOP.</p>
                    </item>
                    <item>
                        <p>Let the method set to "pdf".</p>
                    </item>
                    <item>
                        <p>Choose the output file name and press the "Ok" button.</p>
                    </item>
                </list>
                <p>Press the Transform button from the 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 "FO transformation successful" 
                    when the FO processor ends. You can inspect the generated PDF file using
                    the <hi rend="bold">Acrobat Reader</hi>TM program.</p>
            </div>
            <div type="sect" xml: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.) Use Options/Preferences/Extrenal FO Processors for set up.</p>
                <p>
                </p>
                <p>By default, the list is empty. By pressing the "New" button it can be created a new FO entry. 
                      The entry consists of:</p>
                <p>
                    <list type="bulleted">
                        <item>
                            <p>A name. This can be any name, but no whitespace are allowed in it.</p>
                        </item>
                        <item>
                            <p>A command line template. The command line is specifying the FOP executable.
                                Try not to use environment variables in its expression, since those will not be
                                expanded. There are used three macros: 
                                <list type="bulleted">
                                    <item>
                                        <p>The FO method (the macro "${method}") - this being
                                            replaced by the editor with "pdf", "ps" or "txt";</p>
                                    </item>
                                    <item>
                                        <p> The FO input file (the macro "${fo}")- this can be the
                                            edited file or the result of an XSLT; </p>
                                    </item>
                                    <item>
                                        <p> The file in which the result is stored (the macro "${out}").</p>
                                    </item>
                                </list>
                            </p>
                            <p>
                            </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>