<HTML ><HEAD ><TITLE >Serving DocBook 4.1.2 XML</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="DocBook XML/SGML Processing Using OpenJade" HREF="index.html"><LINK REL="PREVIOUS" TITLE="Using OpenJade" HREF="x456.html"><LINK REL="NEXT" TITLE="Further Information" HREF="x600.html"></HEAD ><BODY CLASS="sect1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >DocBook XML/SGML Processing Using OpenJade</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="x456.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="x600.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="AEN512" ></A >5. Serving DocBook 4.1.2 XML</H1 ><P >There are 3 ways to serve DocBook 4.1.2 XML from a web server:</P ><P ></P ><UL ><LI ><P >Command line Pre-processed Open Jade, XSLT</P ></LI ><LI ><P >Scripting - PHP, Perl, Python</P ></LI ><LI ><P >Application server - Tomcat + Cocoon</P ></LI ></UL ><P >Using an application server like Cocoon is the best the option.</P ><DIV CLASS="note" ><P ></P ><TABLE CLASS="note" WIDTH="100%" BORDER="0" ><TR ><TD WIDTH="25" ALIGN="CENTER" VALIGN="TOP" ><IMG SRC="../images/note.gif" HSPACE="5" ALT="Note"></TD ><TH ALIGN="LEFT" VALIGN="CENTER" ><B >Cocoon in Action</B ></TH ></TR ><TR ><TD > </TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >To see an example of web server running Tomcat + Cocoon serving DocBook 4.1.2 XML content, please visit <A HREF="http://www.xml-dev.com:8080/cocoon/mount/docbook/" TARGET="_top" >http://www.xml-dev.com:8080/cocoon/mount/docbook/</A ></P ></TD ></TR ></TABLE ></DIV ><P > In this section we will see how to serve DocBook 4.1.2 XML content using Tomcat + Cocoon.</P ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="AEN528" ></A >5.1. Tomcat + Cocoon</H2 ><P >Tomcat is the Java Servlet Container. For more information please visit <A HREF="http://jakarta.apache.org/tomcat/index.html" TARGET="_top" >http://jakarta.apache.org/tomcat/index.html</A >.</P ><P >Apache Cocoon is an XML publishing framework. For more information please visit <A HREF="http://xml.apache.org/cocoon/index.html" TARGET="_top" >http://xml.apache.org/cocoon/index.html</A >.</P ><P >This HOWTO will not go into details of setting up Tomcat + Cocoon, since it is already explained in the document <A HREF="http://xml.apache.org/cocoon/installing/index.html" TARGET="_top" >http://xml.apache.org/cocoon/installing/index.html</A >. Setting up Tomcat + Cocoon is an easy process and should take less than five minutes.</P ><P >Once you have the Cocoon + Tomcat setup and working, please follow the next the sections to server DocBook 4.1.2 XML content.</P ><DIV CLASS="note" ><P ></P ><TABLE CLASS="note" WIDTH="100%" BORDER="0" ><TR ><TD WIDTH="25" ALIGN="CENTER" VALIGN="TOP" ><IMG SRC="../images/note.gif" HSPACE="5" ALT="Note"></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P >One important caveat: users in the field have experienced compatibility issues with the DocBook stylesheets and some versions of the Xalan XML parser. Xalan is the parser bundled with Sun's JRE, so that's what you're using by default. </P ></TD ></TR ></TABLE ></DIV ><P ><EM >At the very least, make sure you're using the latest JRE from Sun (at this writing, 1.4.2).</EM ></P ><P >Also consider upgrading the Xalan parser to the latest release. At this writing, the latest Sun JRE, 1.4.2, is bundled with Xalan 2.4.1, while Xalan itself is up to version 2.5.1.</P ><P >To check the version currently installed, type</P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="screen" ><B CLASS="command" > # java org.apache.xalan.xslt.EnvironmentCheck</B ></PRE ></FONT ></TD ></TR ></TABLE ><P >For more info, visit <A HREF="http://xml.apache.org/xalan-j/faq.html" TARGET="_top" >http://xml.apache.org/xalan-j/faq.html</A > .</P ></DIV ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="AEN547" ></A >5.2. Installing Norman Walsh's XSL</H2 ><P >In this step we will install the Norman Walsh's XSL under the <TT CLASS="filename" >/usr/local/dbtools/</TT > directory.</P ><P >Change to the <TT CLASS="filename" >/tmp/downloads</TT > directory and untar the docbook-xsl file.</P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="screen" ><B CLASS="command" ># cd /tmp/downloads/</B ></PRE ></FONT ></TD ></TR ></TABLE ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="screen" ><B CLASS="command" ># gzip -d docbook-xsl-1.53.0.tar.gz</B ></PRE ></FONT ></TD ></TR ></TABLE ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="screen" ><B CLASS="command" ># tar -xvf docbook-xsl-1.53.0.tar</B ></PRE ></FONT ></TD ></TR ></TABLE ><P >To install the docbook-xsl please move the files to the <TT CLASS="filename" >/usr/local/dbtools</TT >.</P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="screen" ><B CLASS="command" ># mv docbook-xsl-1.53.0 /usr/local/dbtool/docbook-xsl</B ></PRE ></FONT ></TD ></TR ></TABLE ><P >Next install the LDP XSL.</P ></DIV ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="AEN564" ></A >5.3. Installing LDP XSL</H2 ><P >Unzip the <TT CLASS="filename" >tldp-xsl-xxxxx.tar.gz</TT > and the copy all the files to the <TT CLASS="filename" >/usr/local/dbtools/docbook-xsl/html</TT > directory.</P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="screen" ><B CLASS="command" ># cd /tmp/downloads</B ></PRE ></FONT ></TD ></TR ></TABLE ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="screen" ><B CLASS="command" ># gzip tldp-xsl-xxxxx.tar.gz</B ></PRE ></FONT ></TD ></TR ></TABLE ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="screen" ><B CLASS="command" ># gzip tldp-xsl-xxxxx.tar</B ></PRE ></FONT ></TD ></TR ></TABLE ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="screen" ><B CLASS="command" ># mv tldp-html*.xsl /usr/local/dbtools/docbook-xsl/html</B ></PRE ></FONT ></TD ></TR ></TABLE ></DIV ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="AEN577" ></A >5.4. Setting up sitemap.xmap</H2 ><P >$COCOON_HOME points to the Cocoon Web Application Directory. This directory is typically <TT CLASS="filename" >/usr/local/jakarta-tomcat-4.1.9/webapps/cocoon/</TT ></P ><P >Create a directory named <TT CLASS="filename" >docbook</TT > under the <TT CLASS="filename" >$COCOON_HOME/mount</TT >. This is where we will put all our DocBook XML 4.1.2 content.</P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="screen" ><B CLASS="command" ># mkdir $COCOON_HOME/mount/docbook</B ></PRE ></FONT ></TD ></TR ></TABLE ><P >Create a file name sitemap.xmap in the <TT CLASS="filename" >$COCOON_HOME/mount/docbook</TT > with the following content:</P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="screen" ><B CLASS="command" ># cd $COCOON_HOME/mount/docbook</B ></PRE ></FONT ></TD ></TR ></TABLE ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="screen" ><B CLASS="command" ># vi sitemap.xmap</B ></PRE ></FONT ></TD ></TR ></TABLE ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="screen" > <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0"> <!-- use the standard components --> <map:components> <map:generators default="file"/> <map:transformers default="xslt"/> <map:readers default="resource"/> <map:serializers default="html"/> <map:selectors default="browser"/> <map:matchers default="wildcard"/> <map:transformers default="xslt"/> </map:components> <map:pipelines> <map:pipeline> <map:match pattern=""> <map:generate src="samples.xml"/> <map:transform src="/usr/local/jakarta-tomcat-4.1.9/webapps/cocoon/mount/editor/stylesheets/simple-page2html.xsl"/> <map:serialize/> </map:match> <!-- respond to *.html requests with our docs processed by .xsl --> <map:match pattern="*.html"> <map:generate src="{1}.xml"/> <map:transform src="/usr/local/dbtools/docbook-xsl/html/tldp-html.xsl"/> <map:serialize type="html"/> </map:match> <!-- later, respond to *.pdf requests with our docs processed by doc2pdf.xsl --> <map:match pattern="*.pdf"> <map:generate src="{1}.xml"/> <map:transform src="/usr/local/dbtools/docbook-xsl/fo/docbook.xsl"/> <map:serialize type="fo2pdf"/> </map:match> <map:match pattern="*.xml"> <map:generate src="{1}.xml"/> <map:serialize type="xml"/> </map:match> </map:pipeline> </map:pipelines> </map:sitemap> </PRE ></FONT ></TD ></TR ></TABLE ></DIV ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="AEN593" ></A >5.5. Accessing DocBook 4.1.2 XML Content from a Web Browser</H2 ><P >Place a DocBook 4.1.2 XML file in the <TT CLASS="filename" >$COCOON_HOME/mount/docbook/</TT > directory.</P ><P >A sample file is available from <A HREF="http://www.xml-dev.com:8080/cocoon/mount/docbook/openjade.xml" TARGET="_top" >http://www.xml-dev.com:8080/cocoon/mount/docbook/openjade.xml</A >.</P ><P >Now you can access the document using a browser at http://localhost:8080/cocoon/mount/sample.html (HTML) or http://localhost:8080/cocoon/mount/sample.pdf (PDF).</P ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="x456.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="x600.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Using OpenJade</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" > </TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Further Information</TD ></TR ></TABLE ></DIV ></BODY ></HTML >