Le fichier XML (sans association de la feuille de style)
<?xml version="1.0"?>
<page>
 <title>Hello Cocoon friend</title>
 <content>Here is some content :)  </content> 
 <comment>Written by DKS/Tecfa, adapted from S.M./the Cocoon samples </comment>
</page>
 
Le "fichier" XHTML résultant que l'on désire obtenir
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><title>Hello Cocoon friend</title></head><body bgcolor="#ffffff">
 <h1 align="center">Hello Cocoon friend</h1>
 <p align="center"> Here is some content :) </p> 
 <hr> Written by DKS/Tecfa, adapted from S.M./the Cocoon samples
  </body></html>
 
Le fichier XSL 
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="page">
.....
   <html> <head> <title> <xsl:value-of select="title"/> 
</title> </head>
    <body bgcolor="#ffffff">
     <xsl:apply-templates/>
    </body>
   </html>
  </xsl:template>
 
  <xsl:template match="title">
   <h1 align="center"> <xsl:apply-templates/>
 </h1>
  </xsl:template>
 
  <xsl:template match="content">
   <p align="center"> <xsl:apply-templates/> </p>
  </xsl:template>
 
  <xsl:template match="comment">
   <hr /> <xsl:apply-templates/>
  </xsl:template>
</xsl:stylesheet>