This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Rendering DocBook with PHP


  Hi.

  I just released XML_Transformer [1] 0.8, which is a PEAR [2] package
  for the PHP [3] programming language. The XML_Transformer package
  allows for the transformation of XML documents by binding PHP
  functionality to XML tags.

  This new release introduces a preliminary DocBook Namespace Handler
  that currently provides transformations for <artheader>, <article>,
  <author>, <book>, <chapter>, <emphasis> <example>, <figure>,
  <filename>, <firstname>, <function>, <graphic>, <itemizedlist>,
  <listitem>, <orderedlist>, <para>, <programlisting>, <section>,
  <surname>, <title>, <ulink> and <xref>.

  Example

    <?php
    require_once 'XML/Transformer/Driver/OutputBuffer.php';
    $t = new XML_Transformer_Driver_OutputBuffer(
      array(
        'autoload' => 'DocBook'
      )
    );
    ?>
    <article>
      <artheader>
        <title>
          An Article
        </title>
        <author>
          <firstname>
            Sebastian
          </firstname>
          <surname>
            Bergmann
          </surname>
        </author>
      </artheader>
      <section id="foo">
        <title>
          Section One
        </title>
      </section>
      <section id="bar">
        <title>
          Section Two
        </title>
        <para>
          <xref linkend="foo" />
        </para>
      </section>
    </article>

  Output

    <html>
      <head>
        <title>
          Sebastian Bergmann: An Article
        </title>
      </head>
      <body>
        <h1 class="title">
          Sebastian Bergmann: An Article
        </h1>
        <div class="section">
          <a id="foo"></a>
          <h2 class="title">
            1. Section One
          </h2>
        </div>
        <div class="section">
          <a id="bar"></a>
          <h2 class="title">
            2. Section Two
          </h2>
          <p>
            <a href="#foo">
              1. Section One
            </a>
          </p>
        </div>
      </body>
    </html>

  Note that in the above example the XML_Transformer takes the script's
  output as its input XML document, using PHP's output buffering
  mechanism. Of course, the input XML document could alse be read from
  a file or another source.

  The XML_Transformer's DocBook Namespace Handler is not intended to
  compete with any existing processing technology for DocBook XML
  documents, like Normal Walsh's DSSSL and XSL stylesheets.

  I simply set out to work on the DocBook Namespace Handler in order
  to explore the possibilities of XML_Transformer. I'm currently
  working on a PHP and XML_Transformer based publishing framework for
  DocBook documents that offers the previously discussed user
  annotations feature. If there's enough interest in such a tool I
  will publish it as Open Source.

  --
  [1] http://pear.php.net/package-info.php?pacid=37
  [2] http://pear.php.net/
  [3] http://www.php.net/

-- 
  Sebastian Bergmann
  http://sebastian-bergmann.de/                 http://phpOpenTracker.de/

  Did I help you? Consider a gift: http://wishlist.sebastian-bergmann.de/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]