xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wang, Pin-Chieh" <Pin-Chieh.W...@COMPAQ.com>
Subject RE: Tomcat+Cocoon+FOP
Date Mon, 29 May 2000 20:35:44 GMT
Hi,
I like to do the same as you did, can you tell me where to get the files
(CPAN ?) and what files. I have Linux 6.1 running apache with mod_perl.
Thanks,
PC Wang


		-----Original Message-----
		From:	Stefano Carlini [mailto:stefanocarlini@hotmail.com]
		Sent:	Sunday, May 28, 2000 5:29 AM
		To:	general@xml.apache.org
		Subject:	Tomcat+Cocoon+FOP

		I had some problems in configuring Tomcat Framework and
Cocoon to work 
		properly with FOP.

		Once you had Cocoon built, I configured the servlet engine
to use Cocoon and
		instructed it on which requests should be handled by Cocoon.
		First, I added the following lines to tomcat.bat file (I
work in a Windows98 
		platform):

		set CLASSPATH=.
		set CLASSPATH=%TOMCAT_HOME%\classes

		rem Cocoon classes and libraries
		set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\xerces_1_0_3.jar
		set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\xalan_1_0_0.jar
		set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\fop_0_12_1.jar
		set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\cocoon.jar

		set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\webserver.jar
		set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\jasper.jar
		set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\xml.jar
		set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\servlet.jar
		set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\tools.jar

		Second, I copied the cocoon.properties file from the Cocoon
root directory
		into <TOMCAT_HOME>\conf\.

		Third, I Inserted the following entries into the engine
configuration file
		(<TOMCAT_HOME>\conf\web.xml):

		    <servlet>
		        <servlet-name>
		            org.apache.cocoon.Cocoon
		        </servlet-name>
		        <servlet-class>
		            org.apache.cocoon.Cocoon
		        </servlet-class>
		        <init-param>
		            <param-name>
		                properties
		            </param-name>
		            <param-value>
		                <TOMCAT_HOME>\conf\cocoon.properties
		            </param-value>
		        </init-param>
		    </servlet>
		    <servlet-mapping>
		        <servlet-name>
		            org.apache.cocoon.Cocoon
		        </servlet-name>
		        <url-pattern>
		            *.xml
		        </url-pattern>
		    </servlet-mapping>


		The URL http://<hostname>:<port>/Cocoon.xml has been
properly accessed from 
		my Web Browser.
		No error occurred.

		Next, I put the following file


		<?xml version="1.0"?>

		<?cocoon-process type="xslt"?>
		<?xml-stylesheet href="XSL/JavaXML.fo.xsl" type="text/xsl"?>

		<book>
		<cover>
		  <title>Title</title>
		   <author>Author's First And last Name</author>
		</cover>

		<contents>
		  <chapter id="chapterOne">
		   <title>Chapter 1: Introduction</title>

		   <paragraph>Paragraph One.</paragraph>

		   <paragraph>Paragraph Two.</paragraph>
		  </chapter>

		</contents>
		</book>

		in the directory <TOMCAT_HOME>\webapps as chapterOne.xml

		and the XSL file

		<xsl:stylesheet version="1.0"
		  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
		  xmlns:fo="http://www.w3.org/1999/XSL/Format">

		  <xsl:template match="book">
		    <xsl:processing-instruction name="cocoon-format">
		      type="text/xslfo"
		    </xsl:processing-instruction>
		    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
		      <fo:layout-master-set>
		      <fo:simple-page-master
		        page-master-name="right"
		        margin-top="75pt"
		        margin-bottom="25pt"
		        margin-left="100pt"
		        margin-right="50pt">
		        <fo:region-body margin-bottom="50pt"/>
		        <fo:region-after extent="25pt"/>
		      </fo:simple-page-master>
		      <fo:simple-page-master
		        page-master-name="left"
		        margin-top="75pt"
		        margin-bottom="25pt"
		        margin-left="50pt"
		        margin-right="100pt">
		        <fo:region-body margin-bottom="50pt"/>
		        <fo:region-after extent="25pt"/>
		      </fo:simple-page-master>
		      </fo:layout-master-set>

		      <fo:page-sequence>

		        <fo:sequence-specification>
		          <fo:sequence-specifier-alternating
		            page-master-first="right"
		            page-master-odd="right"
		            page-master-even="left"/>
		        </fo:sequence-specification>

		        <fo:static-content flow-name="xsl-after">
		          <fo:block text-align-last="centered"
font-size="10pt">
		            <fo:page-number/>
		          </fo:block>
		        </fo:static-content>

		        <fo:flow>
		          <xsl:apply-templates/>
		        </fo:flow>
		      </fo:page-sequence>

		    </fo:root>
		  </xsl:template>

		  <xsl:template match="cover/title">
		    <fo:block font-size="36pt" text-align-last="centered"
		              space-before.optimum="24pt">
		      <xsl:apply-templates/>
		    </fo:block>
		  </xsl:template>

		  <xsl:template match="author">
		    <fo:block font-size="24pt" text-align-last="centered"
		              space-before.optimum="24pt">
		      <xsl:apply-templates/>
		    </fo:block>
		  </xsl:template>

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

		  <xsl:template match="chapter/title">
		    <fo:block font-size="24pt" text-align-last="centered"
		              space-before.optimum="24pt">
		      <xsl:apply-templates/>
		    </fo:block>
		  </xsl:template>

		  <xsl:template match="paragraph">
		    <fo:block font-size="12pt" space-before.optimum="12pt"
		              text-align="justified">
		      <xsl:apply-templates/>
		    </fo:block>
		  </xsl:template>
		</xsl:stylesheet>

		in the directory <TOMCAT_HOME>\webapps\ROOT\XSL as
JavaXML.fo.xsl

		I typed the URL http://<hostname>:<port>/chapterOne.xml,
		but the only output I viewed was been ( -:((( ):

		type="text/xslfo"

		Someone can help me???
		Thanks in advanced.

		Stefano.
	
________________________________________________________________________
		Get Your Private, Free E-mail from MSN Hotmail at
http://www.hotmail.com


	
---------------------------------------------------------------------
		In case of troubles, e-mail:     webmaster@xml.apache.org
		To unsubscribe, e-mail:
general-unsubscribe@xml.apache.org
		For additional commands, e-mail: general-help@xml.apache.org

Mime
View raw message