Changes

Jump to navigation Jump to search
Changed introduction; added explanations; fixed wrong code
This document is for XML authors who want to use open source
software to produce high quality PDF documents--right now. Themost official way to convert XML to PDF has been to use the FOlanguage, but the only open source project to convert FO is FOP,and it doesn't come close to implementing all the standards. Itcannot center tables, for example, and it has no way to controlorphan text. The FOP developers have not made any changes in thelast 1 1/2 years, making believe it is a dead end project.
ConTeXtOne and one half years ago I gave up using latex to format my XMLdocuments. I had found--or so I thought--a much superior solutionin the Formatting Object language, a variation or FO. FO would allow me tocreate high quality PDF documents in XML and unicode instead ofthe unfamiliar cumbersome and unfamilar syntx of tex. It wouldallowed me to convert from an XML tree to an XML tree, has almost none of the limitationsexactlyone runs into when using FOPwhat an XML author wants. If we know how to use ConTeXt The FO language was established intheplace same manner as HTML and therefore represented the power andacceptance of FOopen source software. The open source tool calledFOP, we can produce which did the actual conversion from the documents we want right now.abstract languageDon't worry if you have never seen FOP. Just ignore those partsto PDF, could already do much of what I wanted for my smallneeds, such as create simple tables and you should still get a good idea on how to use ConTeXtformat paragraphs.
Since an XML author will use XSLT for conversionOne and one half years passed, however, we can dispenseand nothing changed withwith many the development of FOP. While I could produce basic documents, Istill couldn't perform other basic formatting needs, such ascontrolling widow pagraphras or centering a table. Since the macros written developers of FOP have made no changes to their software in ConTeXt allthis time, I came to the conclusion that produce suchI would be stuck withthings as titles limitations if I continued to use FO and table FOP to convert mydocuments. Thus I turned back to tex, knowing I would face almost none of contentsthese limitations. We'll let XSLT do a lotI could produce beautiful documents right now,without having to wait for an open source FO converter thatof actually implements all the work and use standards. ConTeXt seemed the most stipped down version advanced form of tex, allowing me to format in the most directmanner without having to rely on many different macros (oroutside libraries), so I choose it. If you are an XML author who want to convert their documents toPDF via XSLT will find this document useful. I try to firstdescribe how to do something in FO before explaining how I woulddo it in ConTeXt we, but even if you do not know any FO you shouldcanfind the hints about formatting useful==What You Should Know==
This document assumes that the user already has ConTeXt installed
and knows how to use it. It also assumes that he has If neither is true, take a passinglittle bitknowledge of XM time and XSLTvisit the ConTeXt website to get familiar with how torun ConTeXt on your system. At the minimum, you should know thecommands to issue to conver the ConTeXt examles here to PDF. Youdon't need to know more than that to get started, though ofcourse the more you learn, the clearer this document will be.
=Converting From XML=
TeXML document and immediately know what the author meant to
express in ConTeXt. In converting an XML document such as TEI to
TeXML, one is coming as close as possible to actually conertingconverting
to ConTeXt itself, without having to worry about white space, and
while having the comfort of still working with an XML tree. If
you will still think in terms of ConTeXt.
==Simple Document in ConTeXt and in TeXML==
Here is the simplest ConTeXt document:
hello world
\stoptext
 
</texcode>
On my system, I issue the command: <texcode>  texexec [document_name]  </texcode> to produce a formatted document. Along with many other documents,this command prodices a document with the extension "dvi," whichI can view with the xdvi software . Follow the instructions toproduce other types of output. In TeXML, this simple document looks like:
<pre>
<TeXML>
<env name="text">
<TeXML>Hello World</TeXML>
</env>
</TeXML>
</pre>
Follow the instruction I need to first convert the TeXML this document to ConTeXtand then issuethe same exact commands I used above. It is a two step process. As ofwriting this document, I had In order to set an environmental variable totell TeXML it was converting convert the XML to ConTeXt (as opposed to latex),and then type <texcode>I issue the command:
texml.py -e utf <indoc> <outdoc></texcodepre>
.
Our simple texml -e utf8 -c [infile.xml] [outfile.tex] </pre> The "-e" option along with its argument of "utf8" tells TeXML toproduce a document consists of one envrionmentthat is encoded in utf8. The "-c" option tellsTeXML to produce ConTeXt output rather than latex. Make sure youinclude both options. Although both the ConTeXt and XML document use differentstructure, they do share the main textenvironment. Like allenvirononment. environments Like all environments in ConTeXt, this one starts
with a backslash followed by the word "start", and then followed
by the name of the environment wihout a space. We end this
command," which are placed in curly brackets.
For example, if we wanted to create a simple document with justone box, inside of which were the lines "that's it," we write:
<texcode>
one in TeXML.
=To Do=
[[simple_page* Include more documentation about TeXML.tex]] [[simple_page.texml]]
22

edits

Navigation menu