cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hans Ulrich Niedermann <niederm...@isd.uni-stuttgart.de>
Subject Docs with Docbook
Date Tue, 27 Jun 2000 07:43:51 GMT
Hi,

I don't know what the current state of the docs are, but I have two
remarks about the C2 docs.

1. Doc conversion to Docbook
============================

Yesterday night I created a "raw" XSL stylesheet to convert the
document stuff into Docbook. The stylesheet is not equisitely
engineered, I just hacked it to work on most of the C2
sitemap.xml. The <anchor> and <jump> elements still need to be
resolved. 

<!--
  document2docbook.xsl

  XSL stylesheets that transforms XML documents conforming to the
  "-//APACHE//DTD Documentation Vx.yz//EN" DTD into XML documents that
  (hopefully :-) conform to the "-//OASIS//DTD DocBook XML V4.1//EN"
  DTD.
-->

2. How to build the docs from XML
=================================

Eventually, we will probably build our HTML, PDF, whatever docs out of
our XML stuff using C2. As we probably do not want the docs to require
a working installation of C2 in order to read, we should build them
from XML into static HTML/PDF/whatever files. I don't know what C2's
offline capabilities are today, but a few days ago, I wrote an Ant
task class that calls Xalan to perform an XSL transformation. We could
use this in the mean time.

If someone could give me some hints, I could also try to get the FOP
stuff working with C2 instead of writing another Ant task for FOP. 
Unfortunately I can't find a written overall overview about the C2
architecture so I don't know where to start.

I won't be doing much before next monday, though. 

Uli

------8<------------------------------------------------------------

<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>

<!--

  document2docbook.xsl

  XSL stylesheets that transforms XML documents conforming to the
  "-//APACHE//DTD Documentation Vx.yz//EN" DTD into XML documents that
  (hopefully :-) conform to the "-//OASIS//DTD DocBook XML V4.1//EN"
  DTD.

  Written 06/2000 by Hans Ulrich Niedermann <niedermann@isd.uni-stuttgart.de>

-->

<!-- 

  DISCLAIMER: This file is not tested very thoroughly (yet).

-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">
  
  <xsl:template match="document">
    <book>
      <xsl:apply-templates/>
    </book>
  </xsl:template>

  <xsl:template match="header">
    <bookinfo>
      <xsl:apply-templates/>
    </bookinfo>
  </xsl:template>

  <xsl:template match="header/title">
    <xsl:copy>
      <xsl:apply-templates/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="header/authors">
    <authorgroup>
      <xsl:apply-templates/>
    </authorgroup>
  </xsl:template>

  <xsl:template match="header/authors/person">
    <author>
      <firstname><xsl:value-of select="substring-before(string(@name),' ')"/></firstname>
      <surname><xsl:value-of select="substring-after(string(@name),' ')"/></surname>
      <affiliation>
        <address>
          <email><xsl:value-of select="@email"/></email>
        </address>
      </affiliation>
    </author>
  </xsl:template>

  <xsl:template match="body">
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="s1">
    <chapter>
      <title><xsl:value-of select="@title"/></title>
      <xsl:apply-templates/>
    </chapter>
  </xsl:template>

  <xsl:template match="s2|s3">
    <section>
      <title><xsl:value-of select="@title"/></title>
      <xsl:apply-templates/>
    </section>
  </xsl:template>

  <xsl:template match="ol">
    <orderedlist continuation="restarts" inheritnum="ignore">
      <xsl:apply-templates/>
    </orderedlist>
  </xsl:template>

  <xsl:template match="ul">
    <itemizedlist>
      <xsl:apply-templates/>
    </itemizedlist>
  </xsl:template>

  <xsl:template match="li">
    <listitem>
      <para>
        <xsl:apply-templates/>
      </para>
    </listitem>
  </xsl:template>

  <xsl:template match="br"/>

  <xsl:template match="dl">
    <glosslist>
      <xsl:apply-templates/>
    </glosslist>
  </xsl:template>

  <xsl:template match="dl/dt">
    <glossentry>
       <glossterm><xsl:apply-templates/></glossterm>
       <xsl:apply-templates select="following-sibling::dd"/>
    </glossentry>
  </xsl:template>

  <xsl:template match="dl/dd">
    <glossdef><xsl:apply-templates/></glossdef>
  </xsl:template>

  <xsl:template match="note">
    <note>
      <xsl:apply-templates/>
    </note>
  </xsl:template>

  <xsl:template match="strong">
    <emphasis><xsl:apply-templates/></emphasis>
  </xsl:template>

  <xsl:template match="source">
    <programlisting format="linespecific">
      <xsl:apply-templates/>
    </programlisting>
  </xsl:template>

  <xsl:template match="code">
    <!-- FIXME: better docbook element? -->
    <command><xsl:apply-templates/></command>
  </xsl:template>

  <xsl:template match="p">
    <para>
      <xsl:apply-templates/>
    </para>
  </xsl:template>

  <xsl:template match="*|@*">
    <xsl:message terminate="no">
      Unhandled XML element &lt;<xsl:value-of select="name()"/>&gt;
    </xsl:message>
    <xsl:comment>unhandled XML element &lt;<xsl:value-of select="name()"/>&gt;
should be here</xsl:comment>
  </xsl:template>

</xsl:stylesheet>

------8<------------------------------------------------------------

Mime
View raw message