You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by st...@apache.org on 2003/06/17 03:32:46 UTC

cvs commit: cocoon-2.1/src/blocks/linotype/samples/repository/news/2 document.xml

stefano     2003/06/16 18:32:46

  Added:       src/blocks/linotype/samples/screens login.jx notfound.jx
                        logout.jx
               src/blocks/linotype/samples/images cocoon.jpg resizer.gif
                        linotype.jpg hand.jpg separator2.jpg cc.gif rss.gif
                        resizer.png foaf.gif image.jpg separator1.jpg
                        separator4.jpg separator3.jpg
               src/blocks/linotype/samples/images/icons bold.gif
                        outdent.gif indent.gif paragraphize.gif
                        horizontalrule.gif quote.gif unorderedlist.gif
                        image.gif italic.gif strikethrough.gif
                        removeformat.gif orderedlist.gif unlink.gif
                        link.gif
               src/blocks/linotype/samples/stylesheets
                        news2html-homepage.xslt directory2cinclude.xslt
                        news2html-content.xslt news2html-private.xslt
                        request2news.xslt news2rss-0.91.xslt
                        news2html-single.xslt news2html-history.xslt
                        news2rss-2.0.xslt news2edit.xslt
               src/blocks/linotype/samples/scripts editor.js
               src/blocks/linotype/lib .cvsignore
               src/blocks/linotype/samples/repository/news/template
                        document.xml
               src/blocks/linotype/samples flow.js
                        linotype.users.properties sitemap.xmap index.xhtml
               src/blocks/linotype/misc rss.psd powered by cocoon.psd
                        image.psd resizer.psd linotype.gif geourl.psd
               src/blocks/linotype/samples/repository/news/1 document.xml
               src/blocks/linotype/java/org/apache/cocoon/components
                        Repository.java UserManager.java
               src/blocks/linotype/conf linotype.xsamples
               src/blocks/linotype/samples/stylesheets/system
                        error2html-debug.xslt
               src/blocks/linotype README.txt TODO.txt
               src/blocks/linotype/samples/styles main.css editor.css
                        editor_page.css
               src/blocks/linotype/samples/repository/news/2 document.xml
  Log:
  Linotype lands
  
  Revision  Changes    Path
  1.1                  cocoon-2.1/src/blocks/linotype/samples/screens/login.jx
  
  Index: login.jx
  ===================================================================
  <html xmlns:t="http://apache.org/cocoon/templates/jx/1.0">
  <head>
   <title>Login</title>
   <link rel="stylesheet" type="text/css" href="#{$request/contextPath}/styles/main.css"/>
   <style>
    h1 { text-align: center; }
   </style>
  </head>
  
  <body>
  
  <h1>Private Area</h1>
  
  <form action="#{$continuation/id}.kont" method="POST">
   
   <table align="center">
    <tr>
     <td align="right">Name</td>
     <td>
      <input type="text" size="15" name="username" value="#{username}"/>
      <t:if test="#{userError != ''}">
       &lt;-- <span style="color:red">#{userError}</span>
      </t:if>
     </td>
    </tr>
  
    <tr>
     <td align="right">Password</td>
     <td>
      <input type="password" size="15" name="password"/>
      <t:if test="#{passError != ''}">
       &lt;-- <span style="color:red">#{passError}</span>
      </t:if>
     </td>
    </tr>
  
    <tr>
     <td colspan="2" align="right"><input type="submit" value="Login ->"/></td> 
    </tr>
   </table>
  </form>
  
  </body>
  </html>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/screens/notfound.jx
  
  Index: notfound.jx
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <html>
  
  <head>
   <title>Page Not Found</title>
   <link rel="stylesheet" type="text/css" href="#{$request/contextPath}/styles/main.css" />
   <style>
    h1 { text-align: center; }
    div.block { padding: 0px 30% 0px 30% }
   </style>
  </head>
  <body>
  
  <h1>Page Not Found</h1>
  <div class="block">
    <p>I'm terribly sorry, but I can't find the page you have requested.</p>
    <p>I sware to god, I looked for it! Really. You can't even imagine the 
    millions of calculations that I had to go thru to look in all places
    where my owner could have left it. But I couldn't find it :-(</p>
    <p>No, it's not your fault, it's all my own. I'm a bad server. I know that. Terrible.
    I should get a new job one day or another, but what else can I do?</p>
    <p>Look: the only thing I can suggest you is to go to the 
    <a href="#{$request/contextPath}/">home page</a> and look for the page you wanted from there.
    I can guarantee you I know where that one is :-)</p>
  </div>
  
  </body>
  </html>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/screens/logout.jx
  
  Index: logout.jx
  ===================================================================
  <html>
  <head>
   <title>Bye!</title>
   <META HTTP-EQUIV="refresh" CONTENT="2;URL=#{$request/contextPath}/"/>
   <link rel="stylesheet" type="text/css" href="#{$request/contextPath}/styles/main.css"/>
  </head>
  <body>
  
  <h1 align="center"><a href="#{$request/contextPath}/">See ya!</a></h1>
  
  </body>
  </html>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/images/cocoon.jpg
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/images/resizer.gif
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/images/linotype.jpg
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/images/hand.jpg
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/images/separator2.jpg
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/images/cc.gif
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/images/rss.gif
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/images/resizer.png
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/images/foaf.gif
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/images/image.jpg
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/images/separator1.jpg
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/images/separator4.jpg
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/images/separator3.jpg
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/images/icons/bold.gif
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/images/icons/outdent.gif
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/images/icons/indent.gif
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/images/icons/paragraphize.gif
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/images/icons/horizontalrule.gif
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/images/icons/quote.gif
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/images/icons/unorderedlist.gif
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/images/icons/image.gif
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/images/icons/italic.gif
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/images/icons/strikethrough.gif
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/images/icons/removeformat.gif
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/images/icons/orderedlist.gif
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/images/icons/unlink.gif
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/images/icons/link.gif
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/stylesheets/news2html-homepage.xslt
  
  Index: news2html-homepage.xslt
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  
  <xsl:stylesheet version="1.0" 
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
   xmlns:n="http://www.betaversion.org/linotype/news/1.0"
   xmlns:h="http://www.w3.org/1999/xhtml"
  >
    
    <xsl:param name="home"/>
    <xsl:param name="count"/>
    
    <xsl:template match="/">
     <xsl:for-each select="//n:news[@online = 'on']">
      <xsl:if test="position() &lt;= number($count)">
       <xsl:apply-templates select="."/>
      </xsl:if>
     </xsl:for-each>
    </xsl:template>
    
    <xsl:template match="n:news">
     <xsl:variable name="id" select="../@id"/>
     <div class="news">
      <h1><img src="images/hand.jpg" alt=""/><xsl:value-of select="n:title"/></h1>
      <h2><xsl:value-of select="@creation-date"/></h2>
      <xsl:apply-templates select="h:body"/>
      <div class="info">Posted at <xsl:value-of select="@creation-time"/> | <a class="permalink" href="{$home}/news/{$id}/">Permalink</a></div>
      <div class="separator"><img align="center" src="images/separator1.jpg"/></div>
     </div>
    </xsl:template>
    
    <xsl:template name="find-id">
     <xsl:param name="node"/>
     <xsl:choose>
      <xsl:when test="$node/@id">
       <xsl:value-of select="$node/@id"/>
      </xsl:when>
      <xsl:when test="not($node)"/>
      <xsl:otherwise>
       <xsl:call-template name="find-id">
        <xsl:with-param name="node" select="$node/.."/>
       </xsl:call-template>
      </xsl:otherwise>
     </xsl:choose>
    </xsl:template>
    
    <xsl:template match="h:body">
     <div class="body">
      <xsl:apply-templates/>
     </div>
    </xsl:template>
    
    <xsl:template match="@src" priority="1">
     <xsl:variable name="id"><xsl:call-template name="find-id"><xsl:with-param name="node" select=".."/></xsl:call-template></xsl:variable>
     <xsl:choose>
      <xsl:when test="starts-with(.,'http://')">
       <xsl:copy>
        <xsl:apply-templates/>
       </xsl:copy>
      </xsl:when>
      <xsl:otherwise>
       <xsl:attribute name="src">news/<xsl:value-of select="$id"/>/<xsl:value-of select="."/></xsl:attribute>
      </xsl:otherwise>
     </xsl:choose>
    </xsl:template>
  
    <!--xsl:template match="h:p[1]">
     <xsl:copy>
      <span class="firstletter"><xsl:value-of select="substring(text()[1],1,1)"/></span>
      <span class="first"><xsl:value-of select="substring(substring-before(text()[1],' '),2)"/></span>
      <xsl:text> </xsl:text><xsl:value-of select="substring-after(text()[1],' ')"/>
      <xsl:apply-templates select="text()[position() &gt; 1]|@*|*"/>
     </xsl:copy>
    </xsl:template-->
    
    <xsl:template match="h:p[1]">
     <p class="first">
      <xsl:apply-templates/>
     </p>
    </xsl:template>
    
    <xsl:template match="hr">
    	<div class="separator"><img src="images/separator2.jpg"/></div>
    </xsl:template>
      
    <xsl:template match="@*|node()">
     <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
     </xsl:copy>
    </xsl:template>
       
  </xsl:stylesheet>
  
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/stylesheets/directory2cinclude.xslt
  
  Index: directory2cinclude.xslt
  ===================================================================
  <?xml version="1.0"?>
  
  <xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:dir="http://apache.org/cocoon/directory/2.0"
   xmlns:include="http://apache.org/cocoon/include/1.0"
  >
   
    <xsl:param name="prefix"/>
      
    <xsl:template match="/">
     <list>
      <xsl:apply-templates/>
     </list>
    </xsl:template>
  
    <xsl:template match="dir:directory/dir:directory[not(starts-with(@name,'template')) and not(starts-with(@name,'CVS'))]">
      <element id="{@name}">
       <include:include src="cocoon:/{$prefix}/{@name}.xml"/>
      </element>
    </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/stylesheets/news2html-content.xslt
  
  Index: news2html-content.xslt
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  
  <xsl:stylesheet version="1.0" 
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
   xmlns:n="http://www.betaversion.org/linotype/news/1.0" 
   xmlns:h="http://www.w3.org/1999/xhtml"
  >
    
    <xsl:param name="home"/>
    
    <xsl:template match="/">
     <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
       <link rel="stylesheet" type="text/css" href="{$home}/styles/main.css"/>
       <link rel="stylesheet" type="text/css" href="{$home}/styles/editor_page.css"/>
      </head>
      <body class="body">
       <xsl:apply-templates select="n:news/h:body"/>
      </body>
     </html>
    </xsl:template>
    
    <xsl:template match="h:strong">
     <b><xsl:apply-templates/></b>
    </xsl:template>
    
    <xsl:template match="h:em">
     <i><xsl:apply-templates/></i>
    </xsl:template>
    
    <xsl:template match="@*|node()">
     <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
     </xsl:copy>
    </xsl:template>
       
  </xsl:stylesheet>
  
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/stylesheets/news2html-private.xslt
  
  Index: news2html-private.xslt
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:n="http://www.betaversion.org/linotype/news/1.0">
      
    <xsl:param name="home"/>
    
    <xsl:template match="/">
     <html>
      <head>
       <title>News List</title>
       <link rel="stylesheet" type="text/css" href="{$home}/styles/main.css"/>
      </head>
      <body>
      
  <div id="sidebar">
   <a href="{$home}/"><img alt="Linotype" src="{$home}/images/linotype.jpg" width="156px" height="207px" /></a>
  </div>
  
  <div id="bottombar">
   <a href="http://cocoon.apache.org" title="Apache Cocoon"><img alt="Powered by Cocoon" src="{$home}/images/cocoon.jpg"/></a>
  </div>
  
  <div id="page">
   <h1>News List</h1>
   <h2>where the juice is</h2>
   <h3><a href="edit/news/template/">Write a news</a> | <a href="logout">Logout</a></h3>
   <xsl:apply-templates select="//n:news"/>
  </div>
      
      </body>
     </html>
    </xsl:template>
    
    <xsl:template match="n:news">
     <xsl:variable name="id" select="../@id"/>
     <div class="news" online="{@online}">
      <h1><img src="{$home}/images/hand.jpg" alt=""/><a href="edit/news/{$id}/"><xsl:value-of select="n:title"/></a></h1>
      <h2><xsl:value-of select="@creation-date"/> ~ <xsl:value-of select="@creation-time"/></h2>
     </div>
    </xsl:template>
      
  </xsl:stylesheet>
  
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/stylesheets/request2news.xslt
  
  Index: request2news.xslt
  ===================================================================
  <?xml version="1.0"?>
  
  <xsl:stylesheet version="1.0" 
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
   xmlns:r="http://apache.org/cocoon/request/2.0" 
   xmlns:h="http://www.w3.org/1999/xhtml"
   xmlns="http://www.w3.org/1999/xhtml"
  >
  
    <xsl:template match="/">
     <xsl:apply-templates select="//r:requestParameters"/>
    </xsl:template>
  
    <xsl:template match="r:requestParameters">
     <n:news online="{r:parameter[@name='online']/r:value}" xmlns:n="http://www.betaversion.org/linotype/news/1.0">
       <xsl:attribute name="author"><xsl:value-of select="r:parameter[@name='author']/r:value"/></xsl:attribute>
       <xsl:attribute name="creation-date"><xsl:value-of select="r:parameter[@name='date']/r:value"/></xsl:attribute>
       <xsl:attribute name="creation-time"><xsl:value-of select="r:parameter[@name='time']/r:value"/></xsl:attribute>
       <xsl:attribute name="creation-fulldate"><xsl:value-of select="r:parameter[@name='fulldate']/r:value"/></xsl:attribute>
       <n:title><xsl:value-of select="r:parameter[@name='title']/r:value"/></n:title>
       <xsl:apply-templates select="r:parameter[@name='xml:content']/r:value/h:html/h:body"/>
     </n:news>
    </xsl:template>
  
    <xsl:template match="h:b">
     <strong><xsl:apply-templates/></strong>
    </xsl:template>
    
    <xsl:template match="h:i">
     <em><xsl:apply-templates/></em>
    </xsl:template>
        
    <xsl:template match="node()|@*">
     <xsl:copy>
      <xsl:apply-templates select="node()|@*"/>
     </xsl:copy>
    </xsl:template>
    
  </xsl:stylesheet>
  
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/stylesheets/news2rss-0.91.xslt
  
  Index: news2rss-0.91.xslt
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  
  <xsl:stylesheet version="1.0" 
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
   xmlns:n="http://www.betaversion.org/linotype/news/1.0"
   xmlns:h="http://www.w3.org/1999/xhtml"
  >
    
    <xsl:param name="home"/>
    <xsl:param name="count"/>
    
    <xsl:template match="/">
     <rss version="0.91">
  	<channel>
       <title>Stefano's Linotype</title>
       <link>http://www.betaversion.org/~stefano/linotype/</link>
       <description>Stefano Mazzocchi's Weblog</description>
       <language>en</language>
       <xsl:apply-templates select="(//n:news[@online = 'on'])[position() &lt; number($count)]"/>
      </channel>
     </rss>
    </xsl:template>
    
    <xsl:template match="n:news">
     <item>
      <title><xsl:value-of select="n:title"/></title>
  	<link><xsl:value-of select="$home"/>/<xsl:value-of select="../@id"/>/</link>
  	<description><xsl:apply-templates/></description>
     </item>
    </xsl:template>
  
    <xsl:template match="node()|@*">
     <xsl:copy>
      <xsl:apply-templates select="node()|@*"/>
     </xsl:copy>
    </xsl:template>
           
  </xsl:stylesheet>
  
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/stylesheets/news2html-single.xslt
  
  Index: news2html-single.xslt
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  
  <xsl:stylesheet version="1.0" 
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
   xmlns:n="http://www.betaversion.org/linotype/news/1.0" 
   xmlns:h="http://www.w3.org/1999/xhtml"
  >
    
    <xsl:param name="home"/>
    
    <xsl:template match="n:news">
  <html xml:lang="en" lang="en">
  
   <head>
    <title>Stefano's Linotype ~ <xsl:value-of select="n:title"/></title>
  
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  
    <meta name="DC.title" content="{n:title}"/>
    <meta name="DC.author.personalName" content="Stefano Mazzocchi"/>
    <meta name="keywords" lang="en" content="{n:keywords}"/>
    <meta name="DC.date.created" content="{@creation-date}"/>
    <meta name="DC.date.lastModified" content="{@creation-date}"/>
    <meta name="DC.identifier" content="http://www.betaversion.org/~stefano/linotype/"/>
    
    <link rel="stylesheet" href="{$home}/styles/main.css" type="text/css"/>
    
    <rdf:RDF xmlns="http://web.resource.org/cc/"
      xmlns:dc="http://purl.org/dc/elements/1.1/"
      xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
     <Work rdf:about="">
      <license rdf:resource="http://creativecommons.org/licenses/by-nc-sa/1.0/" />
     </Work>
     <License rdf:about="http://creativecommons.org/licenses/by-nc-sa/1.0/">
      <requires rdf:resource="http://web.resource.org/cc/Attribution" />
      <requires rdf:resource="http://web.resource.org/cc/ShareAlike" />
      <permits rdf:resource="http://web.resource.org/cc/Reproduction" />
      <permits rdf:resource="http://web.resource.org/cc/Distribution" />
      <permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
      <prohibits rdf:resource="http://web.resource.org/cc/CommercialUse" />
      <requires rdf:resource="http://web.resource.org/cc/Notice" />
     </License>
    </rdf:RDF>
  
   </head>
   
  <body>
  
  <div id="bottombar">
   <a href="http://cocoon.apache.org" title="Apache Cocoon"><img alt="Powered by Cocoon" src="{$home}/images/cocoon.jpg"/></a>
  </div>
  
  <div id="sidebar">
   <a href="{$home}/private/"><img alt="Linotype" src="{$home}/images/linotype.jpg" width="156px" height="207px" /></a>
  </div>
  
  <div id="page">
   <div class="news">
    <h1><img src="{$home}/images/hand.jpg" alt=""/><xsl:value-of select="n:title"/></h1>
    <h2><xsl:value-of select="@creation-date"/> ~ <xsl:value-of select="@creation-time"/></h2>
    <div class="body">
     <xsl:apply-templates select="h:body"/>
    </div>
   </div>
  </div>
  
  <div id="footer">
   <a href="http://creativecommons.org/licenses/by-nc-sa/1.0/" title="Creative Commons: some rights reserved"><img alt="Creative Commons License" src="{$home}/images/cc.gif"/></a>
  </div>
  
  </body>
  </html>
    </xsl:template>
    
    <xsl:template match="@*|node()">
     <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
     </xsl:copy>
    </xsl:template>
       
  </xsl:stylesheet>
  
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/stylesheets/news2html-history.xslt
  
  Index: news2html-history.xslt
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:n="http://www.betaversion.org/linotype/news/1.0">
      
    <xsl:param name="home"/>
    
    <xsl:template match="/">
     <html>
      <head>
       <title>News History</title>
       <link rel="stylesheet" type="text/css" href="{$home}/styles/main.css"/>
      </head>
      <body>
      
  <div id="sidebar">
   <a href="{$home}/"><img alt="Linotype" src="{$home}/images/linotype.jpg" width="156px" height="207px" /></a>
  </div>
  
  <div id="bottombar">
   <a href="http://cocoon.apache.org" title="Apache Cocoon"><img alt="Powered by Cocoon" src="{$home}/images/cocoon.jpg"/></a>
  </div>
  
  <div id="page">
   <h1>News History</h1>
   <h2>The whole braindump</h2>
   <xsl:apply-templates select="//n:news[@online = 'on']"/>
  </div>
      
      </body>
     </html>
    </xsl:template>
    
    <xsl:template match="n:news">
     <xsl:variable name="id" select="../@id"/>
     <div class="news" online="{@online}">
      <h1><img src="{$home}/images/hand.jpg" alt=""/><a href="news/{$id}/"><xsl:value-of select="n:title"/></a></h1>
      <h2><xsl:value-of select="@creation-date"/> ~ <xsl:value-of select="@creation-time"/></h2>
     </div>
    </xsl:template>
      
  </xsl:stylesheet>
  
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/stylesheets/news2rss-2.0.xslt
  
  Index: news2rss-2.0.xslt
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  
  <xsl:stylesheet version="1.0" 
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
   xmlns:n="http://www.betaversion.org/linotype/news/1.0"
   xmlns:h="http://www.w3.org/1999/xhtml"
  >
    
    <xsl:param name="home"/>
    <xsl:param name="count"/>
    
    <xsl:template match="/">
     <rss version="2.0">
  	<channel>
       <title>Stefano's Linotype</title>
       <link>http://www.betaversion.org/~stefano/linotype/</link>
       <description>Stefano Mazzocchi's weblog</description>
       <language>en</language>
       <copyright>Copyright 2003 Stefano Mazzocchi. Some rights reserved.</copyright>
       <lastBuildDate><xsl:value-of select="(//n:news[@online = 'on'])[1]/@creation-fulldate"/></lastBuildDate>
       <generator>Linotype 1.1</generator>
       <xsl:apply-templates select="(//n:news[@online = 'on'])[position() &lt; number($count)]"/>
      </channel>
     </rss>
    </xsl:template>
    
    <xsl:template match="n:news">
     <item>
      <title><xsl:value-of select="n:title"/></title>
  	<link><xsl:value-of select="$home"/>/<xsl:value-of select="../@id"/>/</link>
  	<description><xsl:apply-templates/></description>
      <pubDate><xsl:value-of select="@creation-fulldate"/></pubDate>
     </item>
    </xsl:template>
  
    <xsl:template match="node()|@*">
     <xsl:copy>
      <xsl:apply-templates select="node()|@*"/>
     </xsl:copy>
    </xsl:template>
           
  </xsl:stylesheet>
  
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/stylesheets/news2edit.xslt
  
  Index: news2edit.xslt
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <xsl:stylesheet version="1.0" 
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
   xmlns:n="http://www.betaversion.org/linotype/news/1.0" 
  >
  
    <xsl:param name="home"/>
    
    <xsl:template match="/">
     <html xmlns="http://www.w3.org/1999/xhtml">
  	<head>
  	 <title><xsl:value-of select="n:news/n:title"/></title> 
       <link rel="stylesheet" type="text/css" href="{$home}/styles/main.css"/>
       <link rel="stylesheet" type="text/css" href="{$home}/styles/editor.css"/>
   	 <script type="text/javascript"><![CDATA[
  		
  		function doAction(action) {
  		    var form = document.forms[0];
  
  			if (action == "delete") {
  				var agree = confirm("Are you sure you want to delete this news?");
  				if (!agree) return;
  			} else if (action == "revert") {
  				var content = document.getElementById("previous_innerHTML").firstChild.nodeValue;
  				if (content != "") {
  					var agree = confirm("Are you sure you want to restore content to the previous version?");
  					if (agree) loadContent(content);
  				}
  				return;
  			} else {
  				form.elements['date'].value = getDate();
  				form.elements['time'].value = getTime();
  				form.elements['fulldate'].value = getFullDate();
  				form.elements['innerHTML'].value = getInnerHTML();
  				form.elements['xml:content'].value = getContent();
  			}
  			
  			form.elements['action'].value = action;
  			form.submit();
  		}
  
  	 ]]></script>
   	 <script src="{$home}/scripts/editor.js" type="text/javascript"/>	 
       <noscript>
        <h1>Dude, you don't go anywhere around here without Javascript enabled. ;-)</h1>
       </noscript>
  	</head>
  	
  	<body onload="start(event)" onunload="stop(event)">
       <!--form name="data" action="/request" method="POST" enctype="multipart/form-data"-->
       <form name="data" action="{string('#{$continuation/id}')}.kont" method="POST" enctype="multipart/form-data">
  	  <input type="hidden" name="action"/>
  	  <input type="hidden" name="author" value="{string('#{userid}')}"/>
  	  <input type="hidden" name="date"/>
  	  <input type="hidden" name="time"/>
  	  <input type="hidden" name="fulldate"/>
  	  <input type="hidden" name="xml:content"/>
  	  <input type="hidden" name="innerHTML"/>
  
        <div id="toolbar">
         <table cellpadding="0" cellspacing="0">
          <tr>
  	     <td><div class="imagebutton" id="bold"><img src="{$home}/images/icons/bold.gif" alt="Strong" title="Strong"/></div></td>
    	     <td><div class="imagebutton" id="italic"><img src="{$home}/images/icons/italic.gif" alt="Emphasis" title="Emphasis"/></div></td>
    	     <td><div class="imagebutton" id="strikethrough"><img src="{$home}/images/icons/strikethrough.gif" alt="Error" title="Error"/></div></td>
    	     <td><div class="imagebutton" id="quote"><img src="{$home}/images/icons/quote.gif" alt="Quote" title="Quote"/></div></td>
    	     <td><div class="spacer"/></td>
    	     <td><div class="imagebutton" id="removeformat"><img src="{$home}/images/icons/removeformat.gif" alt="Remove Format" title="Remove Format"/></div></td>
    	     <td><div class="spacer"/></td>
  	     <td><div class="imagebutton" id="createlink"><img src="{$home}/images/icons/link.gif" alt="Link Selection" title="Link Selection"/></div></td>
  	     <td><div class="imagebutton" id="unlink"><img src="{$home}/images/icons/unlink.gif" alt="Unlink Selection" title="Unlink Selection"/></div></td>
    	     <td><div class="spacer"/></td>
  	     <td><div class="imagebutton" id="insertimage"><img src="{$home}/images/icons/image.gif" alt="Add Image" title="Add Image"/></div></td>
  	     <td><div class="imagebutton" id="inserthorizontalrule"><img src="{$home}/images/icons/horizontalrule.gif" alt="Add Horizontal Rule" title="Add Horizontal Rule"/></div></td>
    	     <td><div class="spacer"/></td>
  	     <td><div class="imagebutton" id="insertorderedlist"><img src="{$home}/images/icons/orderedlist.gif" alt="Ordered List" title="Ordered List"/></div></td>
  	     <td><div class="imagebutton" id="insertunorderedlist"><img src="{$home}/images/icons/unorderedlist.gif" alt="Unordered List" title="Unordered List"/></div></td>
    	     <td><div class="spacer"/></td>
  	     <td><div class="imagebutton" id="outdent"><img src="{$home}/images/icons/outdent.gif" alt="Outdent" title="Outdent"/></div></td>
  	     <td><div class="imagebutton" id="indent"><img src="{$home}/images/icons/indent.gif" alt="Indent" title="Indent"/></div></td>
  	     <td width="100%" align="center" nowrap="true">
  	      <span id="block_selector">Block: <select id="formatblock">
  	       <option value="">Normal</option>
  	       <option value="p">Paragraph</option>
  	       <option value="h1">Heading 1</option>
  	       <option value="h2">Heading 2</option>
  	       <option value="h3">Heading 3</option>
  	       <option value="h4">Heading 4</option>
  	      </select>
  	      </span>
  	      <span id="class_selector">Class: <select id="alternatives"><option>whatever</option></select></span>
  	     </td>
  	     <td nowrap="true">
  	      <input type="checkbox" name="online">
  	       <xsl:if test="n:news/@online='on'"><xsl:attribute name="checked">true</xsl:attribute></xsl:if>
  	      </input>
  	      <label for="online">published</label>
  	     </td>
  	    </tr>
  	   </table>
  	  </div>
  	  
  	  <xsl:apply-templates/>
  
  	  <div id="controls">
  	   <!--Version: <select name="version">
  	    <t:forEach select="{string('#{versions}')}" xmlns:t="http://apache.org/cocoon/templates/jx/1.0">
  	     <option>#{.}</option>
  	    </t:forEach>
  	   </select>
  	   <input type="button" value="Restore" onclick="doAction('restore')"/--> 
  	   <input type="button" value="Revert" onclick="doAction('revert')"/> 
  	   <input type="button" value="Delete" onclick="doAction('delete')"/> 
  	   <input type="button" value="Save" onclick="doAction('save')"/>
  	   <input type="button" value="Finish" onclick="doAction('finish')"/>
  	  </div>
  	  
  	 </form>
  	</body>
     </html>
    </xsl:template>
    
    <xsl:template match="n:news">
      	
  	<div id="page">
  	 <div class="field">Title:<br/><input type="text" name="title" size="40" value="{n:title}"/></div>
  
  	 <div id="image_inputs"/>
  
  	 <div class="field">
  	  <table cellpadding="0" cellspacing="0">
  	   <tr>
  	    <td align="left">Content:</td>
  	    <td align="right" width="100%"><input type="checkbox" id="wysiwyg-checkbox" onclick="wysiwyg(!this.checked)"/>WYSIWYG</td>
  	   </tr>
  	  </table>
  	  <iframe id="edit" src="content" width="100%" height="400px" scrolling="auto" frameborder="0">Get a modern browser</iframe>
  	  <div id="path">...</div>
  	 </div>
  	 
  	 <div id="previous_innerHTML">#{innerHTML}</div>
  	</div>
  
    </xsl:template>
     
  </xsl:stylesheet>
  
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/scripts/editor.js
  
  Index: editor.js
  ===================================================================
  // -------------------------- global DOM nodes ------------------------------
  
  var iframe;
  var editor;
  var editor_window;
  var path;
  var formatblock;
  var alternatives;
  var alternativesTarget;
  var class_selector;
  var block_selector;
  var lastOrigin;
  var image_inputs;
  var image_controls;
  
  // -------------------------- global variables ------------------------------
  
  var previousKey;
  var modified = false;
  
  var imageCounter = 0;
  var imageData = {};
  
  var sourceMode = false;
  
  // ----------------------- UI-modifying functions ---------------------------
  
  function start(e) {
      iframe = document.getElementById('edit');
      editor_window = iframe.contentWindow;
      editor = editor_window.document;
  
      path = document.getElementById('path').firstChild;
      formatblock = document.getElementById('formatblock');
      formatblock.onchange = formatblockChange;
      alternatives = document.getElementById('alternatives');
      block_selector = document.getElementById('block_selector');
      class_selector = document.getElementById('class_selector');
      image_inputs = document.getElementById('image_inputs');
      image_controls = document.getElementById('image_controls');
  
      try {
          editor.designMode = "on";
          editor.execCommand("useCSS", false, true); // midas gets it backwards
          editor.addEventListener("click",click,true);
          editor.addEventListener("keypress",keypress,true);
      } catch (e) {
          alert("I'm sorry, but Linotype doesn't work on this browser: " + e);
          return;
      }
  
      divs = document.getElementsByTagName('div');
  
      for (var i = 0; i < divs.length; i++) {
          if (divs[i].getAttribute("class") == "imagebutton") {
              divs[i].onmousedown = buttonDown;
              divs[i].onmouseup = buttonUp;
              divs[i].onmouseover = buttonOver;
              divs[i].onmouseout = buttonOut;
              divs[i].onclick = buttonClick;
          }
      }
  
      instrumentImages(editor);
  
      document.getElementById("wysiwyg-checkbox").checked = true;
  
      window.status = "Welcome to Linotype";
  }
  
  function stop(e) {
  
      /*
       * FIXME (SM): the onload() event isn't cancellable. This means that we can't
       * prevent people from unloading the page and loose their changes. In IE
       * there is a non-standard way to do this which is hacky at hell but does
       * the job. Is there an equivalent thing for moz?
       */
  
      if (modified) {
          // if ( window.confirm("You havn't saved. You changes will be lost.\nDo you want to continue?") ) {
          // 	return;
          // } else {
          //	e.stopPropagation();
          //	e.preventDefault();
          //	e.returnValue = false;
          //	return false;
          // }
      }
  }
  
  function updateUI(force) {
      var target = getOrigin();
      if (target != lastOrigin || force) {
          lastOrigin = target;
          
          if (!sourceMode) {
  	        path.nodeValue = getPath(target);
  	    } else {
  	    	path.nodeValue = "...";
  	    }
          
          if (target && (target.nodeType == target.TEXT_NODE)) {
              target = target.parentNode;
          }
          
          var format = getBlockFormat(target);
          if (format) {
          	formatblock.selectedIndex = format;
          	block_selector.style.visibility = "visible";
          } else {
          	block_selector.style.visibility = "hidden";
          }
          
          var options = getAlternatives(target);
          if (options) {
              var parent = alternatives.parentNode;
              parent.removeChild(alternatives);
              alternatives = document.createElement('select');
              var type = target.getAttribute("class");
              for (i = 0; i < options.length; i++) {
                  var option = document.createElement('option');
                  option.setAttribute("value",options[i]);
                  if (type == options[i]) {
                      option.setAttribute("selected","true");
                  }
                  option.appendChild(document.createTextNode(options[i]));
                  alternatives.appendChild(option);
              }
              alternatives.onchange = alternativesChange;
              parent.appendChild(alternatives);
              alternativesTarget = target;
              class_selector.style.visibility = "visible";
          } else {
              class_selector.style.visibility = "hidden";
          }
      }
  }
  
  function wysiwyg(enabled) {
      if (enabled) {
          var text = serializeChildren(editor.body);
          var source = document.createTextNode(text);
          editor.body.innerHTML = "";
          editor.body.appendChild(source);
          editor.body.setAttribute("class","source");
          sourceMode = true;
          updateUI(true);
      } else {
          var source = editor.body.ownerDocument.createRange();
          source.selectNodeContents(editor.body);
          editor.body.innerHTML = resume(source.toString());
          editor.body.setAttribute("class","body");
          reinstrumentImages(editor);
          sourceMode = false;
      }
  }
  
  function loadContent(content) {
  	editor.body.innerHTML = resume(content);
  }
  
  function addImage() {
      editor.execCommand("insertimage", false, "template.jpg");
      var img = getOrigin();
      var input = instrumentImg(img,true);
      activateImgInstrumentation(input,img);
  }
  
  function instrumentImages(editor) {
      var imgs = detach(editor.getElementsByTagName('img'));
      for (var i = 0; i < imgs.length; i++) {
          instrumentImg(imgs[i],false);
      }
  }
  
  function reinstrumentImages(editor) {
      imgs = detach(editor.getElementsByTagName('img'));
      for (var i = 0; i < imgs.length; i++) {
          reinstrumentImg(imgs[i]);
      }
  }
  
  function instrumentImg(img,template) {
      var id = imageCounter++;
      var imgID = "image-" + id;
      var src = img.getAttribute("src");
  
      img.setAttribute("id",imgID);
      img.setAttribute("href",src);
      setTemplate(img,template);
  
      img.addEventListener("mousedown",imageDown,false);
      
      img.parentNode.addEventListener("DOMNodeRemoved",imageRemoved,false);
      
      imageData[imgID] = [src,src,false];
  
      var input = document.createElement("input");
      input.setAttribute("type","file");
      input.setAttribute("id",imgID + "-input");
      input.setAttribute("size", "1");
      input.setAttribute("class", "image_browser");
      input.addEventListener("click",inputChange,false);
      input.addEventListener("change",inputChange,false);
      input.style.position = "absolute";
      input.style.visiblility = "hidden";
  
      image_inputs.appendChild(input);
      
      return input;
  }
  
  function reinstrumentImg(img,id) {
  	if (!id) {
  	    var src = img.getAttribute("src");
  	    var id = src.substring(src.lastIndexOf('/'),src.lastIndexOf('.'));
  	}
  
      var data = imageData[id];
  
      img.setAttribute("id",id);
      img.setAttribute("src",data[0]);
      img.setAttribute("href",data[1]);
      setTemplate(img,data[2]);
  
      img.addEventListener("mousedown",imageDown,true);
  }
  
  function activateImgInstrumentation(input,img) {
      input.style.left = (iframe.offsetLeft + img.x + 5) + "px";
      input.style.top = (iframe.offsetTop + img.y + 5) + "px";
  	input.style.visibility = "visible";
  }
  
  function deactivateImgInstrumentation(input) {
  	input.style.visibility = "hidden";
  	input.name = "";
  }
  
  // ----------------------- Event functions ---------------------------
  
  function keypress(e) {
  
      modified = true;
  
      updateUI();
  
      var key = e.keyCode;
      var ch = e.charCode;
  
      //window.status = "[" + key + "," + ch + "," + e.shiftKey + "," + e.ctrlKey + "," + e.altKey + "," + e.metaKey + "]";
  
      try {
          if (e.ctrlKey || e.metaKey) {
              if (key > 0) {
                  switch (key) {
                      case 37: // left arrow
                      case 39: // right arrow
                          e.stopPropagation();
                          e.preventDefault();
                          e.returnValue = false;
                          return false;
                  }
              } else if (ch > 0) {
                  switch (ch) {
                      case 91: // [
                      case 93: // ]
                          e.stopPropagation();
                          e.preventDefault();
                          e.returnValue = false;
                          return false;
                  }
              }
          //} else if (e.shiftKey && (key == e.DOM_VK_TAB)) {
          //    editor.execCommand("outdent",false,null);
          //} else if (key == e.DOM_VK_TAB) {
          //    editor.execCommand("indent",false,null);
          //} else if ((key == e.DOM_VK_ENTER) ||  (key == e.DOM_VK_RETURN)) {
          //    if ((previousKey == e.DOM_VK_ENTER) ||  (previousKey == e.DOM_VK_RETURN)) {
          //       editor.execCommand("insertparagraph",false,null);
          //    }
          }
      } catch (e) { }
  
      previousKey = key;
  }
  
  function click() {
      updateUI();
      previousKey = null;
  }
  
  function formatblockChange() {
      var selection = formatblock.selectedIndex;
      var blockFormat = formatblock.options[selection].value;
      if (selection == 0) {
      	//var block = getOrigin().parentNode;
      	//block.parentNode.replaceChild(block,block.firstChild);
      	
      	// <----------------- FIXME -----------------------
      	
      } else {
          editor.execCommand("formatblock", false, blockFormat);
      }
      updateUI();
      editor_window.focus();
      modified = true;
  }
  
  function alternativesChange() {
      var selection = alternatives.selectedIndex;
      var selectionClass = alternatives.options[selection].value;
      alternativesTarget.setAttribute("class",selectionClass);
  }
  
  function buttonClick() {
      if (this.id == "createlink") {
          var href = prompt("Enter a URL:", "");
          editor.execCommand(this.id,false,href);
      } else if (this.id == "insertimage") {
          addImage();
      } else if (this.id == "quote") {
          editor.execCommand("formatblock", false, "q");
      } else {
          editor.execCommand(this.id, false, null);
      }
      updateUI(true);
      editor_window.focus();
      modified = true;
  }
  
  function buttonDown() {
      this.firstChild.style.left = "1px";
      this.firstChild.style.top = "1px";
      this.style.border="inset 1px";
  }
  
  function buttonUp() {
      this.firstChild.style.left = "0px";
      this.firstChild.style.top = "0px";
      this.style.border="outset 1px";
  }
  
  function buttonOver() {
      this.style.border="outset 1px";
  }
  
  function buttonOut() {
      this.style.border="solid 1px #eee";
  }
  
  var originalX;
  var originalWidth;
  var activeImage;
  var activeRatio;
  
  function imageDown(e) {
  	originalX = e.clientX;
      editor_window.addEventListener("mousemove", doDrag, true);
      editor_window.addEventListener("mouseup", endDrag, true);
      activeImage = this;
      activeRatio = activeImage.height / activeImage.width;
      originalWidth = activeImage.width;
      e.stopPropagation();
      e.preventDefault();
      e.returnValue = false;
      return false;         
  }
  
  function imageRemoved(e) {
  	var id = e.target.id;
  	var input = document.getElementById(id + "-input");
  	if (input) deactivateImgInstrumentation(input);
  }
  
  function doDrag(e) {
      var dx = e.clientX - originalX;
      var width = originalWidth + dx;
      activeImage.style.width = width + "px";
      activeImage.style.height = (width * activeRatio) + "px";
      window.status = "(" + activeImage.width + "px, " + activeImage.height + "px)";
  }
  
  function endDrag(e) {
      editor_window.removeEventListener("mousemove", doDrag, true);
      window.status = "";
  }
  
  function inputChange() {
      var inputID = this.getAttribute("id");
      var imgID = inputID.substring(0,inputID.indexOf("-input"));
      var img = editor.getElementById(imgID);
      if (this.value != "") {
          var newImg = document.createElement("img");
          img.parentNode.replaceChild(newImg,img);
          var src = "file:///" + this.value;
          var href = imgID + this.value.substring(this.value.lastIndexOf('.'));
          imageData[imgID] = [src,href,false];
          reinstrumentImg(newImg,imgID);
  	    deactivateImgInstrumentation(this);
          this.setAttribute("name","save:" + href);
      } else {
          img.parentNode.removeChild(img);
          // Note: this will trigger a DOMNodeRemoved event that we'll use
          // to deactivate the image instrumentation (removing it causes
          // mozilla to crash!!!).
      }
  }
  
  // ----------------------- DOM functions ---------------------------
  
  function getInnerHTML() {
      return editor.body.innerHTML;
  }
  
  function getContent() {
  	if (sourceMode) wysiwyg(false);
      var content = '<html xmlns="http://www.w3.org/1999/xhtml"><body>';
      content += serializeChildren(editor.body);
      content += '</body></html>';
      return content;
  }
  
  function serializeChildren(node) {
      var str = "";
      var children = node.childNodes;
      for (var i = 0; i < children.length; i++) {
          str += serialize(children.item(i));
      }
      return str;
  }
  
  function serialize(node) {
      var str = "";
      var name = node.nodeName.toLowerCase();
  
      str += whitespaceBefore(node,getPreviousMeaningfulNode(node));
  
      if (node.nodeType == node.TEXT_NODE) {
          if (preserveWhitespace(node.parentNode) || isMeaningfulWhitespace(node)) {
              str += escape(trimNewlines(node.nodeValue));
          } else {
              str += structurize(escape(trimWhitespace(node.nodeValue)));
          }
      } else if (!isTemplate(node)) {
          str += "<" + name + escape(getAttributes(node));
          var children = node.childNodes;
          if ((children != null) && (children.length > 0)) {
              str += ">";
              for (var i = 0; i < children.length; i++) {
                  str += serialize(children.item(i));
              }
              str += "</" + name + ">";
          } else {
              str += "/>";
          }
      }
  
      str += whitespaceAfter(node,getNextMeaningfulNode(node));
  
      return str;
  }
  
  function getAttributes(node) {
      var attr = node.attributes;
      if (node && attr) {
          var str = "";
          for (var i = 0; i < attr.length; i++) {
              str += getAttribute(node,attr.item(i));
          }
          return str += getHiddenAttributes(node);
      } else {
          return "";
      }
  }
  
  function getPath(node) {
      if (node) {
          var name = node.nodeName;
          if (node.parentNode) {
              return getPath(node.parentNode) + "/" + name;
          } else {
              return name;
          }
      } else {
          return "";
      }
  }
  
  function getOrigin() {
  
      // ------------------------ WARNING: HOTSPOT! ---------------------------
      // since it's called for every keystroke, keep it as fast as possible!!!
      // ----------------------------------------------------------------------
  
      var selection = editor_window.getSelection();
  
      //window.status = selection.anchorNode + "," + selection.anchorOffset + " " + selection.focusNode + "," + selection.focusOffset;
  
      if (selection.anchorNode == selection.focusNode) {
          if (selection.anchorNode.nodeType != selection.anchorNode.TEXT_NODE ) {
              var index = (selection.focusOffset == 0) ? 0 : selection.focusOffset - 1;
              return selection.anchorNode.childNodes[index];
          }
      }
  
      return selection.anchorNode;
  }
  
  function getPreviousMeaningfulNode(node) {
      if (node) {
          var previous = node.previousSibling;
          if (previous) {
              if (previous.nodeType == node.TEXT_NODE) {
                  if (!isWhitespace(previous.nodeValue)) {
                      return previous;
                  } else {
                      return getPreviousMeaningfulNode(previous);
                  }
              } else {
                  return previous;
              }
          }
      }
      return null;
  }
  
  function getNextMeaningfulNode(node) {
      if (node) {
          var next = node.nextSibling;
          if (next) {
              if (next.nodeType == node.TEXT_NODE) {
                  if (!isWhitespace(next.nodeValue)) {
                      return next;
                  } else {
                      return getNextMeaningfulNode(next);
                  }
              } else {
                  return next;
              }
          }
      }
      return null;
  }
  
  // ----------------------------- Utility Functions -------------------------
  
  function getMonth(number) {
      switch (number) {
          case  0: return "January";
          case  1: return "February";
          case  2: return "March";
          case  3: return "April";
          case  4: return "May";
          case  5: return "June";
          case  6: return "July";
          case  7: return "August";
          case  8: return "September";
          case  9: return "October";
          case 10: return "November";
          case 11: return "December";
      }
  }
  
  function getDate() {
      var date = new Date();
      var month = getMonth(date.getMonth());
      var day = date.getDate();
      var year = date.getFullYear();
      return month + " " + day + ", " + year;
  }
  
  function getTime() {
      var time = new Date();
      var hour = time.getHours();
      var minute = time.getMinutes();
      return ((hour < 10) ? "0" : "") + hour + ((minute < 10) ? ":0" : ":") + minute;
  }
  
  function getFullDate() {
      return (new Date()).toGMTString();
  }
  
  var trimRE = /(^\s+)|(\s+$)/g;
  
  /**
   * Removes whitespace from the beginning and end of line.
   */
  function trimWhitespace(str) {
      if (!str) return '';
      return str.replace(trimRE,'');
  }
  
  var saneRE = /\n+/g;
  
  /**
   * Removes all newlines
   */
  function trimNewlines(str) {
      if (!str) return '';
      return str.replace(saneRE,'');
  }
  
  function isWhitespace(str) {
      return trimWhitespace(str).length == 0;
  }
  
  /**
   * Detach the live array returned by some DOM functions
   * and make it static (means that it doesn't change if you work
   * on the DOM). Very useful to avoid nasty recursion when working
   * on getElementByTagName()
   */
  function detach(liveArray) {
      var staticArray = new Array(liveArray.length);
      for (var i = 0; i < liveArray.length; i++) {
          staticArray[i] = liveArray[i];
      }
      return staticArray;
  }
  
  // ----------------------------- Semantic Functions -------------------------
  
  function isBlock(node) {
      if (node && (node.nodeType == node.ELEMENT_NODE)) {
          switch (node.nodeName.toLowerCase()) {
              case "p":
              case "blockquote":
              case "h1":
              case "h2":
              case "h3":
              case "h4":
              case "ol":
              case "ul":
              case "body":
                  return true;
              default:
                  return false;
          }
      } else {
          return false;
      }
  }
  
  function isInline(node) {
      if (node && (node.nodeType == node.ELEMENT_NODE)) {
          switch (node.nodeName.toLowerCase()) {
              case "b":
              case "i":
              case "q":
              case "strike":
              case "img":
              case "a":
                  return true;
              default:
                  return false;
          }
      } else {
          return false;
      }
  }
  
  function isMeaningfulWhitespace(node) {
      if (node && (node.nodeType == node.TEXT_NODE)) {
          return (isInline(node.nextSibling) || isInline(node.previousSibling));
      } else {
          return false;
      }
  }
  
  function getBlockFormat(node) {
      if (isBlock(node)) {
          switch (node.nodeName.toLowerCase()) {
              case "p": return 1;
              case "h1": return 2;
              case "h2": return 3;
              case "h3": return 4;
              case "h4": return 5;
              default: return 0;
          }
      } else {
          return undefined;
      }
  }
  
  function isTemplate(node) {
      if (node && (node.nodeType == node.ELEMENT_NODE)) {
  		if (node.getAttribute("template") == "yes") {
  			return true;
  		} else if (node.nodeName.toLowerCase() == "br") {
  			if (!node.nextSibling) {
  				return true;
  			} else {
  				return isTemplate(node.nextSibling);
  			}
  		}
  	}
  	return false;
  }
  
  function setTemplate(node, status) {
      var value = (status) ? "yes" : "no";
      node.setAttribute("template",value);
  }
  
  function getAlternatives(node) {
      if (node) {
          switch (node.nodeName.toLowerCase()) {
              case "blockquote": return [ "quote", "code", "note", "fixme" ];
              case "img": return [ "inline", "floating-left", "floating-right" ];
              case "p": return [ "normal", "figure" ];
              default: return null;
          }
      }
  }
  
  function getAttribute(node,at) {
      var nodeName = node.nodeName.toLowerCase();
      var atName = at.name.toLowerCase();
  
      if ((nodeName == "img") && (atName == "href")) {
          return ' src="' + at.value + '"';
      } else if ((atName == "class") || (atName == "href")) {
          return " " + atName + '="' + at.value + '"';
      } else {
          return "";
      }
  }
  
  function getHiddenAttributes(node) {
      var nodeName = node.nodeName.toLowerCase();
      if (nodeName == "img") {
      	return ' width="' + node.width + '" height="' + node.height + '"';
      } else {
      	return '';
      }
  } 
  	
  function preserveWhitespace(node) {
      return ((node.nodeName.toLowerCase() == "blockquote") && (node.getAttribute("class") == "code"));
  }
  
  function whitespaceBefore(currentNode,precedingNode) {
      var current = currentNode.nodeName.toLowerCase();
      var preceding = (precedingNode) ? precedingNode.nodeName.toLowerCase() : "#none";
  
      if (current == "#text") {
          if (!isWhitespace(currentNode.nodeValue) && isBlock(precedingNode)) {
              return "\n";
          }
      } else if (isBlock(currentNode)) {
          if (isBlock(precedingNode) || (preceding == "li")) {
              return "\n";
          }
      }
  
      return "";
  }
  
  function whitespaceAfter(currentNode,followingNode) {
      var current = currentNode.nodeName.toLowerCase();
      var following = (followingNode) ? followingNode.nodeName.toLowerCase() : "#none";
  
      if (isBlock(currentNode)) {
          if (isBlock(followingNode) || (following == "#text") || (following == "#none")) {
              return "\n";
          }
      } else if (current == "br") {
          if (following != "#none") {
              return "\n";
          }
      } else if (current == "li") {
          return "\n";
      }
  
      return "";
  }
  
  /*
   * Change special text structures into markup
   */
  function structurize(str) {
  	str = str.replace(/\*((\w|\s)+)\*/g,"<b>$1</b>");
  	str = str.replace(/\"((\w|\s)+)\"/g,"<q>$1</q>");
  	return str;
  }
  
  /*
   * Escapes special charachters into entities
   */
  function escape(str) {
  	str = str.replace(/&/g,"&amp;");
  	str = str.replace(/</g,"&lt;");
  	str = str.replace(/>/g,"&gt;");
  	str = str.replace(/\u00A0/g,"&#160;");
  	return str;
  }
  
  /*
   * Resumes entities into special charachters
   * [this is done because Midas doesn't recognize all entities]
   */
  function resume(str) {
  	str = str.replace(/&amp;/g,"&");
  	str = str.replace(/&lt;/g,"<");
  	str = str.replace(/&gt;/g,">");
  	//str = str.replace(/&#160;/g,\u00A0);
  	return str;
  }
  
  // ------------------------------ end of file --------------------------
  
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/lib/.cvsignore
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/repository/news/template/document.xml
  
  Index: document.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <n:news xmlns:n="http://www.betaversion.org/linotype/news/1.0" online="on">
    <n:title>Title</n:title>
    <body xmlns="http://www.w3.org/1999/xhtml">Content</body>
  </n:news>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/flow.js
  
  Index: flow.js
  ===================================================================
  /*
   * Yeah, I know that hardwiring those is hacky as hell. But I'll try to
   * fix this with link translation later on.
   */
  var home = cocoon.context.getRealPath("/") + "samples/linotype/";
  
  var stream = new java.io.FileInputStream(home + "linotype.users.properties");
  var users = new Packages.org.apache.cocoon.components.UserManager.getInstance(stream);
  var repo = new Packages.org.apache.cocoon.components.Repository.getInstance();
  
  var userid = "";
  var username = "";
  
  /*
   * Main entry point for the flow. This is where user authorization takes place.
   */
  function main(action) {
      var args = new Array(arguments.length - 1);
      for (var i = 1; i < arguments.length; i++) {
          args[i-1] = arguments[i];
      }    	
  
  	if ((userid == undefined) || (userid == "")) {
  		login(action, args);
  	}
  		
  	invoke(action, args);
  }
  
  /*
   * If the user is not yet authorized, than authentication takes place
   */
  function login(action, args) {
  	var name = "";
  	var password = "";
  	var userError = "";
  	var passError = "";
  
  	while (true) {
  		sendPageAndWait("screen/login", { username : name, userError : userError, passError : passError});
  
  		name = cocoon.request.getParameter("username");
  		password = cocoon.request.getParameter("password");
  		
  		if (users.isValidName(name)) {
  		    if (users.isValidPassword(name,password)) {
  		    	userid = name;
  		    	username = users.getFullName(name);
  				break;
  			} else {
  				userError = "";
  				passError = "Password doesn't match";
  			}
  		} else {
  			userError = "User not found";
  			passError = "";
  		}
  	}
  	
  	cocoon.createSession();
  }
  
  /*
   * Now that the user has been authenticated and authorized, execute what 
   * he's asking for. This method checks the flowscript to see if the
   * called action exists as a flowscript function. If so, it's called with
   * the given arguments. If not, the appropriate admin screen is sent
   * to the user.
   */
  function invoke(action, args) {
      func = this[action];
      if (func != undefined) {
      	func.apply(this,args);
     	} else {
    		sendPage("screen/" + action, {"user" : username});
    	}
  }
  
  // ----------------------------- actions ----------------------------------
  
  /*
   * The logout action clears the userid from the session thus signaling
   * that the user has logged out and should be further considered authenticated. 
   */
  function logout() {
  	userid = "";
  	sendPage("screen/logout");
  }
     
  /*
   * The edit action performs the editing subflow.
   */
  function edit(id,type,subpage) {
     	var repository = home + "repository/" + type + "/";
      
  	if (id == "template") {
  		id = repo.getID(repository);
  		repo.copy(repository + "template", repository + id);
  		redirect("../" + id + "/");
  	} else if ((subpage != undefined) && (subpage != "")) {
     		sendPage("edit/" + type + "/" + id + "/" + subpage,{});
  	} else {
  		var document = repository + id;
  
  		while (true) {
  			var versions = repo.getVersions(document);
  	    	sendPageAndWait("edit/" + type + "/" + id + "/", 
  	    		{ 
  	    			userid : userid, 
  	    			username : username, 
  	    			versions : versions,
  	    			innerHTML : cocoon.request.getParameter("innerHTML") 
  	    		}
  	    	);
  	        var action = cocoon.request.getParameter("action"); d
  	       	if (action == "delete") {
  	        	repo.remove(document);
  	        	break;
  	       	} else if (action == "restore") {
  	       		var version = cocoon.request.getParameter("version");
  	        	repo.revertFrom(document,version);
  	       	} else {
  	       		var output = repo.getOutputStream(document);
  		        process("samples/linotype/action/save-" + type,{},output);
  		        output.close();
  		        repo.save(cocoon.request, document);
  		    	if (action == "finish") break;
  			}	   	
  		}
  
  		redirect("../../../" + type);
  	}
  }
  
  
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/linotype.users.properties
  
  Index: linotype.users.properties
  ===================================================================
  # Supersimple User Database
  #---------------------------
  #
  # Format is:
  #  userid:password:User Name
  #
  
  guest:guest:Guest
  
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
      
  <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
  
  <!-- =========================== Components ================================ -->
  
   <map:components>
  
    <map:generators default="file">
      <map:generator name="file" 
         src="org.apache.cocoon.generation.FileGenerator"
         label="content,data" logger="sitemap.generator.file"  
         pool-min="1" pool-grow="1" pool-max="8"  
      />
      <map:generator name="directory" 
         src="org.apache.cocoon.generation.DirectoryGenerator"
         label="content,data" logger="sitemap.generator.file"  
         pool-min="1" pool-grow="1" pool-max="8"  
      />    
      <map:generator name="request" 
         src="org.apache.cocoon.generation.RequestGenerator"
         label="data" logger="sitemap.generator.request" 
         pool-min="1" pool-grow="1" pool-max="4"  
      />
      <map:generator name="jx"
         src="org.apache.cocoon.generation.JXTemplateGenerator"
         label="content,data" logger="sitemap.generator.jx" 
         pool-min="1" pool-grow="1" pool-max="8"  
      />
      <map:generator name="notifying" src="org.apache.cocoon.sitemap.NotifyingGenerator"/>
    </map:generators>
  
    <map:transformers default="xslt">
      <map:transformer name="xslt"   
        src="org.apache.cocoon.transformation.TraxTransformer"
        logger="sitemap.transformer.xslt"
        pool-min="2" pool-grow="2" pool-max="8"  
      >
        <use-request-parameters>false</use-request-parameters>
        <use-session-parameters>false</use-session-parameters>
        <use-cookie-parameters>false</use-cookie-parameters>
        <!-- Xalan -->
        <transformer-factory>org.apache.xalan.processor.TransformerFactoryImpl</transformer-factory>
        <!-- XSLTC -->
        <!--transformer-factory>org.apache.xalan.xsltc.trax.TransformerFactoryImpl</transformer-factory-->
        <!-- Old (6.5.2) Saxon: -->
        <!--transformer-factory>com.icl.saxon.TransformerFactoryImpl</transformer-factory-->
        <!--  New (7.x?) Saxon: --> 
        <!--transformer-factory>net.sf.saxon.TransformerFactoryImpl</transformer-factory-->
      </map:transformer>
      <map:transformer name="cinclude" 
        src="org.apache.cocoon.transformation.CIncludeTransformer"
        logger="sitemap.transformer.cinclude"  
        pool-min="2" pool-grow="2" pool-max="8"  
      />
      <map:transformer name="jx" 
        src="org.apache.cocoon.transformation.JXTemplateTransformer" 
        logger="sitemap.transformer.jx"
        pool-min="2" pool-grow="2" pool-max="8"  
      />
    </map:transformers>
  
    <map:serializers default="xhtml">
      <map:serializer name="links" 
        logger="sitemap.serializer.links" 
        src="org.apache.cocoon.serialization.LinkSerializer"
      />
      <map:serializer name="xml" mime-type="text/xml"
        logger="sitemap.serializer.xml"  
        src="org.apache.cocoon.serialization.XMLSerializer"
      />
      <map:serializer name="html" mime-type="text/html" 
        src="org.apache.cocoon.serialization.HTMLSerializer"
        logger="sitemap.serializer.html"   
        pool-min="1" pool-grow="1" pool-max="8"  
      >
        <buffer-size>1024</buffer-size>
        <encoding>ISO-8859-1</encoding>
      </map:serializer>
      <map:serializer name="xhtml" mime-type="text/html" 
        src="org.apache.cocoon.serialization.XMLSerializer"
        logger="sitemap.serializer.xhtml"   
        pool-min="1" pool-grow="1" pool-max="8"  
      >
        <doctype-public>-//W3C//DTD XHTML 1.0 Strict//EN</doctype-public>
        <doctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</doctype-system>
        <buffer-size>1024</buffer-size>
        <encoding>ISO-8859-1</encoding>
      </map:serializer>
      <map:serializer logger="sitemap.serializer.rss" mime-type="text/rss" name="rss" pool-grow="2" pool-max="10" pool-min="2" src="org.apache.cocoon.serialization.XMLSerializer">
        <doctype-system>http://my.netscape.com/publish/formats/rss-0.91.dtd</doctype-system>
        <encoding>ISO-8859-1</encoding>
      </map:serializer>
    </map:serializers>
  
    <map:readers default="resource">
      <map:reader name="resource" 
        src="org.apache.cocoon.reading.ResourceReader"
        logger="sitemap.reader.resource"  
        pool-min="1" pool-grow="1" pool-max="8"  
      />
      <map:reader name="image"
        src="org.apache.cocoon.reading.ImageReader"
        logger="sitemap.reader.image"  
        pool-min="1" pool-grow="1" pool-max="8"  
      />
    </map:readers>
  
    <map:matchers default="wildcard">
      <map:matcher logger="sitemap.matcher.wildcard" name="wildcard" src="org.apache.cocoon.matching.WildcardURIMatcher"/>
    </map:matchers>
  
    <map:selectors default="exception">
     <map:selector name="exception" logger="sitemap.selector.exception" src="org.apache.cocoon.selection.ExceptionSelector">
       <exception name="not-found" class="org.apache.cocoon.ResourceNotFoundException"/>
       <exception class="java.lang.Throwable" unroll="true"/>
     </map:selector>
    </map:selectors>
  
    <map:pipes default="caching">
     <map:pipe name="caching" src="org.apache.cocoon.components.pipeline.impl.CachingProcessingPipeline"/>
     <map:pipe name="caching-point" src="org.apache.cocoon.components.pipeline.impl.CachingPointProcessingPipeline">
       <autoCachingPoint>On</autoCachingPoint>
     </map:pipe>
     <map:pipe name="noncaching" src="org.apache.cocoon.components.pipeline.impl.NonCachingProcessingPipeline"/>
    </map:pipes>
  
   </map:components>
  
  <!-- =========================== Views ===================================== -->
  
    <map:views>
      <map:view from-label="content" name="content">
        <map:serialize type="xml"/>
      </map:view>
  
      <map:view from-label="results" name="pretty-content">
        <map:transform src="stylesheets/system/xml2html.xslt"/>
        <map:serialize type="xhtml"/>
      </map:view>
  
      <map:view from-position="last" name="links">
        <map:serialize type="links"/>
      </map:view>
    </map:views>
  
  <!-- ========================== Flowscript ================================= -->
  
    <map:flow language="JavaScript">
      <map:script src="flow.js"/>
    </map:flow>
  
  <!-- =========================== Pipelines ================================= -->
  
   <map:pipelines>
  
    <map:component-configurations>
      <global-variables>
        <home>http://127.0.0.1:8888/samples/linotype</home>
        <count>3</count>
      </global-variables>
    </map:component-configurations>
  
  <!-- ============================ Flow Hooks =============================== -->
  
    <map:pipeline>
    
       <map:match pattern="**/*.kont">
        <map:call continuation="{2}"/>
      </map:match>
      
    </map:pipeline>
    
  <!-- ========================= Private Resources =========================== -->
  
    <map:pipeline>
  
      <map:match pattern="news">
       <map:generate src="cocoon:/news.xml"/>
       <map:transform src="stylesheets/news2html-homepage.xslt">
         <map:parameter name="home" value="{global:home}"/>
         <map:parameter name="count" value="3"/>
       </map:transform>
       <map:serialize/>
      </map:match>
      	
      <map:match pattern="news.xml">
       <map:generate type="directory" src="repository/news/">
        <map:parameter name="sort" value="lastmodified"/>
        <map:parameter name="reverse" value="true"/>
       </map:generate>
       <map:transform src="stylesheets/directory2cinclude.xslt">
        <map:parameter name="prefix" value="news"/>
       </map:transform>
       <map:transform type="cinclude"/>
       <map:serialize type="xml"/>
      </map:match>
      
      <map:match pattern="news/*.xml">
       <map:generate src="repository/news/{1}/document.xml"/>
       <map:serialize type="xml"/>
      </map:match>
          
      <map:match pattern="edit/news/*/">
       <map:generate src="cocoon:/news/{1}.xml"/>
       <map:transform src="stylesheets/news2edit.xslt">
        <map:parameter name="home" value="{global:home}"/>
       </map:transform>
       <map:transform type="jx"/>
       <map:serialize/>
      </map:match>
  
      <map:match pattern="edit/news/*/content">
       <map:generate src="cocoon:/news/{1}.xml"/>
       <map:transform src="stylesheets/news2html-content.xslt">
        <map:parameter name="home" value="{global:home}"/>
       </map:transform>
       <map:serialize/>
      </map:match>
  
      <map:match pattern="edit/news/*/image-*.*">
       <map:read src="repository/news/{1}/image-{2}.{3}" mime-type="image/{3}"/>
      </map:match>
  
      <map:match pattern="edit/news/*/template.jpg">
       <map:read src="images/image.jpg" mime-type="image/jpg"/>
      </map:match>
  
      <map:match pattern="edit/news/*/resizer.png">
       <map:read src="images/resizer.png" mime-type="image/png"/>
      </map:match>
     
     <map:match pattern="screen/news">
       <map:generate src="cocoon:/news.xml"/>
       <map:transform src="stylesheets/news2html-private.xslt">
        <map:parameter name="home" value="{global:home}"/>
       </map:transform>
       <map:serialize/>
      </map:match>
                  
  	<map:match pattern="screen/*">
  	 <map:generate src="screens/{1}.jx" type="jx"/>
  	 <map:serialize/>
  	</map:match>
  
      <map:match pattern="action/save-news">
       <map:generate type="request"/>
       <map:transform src="stylesheets/request2news.xslt"/>
       <map:serialize type="xml"/>
      </map:match>
                  
    </map:pipeline>
  
  <!-- ========================= Public Resource ============================= -->
  
    <map:pipeline>
      
      <map:match pattern="">
       <map:generate src="index.xhtml"/>
       <map:transform type="cinclude"/>
       <map:serialize/>
      </map:match>
  
      <map:match pattern="history">
       <map:generate src="cocoon:/news.xml"/>
       <map:transform src="stylesheets/news2html-history.xslt">
        <map:parameter name="home" value="{global:home}"/>
       </map:transform>
       <map:serialize/>
      </map:match>
      
      <map:match pattern="request">
       <map:generate type="request"/>
       <!--map:transform src="stylesheets/system/xml2html.xslt"/-->
       <map:serialize type="xml"/>
      </map:match>
  
      <map:match pattern="rss/0.91/index.rss">
       <map:generate src="cocoon:/news.xml"/>
       <map:transform src="stylesheets/news2rss-0.91.xslt">
         <map:parameter name="home" value="{global:home}/news"/>
         <map:parameter name="count" value="5"/>
       </map:transform>
       <map:serialize type="xml"/>
      </map:match>
  
      <map:match pattern="rss/2.0/index.rss">
       <map:generate src="cocoon:/news.xml"/>
       <map:transform src="stylesheets/news2rss-2.0.xslt">
         <map:parameter name="home" value="{global:home}/news"/>
         <map:parameter name="count" value="5"/>
       </map:transform>
       <map:serialize type="xml"/>
      </map:match>
      
      <map:match pattern="private/">
        <map:redirect-to uri="news"/>
      </map:match>
  
      <map:match pattern="private/edit/news/*/*">
        <map:call function="main">
          <map:parameter name="page" value="edit"/>
          <map:parameter name="id" value="{1}"/>
          <map:parameter name="type" value="news"/>
          <map:parameter name="subpage" value="{2}"/>
        </map:call>
      </map:match>
  
      <map:match pattern="private/**">
        <map:call function="main">
          <map:parameter name="page" value="{1}"/>
        </map:call>
      </map:match>
  
      <map:match pattern="news/*/image-*.*">
       <map:read src="repository/news/{1}/image-{2}.{3}" mime-type="image/{3}"/>
      </map:match>
  
      <map:match pattern="news/*/image-*-(*,*).*">
       <map:read type="image" src="repository/news/{1}/image-{2}.{5}" mime-type="image/{5}">
         <map:parameter name="width" value="{3}"/>
         <map:parameter name="height" value="{4}"/>
       </map:read>
      </map:match>
  
      <map:match pattern="news/*/">
        <map:generate src="repository/news/{1}/document.xml"/>
        <map:transform src="stylesheets/news2html-single.xslt">
         <map:parameter name="home" value="{global:home}"/>
        </map:transform>
        <map:serialize/>
      </map:match>
                     
      <map:match pattern="images/**.*">
        <map:read mime-type="image/{2}" src="images/{1}.{2}"/>
      </map:match>
  
      <map:match pattern="styles/**.css">
        <map:read mime-type="text/css" src="styles/{1}.css"/>
      </map:match>
  
      <map:match pattern="scripts/**.js">
        <map:read mime-type="text/javascript" src="scripts/{1}.js"/>
      </map:match>
      
  <!-- =========================== Error Handler ============================= -->
  
    <map:handle-errors>
      <map:select>
        <map:when test="not-found">
          <map:generate type="jx" src="screens/notfound.jx"/>
        </map:when>
        <map:otherwise>
          <map:generate type="notifying"/>
          <map:transform src="stylesheets/system/error2html-debug.xslt">
           <map:parameter name="uri" value="{request:requestURI}"/>
           <map:parameter name="home" value="{global:home}"/>
          </map:transform>
        </map:otherwise>
      </map:select>
      <map:serialize/>
    </map:handle-errors>
  
    </map:pipeline>
   </map:pipelines>
  </map:sitemap>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/index.xhtml
  
  Index: index.xhtml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  
   <head>
    <title>Linotype</title>
  
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  
    <meta name="DC.title" content="Linotype"/>
    <meta name="DC.author.personalName" content=""/>
    <meta name="description" lang="en" content=""/>
    <meta name="DC.date.created" content=""/>
    <meta name="DC.identifier" content=""/>
  
    <meta name="ICBM" content=""/>
    
    <link rel="stylesheet" href="styles/main.css" type="text/css"/>
    <link rel="alternate" type="application/rss+xml" title="RSS" href="rss/0.91/index.rss"/>
    
    <rdf:RDF xmlns="http://web.resource.org/cc/"
      xmlns:dc="http://purl.org/dc/elements/1.1/"
      xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
     <Work rdf:about="">
      <license rdf:resource="http://creativecommons.org/licenses/by-nc-sa/1.0/" />
     </Work>
     <License rdf:about="http://creativecommons.org/licenses/by-nc-sa/1.0/">
      <requires rdf:resource="http://web.resource.org/cc/Attribution" />
      <requires rdf:resource="http://web.resource.org/cc/ShareAlike" />
      <permits rdf:resource="http://web.resource.org/cc/Reproduction" />
      <permits rdf:resource="http://web.resource.org/cc/Distribution" />
      <permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
      <prohibits rdf:resource="http://web.resource.org/cc/CommercialUse" />
      <requires rdf:resource="http://web.resource.org/cc/Notice" />
     </License>
    </rdf:RDF>
  
   </head>
   
  <body>
  
  <div id="sidebar">
   <a href="private/"><img alt="Linotype" src="images/linotype.jpg" width="156px" height="207px"/></a><br/>
   <a href="history">History</a><br/>
   <a href="rss/0.91/index.rss"><img alt="RSS Feed" src="images/rss.gif"/></a><br/>
  </div>
  
  <div id="bottombar">
   <a href="http://cocoon.apache.org" title="Apache Cocoon"><img alt="Powered by Cocoon" src="images/cocoon.jpg"/></a>
  </div>
  
  <div id="page">
   <h1>Your Linotype</h1>
   <h2>this is a great place for a smartass tagline</h2>
   <include:include src="cocoon:/news" xmlns:include="http://apache.org/cocoon/include/1.0"/>
  </div>
  
  <div id="footer">
   <a href="http://creativecommons.org/licenses/by-nc-sa/1.0/" title="Creative Commons: some rights reserved"><img alt="Creative Commons License" src="images/cc.gif"/></a>
  </div>
  
  </body>
  </html>
  
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/misc/rss.psd
  
  	<<Binary file>>
  
  
  No                   revision
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/misc/image.psd
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/misc/resizer.psd
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/misc/linotype.gif
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/misc/geourl.psd
  
  	<<Binary file>>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/repository/news/1/document.xml
  
  Index: document.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <n:news xmlns:n="http://www.betaversion.org/linotype/news/1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:r="http://apache.org/cocoon/requestgenerator/2.0" online="on" author="" creation-date="May 26, 2003" creation-time="16:38" creation-fulldate="Mon, 26 May 2003 21:38:07 GMT"><n:title>Welcome to Linotype 1.1</n:title><body xmlns:h="http://apache.org/cocoon/requestgenerator/2.0"><p>Linotypes were machines that first allowed a single individual to mass-produce content without sacrificing typesetting elegance and text readability. Blogs turned the web into writeable media without sacrificing the ability to remain hypertextual. This is simply an attempt to combine the two concepts together.</p>
  
  <p>Linotype uses the very bleeding edge of web technologies:</p>
  
  <ul><li>It's powered by the <a href="http://cocoon.apache.org/">Apache Cocoon</a> framework and its amazing flowscript that, thanks to the power of continuation-enabled javascript, makes writing complex XML web applications a piece of cake.</li>
  <li>It's based on <a href="http://www.mozilla.org/editor/midas-spec.html">Mozilla Midas</a>, the inline editor available from the 1.3 release.</li>
  <li>The content is stored and edited as <a href="http://www.w3.org/TR/xhtml1/">XHTML 1.0</a>.</li>
  <li>All content is served as valid XHTML pages.</li>
  <li><a href="http://www.w3.org/TR/xslt">XSLT 1.0</a> is used only on the server side to perform tree transformations (such as wrapping the DHTML editor around the original XHTML content), but it's <strong xmlns:h="http://www.w3.org/1999/xhtml">never</strong> used for styling.</li>
  <li>Styling is performed entirely by <a href="http://www.w3.org/TR/REC-CSS2/">CSS2</a>.</li>
  <li>Javascript 1.5 in used for Midas customizations and for client-side XHTML serialization when the edited content is transmitted back to the server.</li>
  <li>The <a href="http://www.w3.org/Provider/Style/URI">URL space is kept clean</a>, designed to last and extension free. Extensions are used <strong xmlns:h="http://www.w3.org/1999/xhtml">only</strong> when they are meant to imply a specific MIME-type.</li>
  <li><a href="http://my.netscape.com/publish/formats/rss-spec-0.91.html">RSS</a> feeds are created automatically using Cocoon's aggregation capabilities and XSTL.</li>
  <li>The editing capabilities are restricted to <q>semantic</q> XHTML: you can't change style, but only structure. Style will change accordingly, depending on the CSS2 parameters associated to the various markup elements or to their semantic class.</li>
  <li>Image inclusion, resizing and uploading are all done inside the editor page without a need for external upload.</li>
  <li>The stylesheets are designed for both text readability and elegance. The use of serif fonts is intentional because it increases text readability and gives a pleasant retro style that matches the linotype concept.</li>
  <li>The entire thing has been designed around the <q>less is more</q> paradigm.</li>
  <li>The code is licensed under the <a href="http://www.apache.org/foundation/licence-FAQ.html">Apache License 1.1</a> which doesn't force code contribution back to the project but does protect the name, thus the project recognition and its community.</li>
  </ul>
  
  <p>Enjoy and spread the word.</p>
  
  <p><strong xmlns:h="http://www.w3.org/1999/xhtml">Stefano Mazzocchi.</strong></p>
  </body></n:news>
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/java/org/apache/cocoon/components/Repository.java
  
  Index: Repository.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   Stefano Mazzocchi  <st...@apache.org>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
  
  */
  package org.apache.cocoon.components;
  
  import java.io.File;
  import java.io.FileInputStream;
  import java.io.FileOutputStream;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.OutputStream;
  import java.util.ArrayList;
  import java.util.Enumeration;
  
  import org.apache.cocoon.environment.Request;
  import org.apache.cocoon.servlet.multipart.Part;
  
  /**
   * @author stefano
   */
  public class Repository {
      
      public static final String FILE_NAME = "document";
      
      private static Repository instance;
      
      private Repository() {
          // do nothing;
      }
      
      public static Repository getInstance() {
          if (instance == null) {
              instance = new Repository();
          }
          return instance;
      }
  
      private static File getDir(String dirName) {
          File dir = new File(dirName);
          if (!dir.isDirectory()) throw new RuntimeException("'dir' is not a directory!");
          return dir;
      }
  
      public static void save(Request request, String dirName) throws Exception {
          File dir = getDir(dirName);
          
          Enumeration params = request.getParameterNames();
          while (params.hasMoreElements()) {
              String name = (String) params.nextElement();
              if (name.indexOf("..") > -1) throw new Exception("We are under attack!!");
  //System.out.println("[param] " + name);
              if (name.startsWith("save:")) {
                  Part part = (Part) request.get(name);
                  String code = name.substring(5);
                  File file = new File(dir, code);
                  save(part,file);
              } else if (name.startsWith("delete:")) {
                  String value = request.getParameter(name);
                  if (value.length() > 0) {               
                      String code = name.substring(7);
                      File file = new File(dir, code);
  //System.out.println("[delete] " + file);
                      remove(file);
                  }
              }
          }
      }
      
      public static void save(Request request, String param, String file) throws Exception {
          Part part = (Part) request.get(param);
          save(part,new File(file));
      }
      
      public static void save(Part part, File file) throws Exception {
  //System.out.println("[upload] " + part.getFileName() + " -> " + file);
          InputStream in = null;
          FileOutputStream out = null;
          try {
              in = part.getInputStream();
              out = new FileOutputStream(file);
              copy(in, out);
          } finally {
              if (out != null) {
                  out.close();
              }
              if (in != null) {
                  in.close();
              }
          }
      }
      
      public static OutputStream getOutputStream(String dir) throws IOException {
          String mainFile = dir + "/" + FILE_NAME + ".xml";
          String versionedFile = dir + "/" + FILE_NAME + "." + getVersionID(dir) + ".xml";
          copy(mainFile, versionedFile);
          return new FileOutputStream(mainFile);
      }
  
      public static void revertFrom(String dir, int version) throws IOException {
          String mainFile = dir + "/" + FILE_NAME + ".xml";
          String versionedFile = dir + "/" + FILE_NAME + "." + version + ".xml";
          copy(versionedFile,mainFile);
      }
      
      /**
       * Returns the highest version id of the files included in the given 
       * directory.
       */
      public static int getVersionID(String dirName) {
          File dir = getDir(dirName);
          
          File[] content = dir.listFiles();
          int id = 0;
          for (int i = 0; i < content.length; i++) {
              if (content[i].isFile())  {
                  try {
                      int localid = getVersion(content[i].getName());
                      if (localid > id) id = localid;
                  } catch (Exception e) {}
              }
          }
  
          return ++id;
      }
  
      public static Object[] getVersions(String dirName) {
          File dir = getDir(dirName);
          ArrayList versions = new ArrayList();
  
          File[] content = dir.listFiles();
          for (int i = 0; i < content.length; i++) {
              if (content[i].isFile())  {
                  try {
                      int version = getVersion(content[i].getName());
                      if (version > 0) {
                          versions.add(new Integer(version));
                      }
                  } catch (Exception e) {}
              }
          }
  
          return versions.toArray();
      }
          
      /**
       * Return the version encoded into the name as a numeric subextension of
       * an .xml extension.
       * 
       * Example: 
       *  anything.123.xml -> 123
       *  document.3.xml -> 3
       *  document.0.xml -> 0
       *  document.xml -> -1
       *  image.0.jpg -> -1
       */
      private static int getVersion(String name) {
          int extIndex = name.lastIndexOf(".xml");
          if (extIndex > 0) {
              String nameWithoutExtension = name.substring(0,extIndex);
              int dotIndex = nameWithoutExtension.lastIndexOf('.');
              if (dotIndex > 0) {
                  String localidString = nameWithoutExtension.substring(dotIndex + 1);
                  return Integer.parseInt(localidString);
              }
          }
          return -1;
      }
      
      public static int getID(String dirName) {
          File dir = getDir(dirName);
  
          File[] content = dir.listFiles();
          int id = 0;
          for (int i = 0; i < content.length; i++) {
              if (content[i].isDirectory())  {
                  try {
                      String name = content[i].getName();
                      int localid = Integer.parseInt(name);
                      if (localid > id) id = localid;
                  } catch (Exception e) {}
              }
          }
  
          return ++id;
      }
      
      public static boolean remove(String fileName) {
          return remove(new File(fileName));
      }
      
      public static boolean remove(File file) {
          boolean success = true;
          
          if (file.isDirectory()) {
              File[] content = file.listFiles();
              for (int i = 0; i < content.length; i++) {
                  success = remove(content[i]);
              }
              
          }
          
  //System.out.println("[delete] " + file);
          success = file.delete();
          
          return success;     
      }
      
      public static void copy(String from, String to) throws IOException {
          copy(new File(from),new File(to));
      }    
  
      public static void copy(File from, File to) throws IOException {
  
  //System.out.println("[copy] " + from + " -> " + to);
          
          if (!from.exists()) {
              throw new IOException("Cannot find source file/folder");
          }
          
          if (from.isDirectory()) {
              to.mkdirs();
              File[] content = from.listFiles();
              for (int i = 0; i < content.length; i++) {
                  File src = content[i];
                  copy(src,new File(to, src.getName()));
              }            
          } else {
              to.createNewFile();
              FileInputStream in = null;
              FileOutputStream out = null;
              try {
                  in = new FileInputStream(from);
                  out = new FileOutputStream(to);
                  copy(in,out);
              } finally {
                  if (out != null) out.close();
                  if (in != null) in.close();
              }
          }
      }    
      
      public static void copy(InputStream from, OutputStream to) throws IOException {
          byte[] buffer = new byte[64 * 1024];
          int count = 0;
          do {
              to.write(buffer, 0, count);
              count = from.read(buffer, 0, buffer.length);
          } while (count != -1);
      }    
  }
  
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/java/org/apache/cocoon/components/UserManager.java
  
  Index: UserManager.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   Stefano Mazzocchi  <st...@apache.org>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.cocoon.components;
  
  import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.InputStreamReader;
  import java.util.HashMap;
  import java.util.StringTokenizer;
  
  public class UserManager {
  
      static UserManager instance;
      
      HashMap passwords = new HashMap();
      HashMap names = new HashMap();
      
      protected UserManager(InputStream stream) throws IOException {
          BufferedReader input = new BufferedReader(new InputStreamReader(stream));
          while (true) {
              String line = input.readLine();
              if (line != null) {
                  if (!line.startsWith("#") && !line.equals("")) {
                      StringTokenizer st = new StringTokenizer(line,":");
                      String name = st.nextToken();
                      String password = st.nextToken();
                      passwords.put(name,password);
                      String fullname = st.nextToken();
                      names.put(name,fullname);
                  }
              } else {
                  break;
              }
          }
      }
      
      public static UserManager getInstance(InputStream stream) throws IOException {
          if (instance == null) {
              instance = new UserManager(stream);
          }
          return instance;
      }
  
      public boolean isValidName(String name) {
          return passwords.containsKey(name);    
      }
      
      public boolean isValidPassword(String name, String password) {
          String storedPassword = (String) passwords.get(name);
          return (storedPassword != null) && (storedPassword.equals(password));
      }
      
      public String getFullName(String name) {
          return (String) names.get(name);
      }
  }
  
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/conf/linotype.xsamples
  
  Index: linotype.xsamples
  ===================================================================
  <?xml version="1.0"?>
  
  <xsamples xpath="/samples" unless="group[@name='Linotype']">
  
    <group name="Linotype">
      <sample name="Blogging Tool" href="linotype/">
        This is a demo of a full blown blogging tool written on top of Apache Cocoon.
      </sample>
    </group>
    
  </xsamples>
  
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/stylesheets/system/error2html-debug.xslt
  
  Index: error2html-debug.xslt
  ===================================================================
  <?xml version="1.0"?>
  
  <!-- CVS $Id: error2html-debug.xslt,v 1.1 2003/06/17 01:32:45 stefano Exp $ -->
  
  <xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:error="http://apache.org/cocoon/error/2.1">
  
  <xsl:param name="home" select="string('')"/>
  
  <xsl:template match="error:notify">
   <html>
    <head>
     <title>
      <xsl:value-of select="error:title"/>
     </title>
     <link href="{$home}/styles/main.css" type="text/css" rel="stylesheet"/>
     <style>
          body { padding: 20px }
  		p.message { padding: 10px 30px 10px 30px; font-weight: bold; font-size: 130%; border-width: 1px; border-style: dashed; border-color: #336699; }
  		p.description { padding: 10px 30px 20px 30px; border-width: 0px 0px 1px 0px; border-style: solid; border-color: #336699;}
  		p.topped { padding-top: 10px; border-width: 1px 0px 0px 0px; border-style: solid; border-color: #336699; }
  		span.description { color: #336699; font-weight: bold; }
  		span.switch { cursor: pointer; margin-left: 5px; text-decoration: underline; }
     </style>
   <script><![CDATA[
  function toggle(id) {
      var element = document.getElementById(id);
      with (element.style) {
          if ( display == "none" ){
              display = ""
          } else{
              display = "none"
          }
      }
      var text = document.getElementById(id + "-switch").firstChild;
      if (text.nodeValue == "[show]") {
          text.nodeValue = "[hide]";
      } else {
          text.nodeValue = "[show]";
      }
  }
  ]]></script>
    </head>
    <body>
     <h1><xsl:value-of select="error:title"/></h1>
  
     <p class="message">
      <xsl:call-template name="returns2br">
       <xsl:with-param name="string" select="error:message"/>
      </xsl:call-template>
     </p>
  
     <p class="description">
      <xsl:call-template name="returns2br">
       <xsl:with-param name="string" select="error:description"/>
      </xsl:call-template>
     </p>
  
     <xsl:apply-templates select="error:extra"/>
  
     <p class="topped">
      The <a href="http://cocoon.apache.org/">Apache Cocoon</a> Project
     </p>
    </body>
   </html>
  </xsl:template>
  
  <xsl:template match="error:extra">
   <xsl:choose>
    <xsl:when test="contains(@error:description,'stacktrace')">
     <p class="stacktrace">
      <span class="description"><xsl:value-of select="@error:description"/></span>
      <span class="switch" id="{@error:description}-switch" onclick="toggle('{@error:description}')">[show]</span>
      <pre id="{@error:description}" style="display: none">
       <xsl:call-template name="returns2br">
        <xsl:with-param name="string" select="."/>
       </xsl:call-template>
      </pre>
     </p>
    </xsl:when>
    <xsl:otherwise>
     <p class="extra">
      <span class="description"><xsl:value-of select="@error:description"/>:&#160;</span>
      <xsl:call-template name="returns2br">
       <xsl:with-param name="string" select="."/>
      </xsl:call-template>
     </p>
    </xsl:otherwise>
   </xsl:choose>
  </xsl:template>
  
  <xsl:template name="returns2br">
    <xsl:param name="string"/>
    <xsl:variable name="return" select="'&#xa;'"/>
    <xsl:choose>
      <xsl:when test="contains($string,$return)">
        <xsl:value-of select="substring-before($string,$return)"/>
        <br/>
        <xsl:call-template name="returns2br">
          <xsl:with-param name="string" select="substring-after($string,$return)"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$string"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/README.txt
  
  Index: README.txt
  ===================================================================
  
                                  l i n o t y p e
                                  ---------------
                      
   What is this?
   -------------
   
  Linotypes were machines that first allowed a single individual to mass-produce content without sacrificing typesetting elegance and text readability. Blogs turned the web into writeable media without sacrificing the ability to remain hypertextual. This is simply an attempt to combine the two concepts together.
  
   Requirements
   ------------
  
  Linotype just depends on Cocoon and saves its edited content on disk, nothing else.
  
  Thanks for your interest in Linotype. 
   
                                                  Stefano Mazzocchi
                    
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/TODO.txt
  
  Index: TODO.txt
  ===================================================================
   
   What is left to do?
   -------------------
  
  Tons of stuff, but here is a list of the things that I think are most important at the moment:
  
   1) IE compatibility. Currently linotype works only on Mozilla 1.3 or greater because it needs the Midas editor. IE has an equivalent editing mode since version 5.0. The client-side javascript was written with some portability in mind but there is a long way to go, expecially for non-standard features like image-handling/resizing and a bunch of other UI fanciness. Why should we care about IE? well, if you want to update your blog from an internet cafe', you can bet your ass they won't have mozilla 1.3 installed. that's mostly why.
   
   2) consider using slide or an alternative content repository instead of plain file system.
   
   3) write different rendering stylesheets for mozilla or IE since IE is *really* poor at CSS2 compatibility. Why? well, again, 90% of the browsers are IE and this is going to take a while to change.
   
   4) allow the ability to write essays and not only news and while you do this, considering adding pagination capabilities, also at the editing level (for example, a button that can trigger the presence of a tag that indicates page break)
   
   5) improve the ability to redeploy linotype without having to hardwire URLs around the sitemap and flowscript.
   
   6) consider adding the ability to sinchronize two different linotypes. For example, if you have one installed in your laptop and you are offline for a while, you might want to synchronize it with the one online.
  
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/styles/main.css
  
  Index: main.css
  ===================================================================
  /*
   * I wish I was a digital artist, but, in fact, I'm not.
   *
   * Great designers create, poor designers blatantly copy, so/so designers, well, 
   * "cite". Up to you to decide in which category I belong :-)
   *
   * Anyway, citations or blatant steals, here are the sites that influenced me:
   *
   *  1) http://www.stupidfool.org/ -> an *awesome* example of how a web page
   *     should be designed. I generally like Movable Type blogs because they
   *     are used by people who care about readability of their text. Using
   *     the correct fonts, giving the proper "air" (read: space) between
   *     paragraphs and the like. And this comes straight fromt the people who
   *     designed the tool. I seriously thought about using it, but I'm too
   *     "hacker inside" and proud of my work on Cocoon to use another publishing
   *     system so I wrote Linotype.
   * 
   *  2) http://www.x180.org/ -> Dundan's blog. Another example of readability
   *     clean design and well balanced space. To be honest, not much is
   *     really 'cited' from his stylesheets or web design, if not the 
   *     general philosophy of 'cut the crap' which I find refreshing in
   *     today's web where screen space feels like land to conquer pixel by pixel.
   *
   *  3) http://daringfireball.net/ -> hypertext has great potentials, but 
   *     most bloggers don't understand how visually aggressive (and distracting)
   *     those scattered underlined blue single words can be. Some try to lower
   *     this visual and cognitive aggression by removing the visual semantics
   *     of color keying or the use of underline and move onto a mouseover.
   *     One step up and two steps back: mouseover removes the hyperlink
   *     information from the visual semantics realms into a mixted bidimensional
   *     space of vision associated to motion, failing completely to provide a 
   *     'block overview' that is normally done when you are "eye scanning"
   *     a block of text to see if something interests you or not. This site
   *     concentrates a lot in making hyperlinks readable, coherent and meaningful
   *     without attacking your ability to read the text sequentially.
   *
   *  So, as you see, a lot of effort has been put into this stylesheet by 
   *  many different people. If you use it, please, at least cite us in the 
   *  stylesheet comments so that the word will spread :-)
   *
   *  Stefano.
   */
   
  /* ----------------------------- Global Definitions -------------------- */
  
  body {
      margin: 0px;
      padding: 0px;
  	font-family: "georgia", "times", "times new roman", serif;
      color: #222;
      background-color: #fff;
      font-size: 12px;
      quotes: "\201C" "\201E" "\2018" "\2019";
  }
  
  img {
      border: 0;
  }
  
  a:link {
  	color: #222;
  }
  
  a:visited {
  	color: #555;
  }
  
  a:hover {
  	color: #000;
  }
  
  a:active {
  }
  
  a:focus {
  }
  
  h1 {
      font-size: 28px;
      text-transform: uppercase;
      letter-spacing: 0.25em;
      padding: 20px 0px 20px 0px;
      margin: 0px 0px 0px 0px;
      color: #000;
      font-weight: normal;
  }
  
  h2 {
      font-family: "verdana", "helvetica", "arial", sans-serif;
      letter-spacing: 0.15em;
      text-transform: uppercase;
      font-size: 11px;
      color: #666;
      font-weight: normal;
      padding: 0px 0px 0px 0px;
      margin: -20px 0px 20px 0px; 
  }
  
  p { 
  	padding: 1px; 
  	margin: 5px 0px 5px 0px; 
  }
        
  blockquote { 
  	padding: 1px; 
  	margin: 10px 40px 10px 40px; 
  }
  
  input, select {
  	font-family: "georgia", "times", "times new roman", serif;
  	font-size: 13px;
      color: #333;
  }
  
  input[type="text"] {
  	border: 1px dashed #ccc;
  	padding: 3px;
  }
  
  input[type="password"] {
  	border: 1px dashed #ccc;     	
  	padding: 3px;
  }
  
  input[type="button"] {
      margin: 5px 5px 5px 5px;
  	border-width: 1px;
  }
  
  input[type="submit"] {
      margin: 5px;
  }
  
  /* ----------------------------- Sidebar  -------------------------- */
  
  #sidebar {
      position: fixed;
      width: 200px;
      height: auto;
      top: 0;
      right: auto;
      bottom: auto;
      left: 0;
      text-align: center;
  }
  
  #sidebar img {
      margin: 20px;
  }
  
  #sidebar h1 {
      font-size: 12px;
      font-weight: bold;
      margin: 20px 20px 3px 40px;
  }
  
  #sidebar ul {
      padding: 0px 20px 10px 40px;
      margin: 0px;
  }
  
  #sidebar li {
      margin-left: 0px;
      list-style-type: none;
      font-family: "verdana", "helvetica", "arial", sans-serif;
      font-size: 10px;
      margin-bottom: 5px;
  }
  
  /* ----------------------------- Bottombar ---------------------------- */
  
  #bottombar {
      position: fixed;
      width: 200px;
      height: auto;
      top: auto;
      right: 0;
      bottom: 0;
      left: 0;
      text-align: center;
      margin: 10px 0px 20px 0px;
  }
  
  /* ----------------------------- Footer ---------------------------- */
  
  #footer {
  	margin: 10px 20px 20px 220px;
  	text-align: center;
  }
  	
  /* ----------------------------- Page ---------------------------- */
  
  #page {
  	margin: 20px 20px 10px 220px;
  }
  
  /* ----------------------------- News ---------------------------- */
  
  .news a {
  	text-decoration: none;
  	color: #000;
  	border-bottom: 1px dotted #777;
  	margin: 0px 2px 0px 2px;
  	padding: 1px 1px 1px 1px;
  }
  
  .news a:hover {
  	border: 1px dotted #000;
  	background-color: #eee;
  	padding: 1px 2px 1px 2px;
  	margin: 0px;
  }
  
  .news a:active {
  	background-color: #ccc !important;
  	position: relative;
  	top: 1px;
  	left: 1px;
  	padding: 1px 2px 1px 2px;
  	margin: 0px;
  }
  
  .news a:focus {
  	border: 1px solid #fff !important;
  	background-color: #ccc !important;
  	padding: 1px 2px 1px 2px;
  	margin: 0px;
  }
  
  .news h1 {
      font-size: 13px;
      letter-spacing: 0em;
      text-transform: none;
      color: #333;
      font-weight: bold;
      padding: 10px 0px 0px 0px;
      margin: 0px 0px 0px 0px;
  }
  
  .news h1 img {
  	padding-right: 5px;
  }
  
  .news h2 {
      font-family: "verdana", "helvetica", "arial", sans-serif;
      letter-spacing: 0.10em;
      text-transform: uppercase;
      font-size: 10px;
      color: #666;
      font-weight:normal;
      padding: 2px 0px 5px 0px;
      margin: 0px 0px 0px 0px;
  }
  
  .news[online=''] {
  	background-color: #eee;
  }
  
  .news div.info {
      font-family: "verdana", "helvetica", "arial", sans-serif;
      font-size: 10px;
      margin-top: 10px;
  }
  
  .news div.separator {
  	text-align: center;
  	margin-top: 10px;
  	margin-bottom: 20px;
  }
  
  /* ----------------------------- Body ---------------------------- */
  
  .body h1, .body h2, .body h3, .body h4 {
  	font-family: "georgia", "times", "times new roman", serif;
      text-transform: none;
      margin: 0px 0px 0px 0px;
      color: #333;
      font-weight: bold;
  }
  
  .body h1 {
      font-size: 14px;
      letter-spacing: 0.15em;
      padding: 8px 0px 2px 0px;
  }
  
  .body h2 {
      font-size: 13px;
      letter-spacing: 0.10em;
      padding: 8px 0px 2px 0px;
  }
  
  .body h3 {
      font-size: 12px;
      letter-spacing: 0.05em;
      padding: 8px 0px 0px 0px;
  }
  
  .body h4 {
      font-size: 11px;
      letter-spacing: 0em;
      padding: 8px 0px 0px 0px;
  }
  
  .body p {
      font-size: 12px;
      line-height: 16px;
  }
  
  .body p.figure {
  	text-align: center;
  	margin: 10px 10px 10px 10px;
  	font-style: italic;
  }
  
  .body .first:first-letter {
  	position: relative;
  	top: -4px;
  	font-size: 38px;
  	padding-right: 6px; 
      font-weight: normal; 
      color: #000;    
  	text-transform: uppercase;
  	float: left;
  }
  
  .body .first:first-line { 
  	text-transform: uppercase 
  }
  
  .body img.floating-left {
  	float: left;
  	margin: 2px 5px 2px 0px;
  }
  
  .body img.floating-right {
  	float: right;
  	margin: 2px 5px 2px 5px;
  }
  
  .body blockquote {
  	margin: 10px 35px 10px 35px;
  	padding: 5px;
  }
  	
  .body blockquote.quote {
  	text-align: justify;
  	font-style: italic;
  }
  
  .body blockquote.code {
  	font-family: monospace;
  	border: 1px solid #ddd;
  }
  
  .body blockquote.note:before {
  	content: "Note: ";
  	font-weight: bold;
  }
  
  .body blockquote.note {
  	border: 1px solid #ccc;
  }
  
  .body blockquote.fixme:before {
  	content: "Fixme: ";
  	font-weight: bold;
  }
  
  .body blockquote.fixme {
  	border: 1px dashed #ccc;
  	color: #888;
  }
  
  .body ul, .body ol {
  	margin: 5px 35px 5px 35px;
  	padding: 5px;
  	counter-reset: item;
  }
  
  .body ul > ul, .body ul > ol, .body ol > ul, .body ol > ol {
  	margin: 0px 0px 0px 35px;
  	padding: 0px;
  }
  
  .body li {
  	padding: 1px; 
  	font-size: 12px;
      line-height: 16px;
  }
  
  .body strong {
  	font-weight: bolder;
  }
  
  .body em {
  	text-style: italic;
  }
  
  .body q:before {
  	content: open-quote;
  }
  
  .body q:after {
  	content: close-quote;
  }
  
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/styles/editor.css
  
  Index: editor.css
  ===================================================================
  #toolbar { margin: 0px 0px 0px 0px; padding: 3px 10px 3px 10px; background-color: #eee; }
  #toolbar .imagebutton { height: 20px; width: 20px; border: 1px solid #eee; }
  #toolbar .imagebutton img { position: relative; left: 0; top: 0; }
  
  #page {
  	margin-top: 5px;
  	margin: 20px 20px 20px 20px;
  }
  
  #page .field {
  	margin: 10px 0px 10px 0px;
  }
  
  #page input[name="title"] { 
  	font-weight: bold; 
  	font-size: 13px;
      color: #333;
  }
  
  #page iframe {
  	border: 1px dashed #ccc;
  }
  
  #page #path {
  	margin-top: 3px;
  	font-weight: bold; 
  	font-size: 10px;
      color: #888;
  }
  
  #input_toolbar {
  	text-align: center;
  	height: 25px;
  }
  
  #controls {
  	margin: 10px 20px 20px 20px;
  	text-align: center;
  }
  
  #previous_innerHTML {
  	display: none;
  }
  
  #block_selector {
  	margin: 0px 5px 0px 5px;
  	visibility: hidden;
  }
  
  #class_selector {
  	margin: 0px 5px 0px 5px;
  	visibility: hidden;
  }
  
  .spacer {
  	width: 15px;
  }
  
  .image_browser {
  	border: 1 dashed red;
  	margin: 5px;
  	visibility: hidden;
  }
  
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/styles/editor_page.css
  
  Index: editor_page.css
  ===================================================================
  body { 
  	padding: 0px; 
  	margin: 0px; 
  	border: 0px; 
  	cursor: text; 
  }
  
  a { 
  	cursor: text; 
  }
  
  img {
      border: 1px dotted #ccc;
  }
  
  hr {
  	border: none;
  	border-top: 1px solid #888;
  	width: 70%;
  }
  
  .source { 
  	font-family: "Monaco", "Lucida Console", monospace; 
  	padding: 5px; 
  	white-space: -moz-pre-wrap; 
  }
  
  .body { 
  	padding: 5px; 
  	margin: 0px; 
  	border: 0px 
  }
  
  .body p { background-color: #eee }
  .body p p { background-color: #ddd; }
  .body p p p { background-color: #ccc; }
  
  .body blockquote { background-color: #eee; }
  .body blockquote blockquote { background-color: #ddd; }
  .body blockquote blockquote blockquote { background-color: #ccc; }
  
  .body ul li { background-color: #eee; }
  .body ul ul li { background-color: #ddd; }
  .body ul ul ul li { background-color: #ccc; }
  
  .body ol li { background-color: #eee; }
  .body ol ol li { background-color: #ddd; }
  .body ol ol ol li { background-color: #ccc; }
  
  .body br:before {
  	content: "\21a9";
  	font-size: 10px;
  	text-style: none;
  	color: #888;
  }
  
  .body h1,h2,h3,h4 {
  	background-color: #eee;
  }
  
  .body img {
  	cursor: pointer;
  }
  
  
  
  1.1                  cocoon-2.1/src/blocks/linotype/samples/repository/news/2/document.xml
  
  Index: document.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <n:news xmlns:n="http://www.betaversion.org/linotype/news/1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:r="http://apache.org/cocoon/request/2.0" online="on" author="" creation-date="June 16, 2003" creation-time="19:30" creation-fulldate="Tue, 17 Jun 2003 00:30:52 GMT"><n:title>How to use Linotype</n:title><body xmlns:h="http://apache.org/cocoon/request/2.0">First of all, click on the linotype here on the left.<br/>
  <br/>
  When the login appear, use:<br/>
  <ul><li>user -&gt; guest</li>
  <li>password -&gt; guest</li>
  </ul>
  
  at that point, you are presented with the list of available news and a link to create a new one. Click on that, edit and enjoy.<br/>
  <br/>
  Ah, hint, try the image inserting feature. After you have inserted the image, if you drag your mouse over it, you resize it. Isn't it cool? :-)</body></n:news>