<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>El Tramo &#187; DocBook</title>
	<atom:link href="http://el-tramo.be/blog/tag/docbook/feed" rel="self" type="application/rss+xml" />
	<link>http://el-tramo.be</link>
	<description>Remko Tronçon&#039;s Homepage</description>
	<lastBuildDate>Fri, 11 Jun 2010 19:08:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Integrating DocBook with WordPress</title>
		<link>http://el-tramo.be/blog/integrating-docbook-with-wordpress</link>
		<comments>http://el-tramo.be/blog/integrating-docbook-with-wordpress#comments</comments>
		<pubDate>Sat, 27 Jun 2009 18:28:36 +0000</pubDate>
		<dc:creator>Remko Tronçon</dc:creator>
				<category><![CDATA[Writing]]></category>
		<category><![CDATA[DocBook]]></category>
		<category><![CDATA[DocBook Kit]]></category>
		<category><![CDATA[DocBook XSL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://el-tramo.be/?p=409</guid>
		<description><![CDATA[I added a DocBook XSL customization layer to my DocBook Kit that outputs an HTML/PHP version of the document that automatically integrates with a WordPress blog. The stylesheet also (optionally) adds a link to the downloadable PDF of the document. An example document integrating with this blog can be seen here.
The custom stylesheet is based [...]]]></description>
			<content:encoded><![CDATA[<p>I added a DocBook XSL <a href="/git/docbook-kit/tree/style/wordpress">customization layer</a> to my <a href="/blog/docbook-kit">DocBook Kit</a> that outputs an HTML/PHP version of the document that automatically integrates with a WordPress blog. The stylesheet also (optionally) adds a link to the downloadable PDF of the document. An example document integrating with this blog can be seen <a href="/documents/example/index.php">here</a>.</p>
<p><span id="more-409"></span>The custom stylesheet is based on the standard DocBook XSL XHTML stylesheet. However, instead of inserting an HTML header, it inserts PHP calls to include the WordPress headers and footers. The only tricky part of this is to tell WordPress what the title of the resulting page should be. I hacked this in by creating a class with the bare minimum fields required by <code>wp_title() </code>(which is used by WordPress to print the title of the document). The resulting template looks like this:</p>
<blockquote>
<pre>&lt;?php
  require('../wordpress/wp-blog-header.php');
  class MyPost { var $post_title = "My Title"; }
  $wp_query-&gt;is_home = false;
  $wp_query-&gt;is_single = true;
  $wp_query-&gt;queried_object = new MyPost();
  get_header();
?&gt;
&lt;div id="content" class="narrowcolumn" role="main"&gt;
  ...
&lt;/div&gt;
&lt;?php
  get_sidebar();
  get_footer();
?&gt;</pre>
</blockquote>
<p>The DocBook kit is available from my <a href="/git/docbook-kit">Git repository</a> (or on <a href="http://github.com/remko/docbook-kit">GitHub</a>, or as a <a href="/git/docbook-kit/snapshot/docbook-kit-master.zip">ZIP</a> file). More information about the kit can be found <a href="/blog/docbook-kit">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://el-tramo.be/blog/integrating-docbook-with-wordpress/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kick-starting a DocBook Project</title>
		<link>http://el-tramo.be/blog/docbook-kit</link>
		<comments>http://el-tramo.be/blog/docbook-kit#comments</comments>
		<pubDate>Wed, 29 Apr 2009 18:27:43 +0000</pubDate>
		<dc:creator>Remko Tronçon</dc:creator>
				<category><![CDATA[Writing]]></category>
		<category><![CDATA[DocBook]]></category>
		<category><![CDATA[DocBook Kit]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://el-tramo.be/?p=332</guid>
		<description><![CDATA[When I started writing XMPP: The Definitive Guide, I switched from LaTeX to DocBook as my writing tool, mainly because DocBook was O’Reilly’s suggested format. After a few months of writing with DocBook, I started getting quite attached to the format: not only does it force you to separate presentation from content, the strict XML [...]]]></description>
			<content:encoded><![CDATA[<p>When I started writing <a href="http://oreilly.com/catalog/9780596157197/"><em>XMPP: The Definitive Guide</em></a>, I switched from LaTeX to <a href="http://www.docbook.org/">DocBook</a> as my writing tool, mainly because DocBook was O’Reilly’s suggested format. After a few months of writing with DocBook, I started getting quite attached to the format: not only does it force you to separate presentation from content, the strict XML format allows you to easily write tools to transform and validate your document. For example, for the XMPP book, we had several short Python scripts that checked whether the stanzas used in the book were well-formed, whether all web URLs were valid, &#8230; Today, I use DocBook for practically all of my documents. Because getting a DocBook environment up requires putting together quite a few pieces from different places, I created a <a href="/git/docbook-kit">“DocBook kit”</a> to be able to start writing a new DocBook project without much hassle.</p>
<p><span id="more-332"></span></p>
<p>Starting a DocBook project requires a few elementary tools to be installed:</p>
<ul>
<li>The <a href="http://www.docbook.org/schemas/">DocBook XML schemas</a>. These are used to validate whether your document is a legal DocBook document.</li>
<li>The <a href="http://docbook.sourceforge.net/">DocBook XSL stylesheets</a>. These are used to transform your DocBook input file into other formats, such as HTML or XSL-FO (a format which can be converted to PDF)</li>
<li>XML and XSL processing tools. These tools take the schemas and stylesheets mentioned above, and apply them to your document to do the actual checking and transformation. I use <a href="http://xmlsoft.org/">xmllint</a> and <a href="http://www.xmlsoft.org/XSLT/xsltproc2.html">xsltproc</a> (available out of the box on many platforms and distributions), but other tools can be used as well (e.g. <a href="http://saxon.sourceforge.net/">Saxon</a> or <a href="http://xml.apache.org/xalan-j/">Xalan</a>)</li>
<li>An XSL-FO processor, to transform the intermediate XSL-FO format generated by the stylesheets to PDF. I use the Free <a href="http://xmlgraphics.apache.org/fop/">Apache FOP</a>, but commercial tools such as <a href="http://www.renderx.com/">RenderX XEP</a> and <a href="http://www.antennahouse.com/">AntennaHouse</a> are very popular for this too.</li>
</ul>
<p>Once you have all these tools, you need to tie them all together to be able to get from your DocBook file to your desired output format, such as PDF or HTML. Because this involves quite some boilerplate scripting, I created a DocBook kit to make this as light as possible. The DocBook kit comes with a Makefile, which you can use to do all the work for you. The kit also automatically downloads the DocBook XML schemas and XSL stylesheets, making it possible to start working on a DocBook project on a machine with only some basic tools (<code>xmllint</code> and <code>xsltproc</code>) installed.</p>
<p>To use the kit, simply drop it in the directory of your project, and create a minimal <code>Makefile</code> such as the following one:</p>
<blockquote>
<pre><code># The toplevel DocBook file of our project
DOCUMENT = MyDocument.xml</code></pre>
<pre><code># Include the DocBook Kit's makefile rules
include docbook-kit/tools/Makefile.inc</code></pre>
</blockquote>
<p>This makes several <code>make</code> commands available, such as:</p>
<ul>
<li><code>make</code>, <code>make pdf</code>, <code>make html</code>, <code>make txt</code>: Creates an HTML, PDF, and/or TXT file of your document.</li>
<li><code>make check</code>: Validates your document syntactically.</li>
<li><code>make check-spelling</code>: Runs a spell checker on your document.</li>
<li><code>make package</code>: Creates a <em>flat</em> DocBook file (i.e. one with all the parts included using <a href="http://www.w3.org/TR/xinclude/">XInclude</a>s expanded), normalizes all figure names, and packages the result up into a tarball.</li>
</ul>
<p>The makefile also tracks the dependencies of the document, making sure that your document is rebuilt whenever one of its dependencies (e.g. images, document parts included using XInclude) changes.</p>
<p>Besides tools, the kit also provides a <em>customization layer</em> around the standard XSL stylesheets. These customizations change fonts, spacings, and other presentation parameters for the output document. You can use these as an example on how to make your DocBook document look the way <em>you</em> want. Detailed information on using and customizing the DocBook XSL stylesheets can be found in Bob Stayton’s <em><a href="http://www.sagehill.net/docbookxsl/">DocBook XSL: The Complete Guide</a></em>.</p>
<p>The DocBook kit is available from my <a href="/git/docbook-kit">Git repository</a> (or on <a href="http://github.com/remko/docbook-kit">GitHub</a>, or as a <a href="/git/docbook-kit/snapshot/docbook-kit-master.zip">ZIP</a> file), and comes with an <a href="/git/docbook-kit/tree/example">example</a> of a simple project using the kit. More tools and features will be added in the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://el-tramo.be/blog/docbook-kit/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
