«^»
9 Using the TEI Stylesheets

To download the TEI Stylesheets, go to http://tei.sf.net/ and click on the Released Files link that is towards the bottom of the page. On the new page, there is a table of packages. One of these is the Stylesheets package. This has a Release number such as 5.2.9. Click on the Download button that is on the same line. On the new page, there is a link that is labelled something like tei-xsl-5.2.9.zip. Click on this link. On the new page, click on the Download link that is on a line for a suitable mirror site. On the new page, it says that the download will start automatically. Save the download into a directory on your computer such as c:\install.

Now issue the commands:

cd c:\cocoon-2.1.7\build\webapp
mkdir hwtei
cd hwtei
mkdir content
mkdir style
cd style
jar xf c:\install\tei-xsl-5.2.9.zip
move tei-xsl-5.2.9 tei
That has created a big directory called:
c:\cocoon-2.1.7\build\webapp\hwtei\style\tei

Now use a text editor to create the file

c:\cocoon-2.1.7\build\webapp\hwtei\content\hello.xml
It should contain the following lines:
0021: <?xml version="1.0"?>
0022: <TEI.2>
0023:   <teiHeader>
0024:     <fileDesc>
0025:       <titleStmt>
0026:         <title>Hello World! page</title>
0027:       </titleStmt>
0028:       <publicationStmt>
0029:         <date>2006-01-08</date>
0030:       </publicationStmt>
0031:     </fileDesc>
0032:   </teiHeader>
0033:   <text>
0034:     <body>
0035:       <div>
0036:         <head>Introduction</head>
0037:         <p>This is an introduction to my latest Cocoon page!</p>
0038:       </div>
0039:       <div>
0040:         <head>Hello</head>
0041:         <p>This is my latest Cocoon page!</p>
0042:       </div>
0043:     </body>
0044:   </text>
0045: </TEI.2>
Note: once again do not include the line numbers (and the colons).

Use a text editor to create the file:

c:\cocoon-2.1.7\build\webapp\hwtei\sitemap.xmap

It should contain the lines:

0046: <?xml version="1.0"?>
0047: <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
0048:  <map:pipelines>
0049:   <map:pipeline>
0050:    <map:match pattern="">
0051:     <map:generate src="content/hello.xml"/>
0052:     <map:serialize type="xml"/>
0053:    </map:match>
0054:    <map:match pattern="hello.html">
0055:     <map:generate src="content/hello.xml"/>
0056:     <map:transform src="style/tei/p4/html/tei.xsl"/>
0057:     <map:serialize type="html"/>
0058:    </map:match>
0059:    <map:match pattern="hello.pdf">
0060:     <map:generate src="content/hello.xml"/>
0061:     <map:transform src="style/tei/p4/fo/tei.xsl"/>
0062:     <map:serialize type="fo2pdf"/>
0063:    </map:match>
0064:   </map:pipeline>
0065:  </map:pipelines>
0066: </map:sitemap>
Note: once again do not include the line numbers (and the colons).

Now go to the URL http://localhost:8888/hwtei/. This will output the XML. And if you go to http://localhost:8888/hwtei/hello.html the XML will be transformed into HTML using the TEI-to-HTML stylesheets. And if you go to http://localhost:8888/hwtei/hello.pdf the XML will be transformed into PDF using the TEI-to-FO stylesheets.