You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by jo...@apache.org on 2003/07/05 16:46:14 UTC

cvs commit: cocoon-2.1/src/blocks/proxy/samples/stylesheets newWizard2html.xsl

joerg       2003/07/05 07:46:14

  Modified:    src/webapp/samples samples.xml
               src/webapp sitemap.xmap
  Added:       src/blocks/proxy/samples samples.xml README.txt sitemap.xmap
               src/blocks/proxy/samples/cocoonhive/ow/xsl ow.xsl
                        mystyle.xsl owinc.xsl owattach.xsl
               src/blocks/proxy/samples/cocoonhive/amazon
                        listMania2xhtml.xsl bookInfo2page.xsl
                        bookInfo2xhtml.xsl
               src/blocks/proxy/java/org/apache/cocoon/generation
                        WebServiceProxyGenerator.java
               src/blocks/proxy/conf wsproxy.xmap proxy.xsamples
               src/blocks/proxy/samples/cocoonhive/stylesheets
                        page2html.xsl service2page.xsl page.css
               src/blocks/proxy/samples/cocoonhive/portal home.xml
               src/blocks/proxy/samples/cocoonhive sitemap.xmap
               src/blocks/proxy/samples/stylesheets newWizard2html.xsl
  Removed:     src/webapp/samples/webserviceproxy/cocoonhive/amazon
                        bookInfo2xhtml.xsl bookInfo2page.xsl
                        listMania2xhtml.xsl
               src/webapp/samples/webserviceproxy README.txt sitemap.xmap
               src/webapp/samples/webserviceproxy/cocoonhive sitemap.xmap
               src/webapp/samples/webserviceproxy/cocoonhive/ow/xsl ow.xsl
                        owattach.xsl owinc.xsl mystyle.xsl
               src/java/org/apache/cocoon/generation
                        WebServiceProxyGenerator.java
               src/webapp/samples/webserviceproxy/stylesheets
                        newWizard2html.xsl
               src/webapp/samples/webserviceproxy/cocoonhive/stylesheets
                        page.css service2page.xsl page2html.xsl
               src/webapp/samples/webserviceproxy/cocoonhive/portal
                        home.xml
  Log:
  Moved the WebServiceProxyGenerator into proxy block.
  Reactivated the samples with some minor fixes.
  
  If this now all works like expected Eclipse CVS will be really cool
  and I will kick WinCVS ;-)
  
  Revision  Changes    Path
  1.1                  cocoon-2.1/src/blocks/proxy/samples/samples.xml
  
  Index: samples.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <samples>
  
    <group name="Main examples page.">
      <sample name="Back" href="..">to Cocoon examples main page</sample>
    </group>
  
    <group name="Web Site Syndication">
      <sample name="Examples" href="wsproxy/">
        Demonstrates how to embed one website's functionality into another.
        Using the WebServiceProxyGenerator remote web app integration is easy.
      </sample>
      <sample name="Virtual Portal Demo" href="cocoonhive/">
        A more sophisticated example including Amazon and OpenWiki.
        Shows how a personalized portal can be built by connecting multiple remote
        services without writing a single line of business logic code.
        Only styling is used in addition to the proxy.
      </sample>
    </group> 
  
  </samples>
  
  
  
  1.1                  cocoon-2.1/src/blocks/proxy/samples/README.txt
  
  Index: README.txt
  ===================================================================
  ------------------------------------------------------------------------
  
  The WebServiceProxyGenerator is intended to allow one 
  Web Site to Embed Another Web Site's presentation and logic.
  It is an extension of the popular RSS based content syndication. 
  
  
  Requirements:
  
  1) Easy syndication of interactive content.  
  
  2) Transparent routing of web service request through GET, POST, SOAP-RPC and SOAP-DOC binding methods.
  
  3) Near complete control only through sitemap configuration.
  
  4) Reuse of Cocoon components for content formatting, aggregation and styling through a tight integration with the Cocoon sitemap.
  
  5) Require 0 (zero) lines of Java or other business logic code in most cases.
  
  6) Be generic and flexible enough to allow custom extensions for advanced and non-typical uses.
  
  7) Support sessions, authentication, http 1.1, https,  request manipulation, redirects following, connection pooling, and others.
  
  8) Use the Jakarta HttpClient library which provides many sophisticated features for HTTP connections.
  
  9) (TBD) Use Axis for SOAP-RPC and SOAP-DOC bindings.
  
  
  ------------------------------------------------------------------------
  Example I: Integration of the Amazon book search service in a Cocoon portal:
  ------------------------------------------------------------------------
  
  pipeline:
  ---------
  
      <map:pipeline>
        <map:match pattern="amazon/searchform">
          <map:generate src="AmazonForm.xml"/>
          <map:transform src="AmazonForm2html.xsl"/>
          <map:transform src="context://stylesheets/xmlform/xmlform2html.xsl"/>
          <map:serialize type="html"/>
        </map:match>  
  
        <map:match pattern="amazon/search*">
          <map:generate type="wsproxy" src="http://rcm.amazon.com/e/cm{1}">
            <!-- The WebSericeProxy generator takes 3 arguments: -->
            <!-- 1) The URL of the targeted web service -->
            <!-- 2) The binding method: GET, POST, SOAP-RPC or SOAP-DOC -->
            <!-- 3) Optionally, name of the session to the remote service, which allows scoping and grouping between different sitemap sections. -->
            <!-- Only 1) is required. 2) and 3) are optional and should not be used for most applications -->
            <map:parameter name="wsproxy-method" value="GET"/>
            <map:parameter name="wsproxy-session" value="myAmazonSession"/>
          </map:generate>
  
          <map:transform src="amazonform2html.xsl"/>
          <map:transform src="context://stylesheets/xmlform/xmlform2html.xsl"/>
          <map:serialize type="html"/>
        </map:match>  
      </map:pipeline>
  
  
  AmazonForm.xml:
  ---------------
  
  <?xml version="1.0" ?>
  <document xmlns:xf="http://apache.org/cocoon/xmlform/1.0">
    <xf:form id="form-amazon" view="search" action="amazon/search?t=myAmazonId-02-20&amp;l=st1&amp;mode=books&amp;p=102&amp;o=1&amp;f=xml">
      <xf:caption>Amazon book search by keyword</xf:caption>    
      <xf:textbox ref="search">
          <xf:caption>Keywords</xf:caption>
      </xf:textbox>       
      <xf:submit id="submit" class="button">
        <xf:caption>Submit</xf:caption>
      </xf:submit>
    </xf:form>
  </document>
  
  
  ------------------------------------------------------------------------
  Example II: Even more interesting. 
  Integration with an interactive web service - the Cocoon FeedBack Wizard. 
  Notice that it is actually simpler to integrate with an interactive 
  service then a "single call" based one, because WebServiceProxy supports sessions !
  ------------------------------------------------------------------------
  
      <map:pipeline>
        <map:match pattern="RemoteWizard/*">
          <map:generate type="wsproxy" src="http://remotehost:8080/cocoon/samples/xmlform/{1}">
              <map:parameter name="wsproxy-method" value="POST"/>
              <map:parameter name="wsproxy-session" value="myFeedbackWizardSession"/>
          </map:generate>
          <map:transform src="myNewStyle-wizard2html.xsl"/>
          <map:transform src="context://stylesheets/xmlform/xmlform2html.xsl"/>
          <map:serialize type="html"/>
        </map:match>  
      </map:pipeline>
  
  
  
  ------------------------------------------------------------------------
  End of file
  ------------------------------------------------------------------------
  
  
  -- 
  
  -= Ivelin =-
  
  
  
  
  
  
  1.1                  cocoon-2.1/src/blocks/proxy/samples/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
    <!-- =========================== Views =================================== -->
    <map:views>
      <map:view name="xml" from-label="xml">
        <map:serialize type="xml"/>
      </map:view>
    </map:views>
    <!-- =========================== Pipelines ================================= -->
    <map:pipelines>
      <map:pipeline>
        <map:match pattern="">
          <map:redirect-to uri="welcome"/>
        </map:match>
  
        <map:match pattern="welcome">
          <map:generate src="samples.xml"/>
          <map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
            <map:parameter name="contextPath" value="{request:contextPath}"/>
          </map:transform>
          <map:serialize type="html"/>
        </map:match>
      </map:pipeline>
  
      <!-- pipeline mounting Cocoon hive portal demo -->
      <map:pipeline>
        <map:match pattern="cocoonhive/**">
          <map:mount check-reload="yes" src="cocoonhive/" uri-prefix="cocoonhive"/>
        </map:match>
      </map:pipeline>
  
      <!-- Interactive Web Application Syndication  -->
      <map:pipeline>
        <map:match pattern="wsproxy/*">
          <map:generate type="wsproxy" label="xml"
            src="http://{request:serverName}:{request:serverPort}{request:contextPath}/samples/xmlform/wizard?cocoon-view=xml"/>
          <map:transform src="stylesheets/newWizard2html.xsl" />
          <map:transform src="context://stylesheets/system/xmlform2html.xslt"/>
          <map:serialize type="html"/>
        </map:match>
      </map:pipeline>
    </map:pipelines>
  </map:sitemap>
  
  
  
  1.1                  cocoon-2.1/src/blocks/proxy/samples/cocoonhive/ow/xsl/ow.xsl
  
  Index: ow.xsl
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  xmlns:msxsl="urn:schemas-microsoft-com:xslt"
                  xmlns:ow="http://openwiki.com/2001/OW/Wiki"
                  xmlns="http://www.w3.org/1999/xhtml"
                  version="1.0">
                  
  <xsl:output  method="xml" version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="no" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"  doctype-system="DTD/xhtml1-strict.dtd"/>
  
  <!--
  <xsl:include href="owinc.xsl"/>
  -->
  <xsl:include href="owattach.xsl"/>
  <xsl:include href="mystyle.xsl"/>
  
  <xsl:variable name="name" select="string(/ow:wiki/ow:page/@name)" />
  
  <xsl:template match="*">
    <xsl:element name="{name()}">
      <xsl:copy-of select="@*"/>
      <xsl:apply-templates/>
    </xsl:element>
  </xsl:template>
  
  <xsl:template match="processing-instruction()|comment()|text()">
    <xsl:copy>
      <xsl:apply-templates/>
    </xsl:copy>
  </xsl:template>
  
  <!-- ridiculous! IE processes <br></br> differently compared to <br /> ! -->
  <xsl:template match="br">
    <br />
  </xsl:template>
  
  <xsl:template match="big">
    <b><big><xsl:apply-templates/></big></b>
  </xsl:template>
  
  <xsl:template match="table">
    <table cellspacing="0" cellpadding="2" border="1" width="100%">
      <xsl:apply-templates/>
    </table>
  </xsl:template>
  
  <!-- ==================== used to do client-side transformation ==================== -->
  <xsl:template match="/ow:wiki">
    <xsl:choose>
      <xsl:when test="@mode='view'">
        <xsl:apply-templates select="." mode="view"/>
      </xsl:when>
      <xsl:when test="@mode='edit'">
        <xsl:apply-templates select="." mode="edit"/>
      </xsl:when>
      <xsl:when test="@mode='print'">
        <xsl:apply-templates select="." mode="print"/>
      </xsl:when>
      <xsl:when test="@mode='naked'">
        <xsl:apply-templates select="." mode="naked"/>
      </xsl:when>
      <xsl:when test="@mode='diff'">
        <xsl:apply-templates select="." mode="diff"/>
      </xsl:when>
      <xsl:when test="@mode='changes'">
        <xsl:apply-templates select="." mode="changes"/>
      </xsl:when>
      <xsl:when test="@mode='titlesearch'">
        <xsl:apply-templates select="." mode="titlesearch"/>
      </xsl:when>
      <xsl:when test="@mode='fullsearch'">
        <xsl:apply-templates select="." mode="fullsearch"/>
      </xsl:when>
      <xsl:when test="@mode='login'">
        <xsl:apply-templates select="." mode="login"/>
      </xsl:when>
      <xsl:when test="@mode='attach'">
        <xsl:apply-templates select="." mode="attach"/>
      </xsl:when>
      <xsl:when test="@mode='attachchanges'">
        <xsl:apply-templates select="." mode="attachchanges"/>
      </xsl:when>
      <xsl:when test="@mode='embedded'">
        <xsl:apply-templates select="." mode="embedded"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:apply-templates select="." mode="view"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  
  <xsl:template name="pi">
  </xsl:template>
  
  <xsl:template match="/ow:wiki" mode="view">
      <div>
          <xsl:call-template name="brandingImage"/>
          <xsl:apply-templates select="ow:page"/>
      </div>
  </xsl:template>
  
  
  
  <xsl:template match="ow:page">
      <xsl:if test="/ow:wiki/ow:userpreferences/ow:editlinkontop">
          <a class="same"><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?p=<xsl:value-of select="$name"/>&amp;a=edit<xsl:if test="@revision">&amp;revision=<xsl:value-of select="@revision"/></xsl:if></xsl:attribute>Edit</a> this page
          <xsl:if test="not(@changes='0')">
              <font size="-2">(last edited <xsl:value-of select="string(ow:change/ow:date)"/>)</font>
          </xsl:if>
          <br />
      </xsl:if>
      <xsl:if test="/ow:wiki/ow:userpreferences/ow:bookmarksontop">
        <xsl:if test="not(/ow:wiki/ow:userpreferences/ow:bookmarks='None')">
          <xsl:apply-templates select="/ow:wiki/ow:userpreferences/ow:bookmarks"/>
        </xsl:if>
      </xsl:if>
      <hr noshade="noshade" size="1" />
      <xsl:apply-templates select="../ow:trail"/>
      <xsl:if test="../ow:redirectedfrom">
          <b>Redirected from <a title="Edit this page"><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?a=edit&amp;p=<xsl:value-of select="string(../ow:redirectedfrom/@name)"/></xsl:attribute><xsl:value-of select="../ow:redirectedfrom/text()"/></a></b>
          <p />
      </xsl:if>
      <xsl:if test="@revision">
          <b>Showing revision <xsl:value-of select="@revision"/></b>
      </xsl:if>
  
      <xsl:apply-templates select="ow:body"/>
  
      <form name="f" method="get">
      <xsl:attribute name="action"><xsl:value-of select="/ow:wiki/ow:scriptname"/></xsl:attribute>
      <hr noshade="noshade" size="1" />
      <table cellspacing="0" cellpadding="0" border="0" width="100%">
  
        <xsl:if test="not(/ow:wiki/ow:userpreferences/ow:bookmarks='None')">
          <tr>
            <td align="left" class="n">
              <xsl:apply-templates select="/ow:wiki/ow:userpreferences/ow:bookmarks"/>
            </td>
            <td align="right" rowspan="2">
              <xsl:call-template name="poweredBy"/>
            </td>
          </tr>
        </xsl:if>
  
        <tr>
          <td align="left" class="n">
              <a class="same"><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?p=<xsl:value-of select="$name"/>&amp;a=edit<xsl:if test='@revision'>&amp;revision=<xsl:value-of select="@revision"/></xsl:if></xsl:attribute>Edit <xsl:if test='@revision'>revision <xsl:value-of select="@revision"/> of</xsl:if> this page</a>
              <xsl:if test="@revision or (ow:change and not(ow:change/@revision = 1))">
                  |
                  <a class="same"><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?p=<xsl:value-of select="$name"/>&amp;a=changes</xsl:attribute>View other revisions</a>
              </xsl:if>
              <xsl:if test='@revision'>
                  |
                  <a class="same"><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?p=<xsl:value-of select="$name"/></xsl:attribute>View current revision</a>
              </xsl:if>
              <xsl:if test="/ow:wiki/ow:allowattachments">
                  |
                  <a class="same"><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?p=<xsl:value-of select="$name"/>&amp;a=attach</xsl:attribute>Attachments</a> (<xsl:value-of select="count(ow:attachments/ow:attachment[@deprecated='false'])"/>)
              </xsl:if>
          </td>
        </tr>
        <tr>
          <td align="left" class="n">
              <a class="same"><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?p=<xsl:value-of select="$name"/>&amp;a=print&amp;revision=<xsl:value-of select="ow:change/@revision"/></xsl:attribute>Print this page</a>
              |
              <a class="same"><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?p=<xsl:value-of select="$name"/>&amp;a=xml&amp;revision=<xsl:value-of select="ow:change/@revision"/></xsl:attribute>View XML</a>
              <br />
              <a class="same"><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?p=FindPage&amp;txt=<xsl:value-of select="$name"/></xsl:attribute>Find page</a> by browsing, searching or an index
              <br />
              <xsl:if test="not(@changes='0')">
                  Edited <xsl:value-of select="string(ow:change/ow:date)"/>
                  <xsl:text> </xsl:text>
                  <a class="same"><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?p=<xsl:value-of select="$name"/><xsl:if test="@revision">&amp;difffrom=<xsl:value-of select="@revision"/></xsl:if>&amp;a=diff</xsl:attribute>(diff)</a>
                  <br />
              </xsl:if>
              <input type="hidden" name="a" value="fullsearch" />
              <input type="text" name="txt" size="30" ondblclick='event.cancelBubble=true;' /> <input type="submit" value="Search"/>
          </td>
          <td align="right">
              <xsl:call-template name="validatorButtons"/>
          </td>
        </tr>
      </table>
      </form>
  </xsl:template>
  
  <!-- ==================== wiki link to an existing page ==================== -->
  
  <xsl:template name="href">
    <xsl:param name="href"/>
    <xsl:choose>
      <xsl:when test="starts-with($href, 'ow.asp?')">
        <xsl:value-of select="concat('ow.asp?p=', substring-after($href,'ow.asp?'))"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$href"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  
  <xsl:template match="ow:link">
      <xsl:variable name="href">
        <xsl:call-template name="href">
            <xsl:with-param name="href" select="@href"/>
        </xsl:call-template>
      </xsl:variable>
      <xsl:choose>
          <xsl:when test="@date">
              <a href="{$href}{@anchor}" title="Last changed: {string(@date)}"><xsl:value-of select="text()"/></a>
          </xsl:when>
          <xsl:otherwise>
              <xsl:value-of select="text()"/><a class="nonexistent" href="{$href}" title="Describe this page">?  </a>
          </xsl:otherwise>
      </xsl:choose>
  </xsl:template>
  
  <!-- ==================== bookmarks from the user preferences ==================== -->
  <xsl:template match="ow:bookmarks">
      <xsl:for-each select="ow:link">
          <xsl:variable name="href">
            <xsl:call-template name="href">
                <xsl:with-param name="href" select="@href"/>
            </xsl:call-template>
          </xsl:variable>
          <a href="{$href}"><xsl:value-of select="text()"/></a>
          <xsl:if test="not(position()=last())"> | </xsl:if>
      </xsl:for-each>
  </xsl:template>
  
  <!-- ==================== the trail, the last visited wiki pages ==================== -->
  <xsl:template match="ow:trail">
      <xsl:if test="count(ow:link) &gt; 1 and ../ow:userpreferences/ow:trailontop">
          <small>
              <xsl:for-each select="ow:link">
                  <xsl:choose>
                      <xsl:when test="../../ow:page/ow:link/@href=@href">
                          &#187; <xsl:value-of select="text()"/>
                      </xsl:when>
                      <xsl:otherwise>
                          <xsl:variable name="href">
                            <xsl:call-template name="href">
                                <xsl:with-param name="href" select="@href"/>
                            </xsl:call-template>
                          </xsl:variable>
                          &#187; <a href="{$href}"><xsl:value-of select="text()"/></a>
                      </xsl:otherwise>
                  </xsl:choose>
              </xsl:for-each>
          </small>
          <hr noshade="noshade" size="1" />
      </xsl:if>
  </xsl:template>
  
  
  <!-- ==================== actual body of a page ==================== -->
  <xsl:template match="ow:body">
      <xsl:if test=".='' and not(/ow:wiki/@mode='embedded')">
          <br />
          <a><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?p=<xsl:value-of select="$name"/>&amp;a=edit</xsl:attribute>Describe <xsl:value-of select="../ow:link/text()"/> here</a>
          <xsl:apply-templates select="../../ow:templates"/>
      </xsl:if>
      <xsl:if test="starts-with(text(), '#DEPRECATED')">
          <font color="#ff0000"><b>This page will be permanently destroyed.</b></font>
          <p />
      </xsl:if>
      <xsl:apply-templates select="text() | *"/>
      <xsl:apply-templates select="../ow:attachments">
          <xsl:with-param name="showhidden">false</xsl:with-param>
          <xsl:with-param name="showactions">false</xsl:with-param>
      </xsl:apply-templates>
  </xsl:template>
  
  
  <!-- ==================== templates one can use to create a new page ==================== -->
  <xsl:template match="ow:templates">
      <p/>
      <br />
      <br />
      Alternatively, create this page using one of these templates:
      <ul>
      <xsl:apply-templates select="ow:page"/>
      </ul>
      To create your own template add a page with a name ending in Template.
  </xsl:template>
  
  <!-- ==================== template one can use to create a new page ==================== -->
  <xsl:template match="ow:templates/ow:page">
      <li>
        <a><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?p=<xsl:value-of select="$name"/>&amp;a=edit&amp;template=<xsl:value-of select="string(@name)"/></xsl:attribute><xsl:value-of select="ow:link/text()"/></a>
        &#160;
        (<a target="_blank"><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?<xsl:value-of select="string(@name)"/></xsl:attribute>view template</a>
         <a target="_blank"><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?<xsl:value-of select="string(@name)"/></xsl:attribute><img src="ow/images/popup.gif" width="15" height="9" border="0" alt="" /></a>)
      </li>
  </xsl:template>
  
  
  <!-- ==================== handles the openwiki-html element ==================== -->
  <xsl:template match="ow:html">
    <xsl:value-of select="." disable-output-escaping="yes" />
  </xsl:template>
  
  
  <!-- ==================== handles the openwiki-math element ==================== -->
  <xsl:template match="ow:math">
    <math xmlns="http://www.w3.org/1998/Math/MathML">
      <xsl:value-of select="." disable-output-escaping="yes" />
    </math>
  </xsl:template>
  
  
  <!-- ==================== inclusion of another wikipage in this wikipage ==================== -->
  <xsl:template match="ow:body/ow:page">
      <xsl:apply-templates select="ow:body"/>
      <div align="right"><small>[goto <xsl:apply-templates select="ow:link"/>]</small></div>
      <p/>
  </xsl:template>
  
  
  <!-- ==================== shows an error message ==================== -->
  <xsl:template match="ow:error">
      <li><font color="red"><xsl:value-of select="."/></font></li>
  </xsl:template>
  
  <!-- ==================== shows footnotes ==================== -->
  <xsl:template match="ow:footnotes">
      <p></p>
      ____
      <xsl:apply-templates select="ow:footnote" />
  </xsl:template>
  
  <xsl:template match="ow:footnote">
      <br /><a name="#footnote{@index}"></a><sup>&#160;&#160;&#160;<xsl:value-of select="@index"/>&#160;</sup><xsl:apply-templates />
  </xsl:template>
  
  
  <!-- ==================== show an RSS feed ==================== -->
  <xsl:template match="ow:feed">
      <xsl:apply-templates/>
      <small>
      <br />
      last update: <xsl:value-of select="string(@last)"/>
      <br />
      <a href="{@href}" target="_blank"><img src="ow/images/xml.gif" width="36" height="14" border="0" alt="" /></a> |
      <a href="{/ow:wiki/ow:scriptname}?p={/ow:wiki/ow:page/ow:link/@name}&amp;a=refresh&amp;refreshurl={string(@href)}">refresh</a> |
      <a href="{/ow:wiki/ow:scriptname}?p={/ow:wiki/ow:page/ow:link/@name}&amp;a=refresh">refresh all</a>
      </small>
  </xsl:template>
  
  <!-- ==================== show an aggregated RSS feed ==================== -->
  <xsl:template match="ow:aggregation">
      <xsl:apply-templates/>
      <small>
      <br />
      last update: <xsl:value-of select="string(@last)"/>
      <br />
      <a href="{@href}" target="_blank"><img src="ow/images/xml.gif" width="36" height="14" border="0" alt="" /></a> |
      <a href="{@refreshURL}">refresh</a>
      </small>
  </xsl:template>
  
  
  <xsl:template match="ow:interlinks">
      <script language="javascript" type="text/javascript" charset="{/ow:wiki/@encoding}">
        <xsl:text disable-output-escaping="yes">&lt;!--
          function ask(pURL) {
              var x = prompt("Enter the word you're searching for:", "");
              if (x != null) {
                  var pos = pURL.indexOf("$1");
                  if (pos > 0) {
                      top.location.assign(pURL.substring(0, pos) + x + pURL.substring(pos + 2, pURL.length));
                  } else {
                      top.location.assign(pURL + x);
                  }
              }
          }
      //--&gt;</xsl:text>
      </script>
      <table cellspacing="0" cellpadding="2" border="0">
        <xsl:for-each select="ow:interlink">
          <tr><td class="n"><li><xsl:value-of select="text()"/></li> &#160;&#160;</td><td class="n"><a href="#" onclick="javascript:ask('{@href}');"><xsl:value-of select="@href"/></a></td></tr>
        </xsl:for-each>
      </table>
  </xsl:template>
  
  
  <xsl:template match="/ow:wiki" mode="edit">
    <xsl:call-template name="pi"/>
    <html>
    <xsl:call-template name="head"/>
      <body bgcolor="#ffffff">
          <xsl:attribute name="onload">document.f.text.focus();</xsl:attribute>
  
          <script language="javascript" type="text/javascript" charset="{@encoding}">
            <xsl:text disable-output-escaping="yes">&lt;!--
              function openw(pURL)
              {
                  var w = window.open(pURL, "openw", "width=680,height=560,resizable=1,statusbar=1,scrollbars=1");
                  w.focus();
              }
  
              function preview()
              {
                  var w = window.open("", "preview", "width=680,height=560,resizable=1,statusbar=1,scrollbars=1");
                  w.focus();
  
                  var body = '&lt;html&gt;&lt;head&gt;&lt;meta http-equiv="Content-Type" content="text/html; charset=</xsl:text><xsl:value-of select="@encoding"/><xsl:text disable-output-escaping="yes">;" />&lt;/head&gt;&lt;body&gt;&lt;form name="pvw" method="post" action="</xsl:text><xsl:value-of select="/ow:wiki/ow:location"/><xsl:value-of select="/ow:wiki/ow:scriptname"/><xsl:text disable-output-escaping="yes">" /&gt;';
                  body += '&lt;input type="hidden" name="a" value="preview" /&gt;';
                  body += '&lt;input type="hidden" name="p" value="</xsl:text><xsl:value-of select="$name"/><xsl:text disable-output-escaping="yes">" /&gt;';
                  body += '&lt;input id="text" type="hidden" name="text"/&gt;&lt;/form&gt;&lt;/body&gt;&lt;/html&gt;';
  
                  w.document.open();
                  w.document.write(body);
                  w.document.close();
  
                  w.document.forms[0].elements['text'].value = window.document.forms[0].elements['text'].value;
                  w.document.forms[0].submit();
              }
  
              function saveDocumentCheck(evt) {
                      var desiredKeyState = evt.ctrlKey &amp;&amp; !evt.altKey &amp;&amp; !evt.shiftKey;
                      var key = evt.keyCode;
                      var charS = 83;
                      if ( desiredKeyState &amp;&amp; key == charS ) {
                              window.document.forms[0].elements['save'][0].click();
                              evt.returnValue = false;
                      }
              }
  
              function theTextAreaValue() {
                  return window.document.forms[0].elements['text'].value;
              }
  
              savedValue = 'Empty';
              function checkChanged() {
                      currentValue = theTextAreaValue();
                      if (currentValue != savedValue) {
                              event.returnValue = 'Text changed without saving.';
                      }
              }
              function saveText(v) {
                      if (savedValue == 'Empty') {
                              setText(v);
                      }
                      window.onbeforeunload = checkChanged;
              }
              function setText(v) {
                      savedValue = v;
              }
  
            //--&gt;</xsl:text>
          </script>
  
          <h1>Editing <xsl:if test="ow:page/@revision">revision <xsl:value-of select="ow:page/@revision"/> of </xsl:if><xsl:value-of select="ow:page/@name"/></h1>
          <hr size="1" />
          <a class="same" href="{/ow:wiki/ow:scriptname}?p=Help" onclick="javascript:openw('{/ow:wiki/ow:scriptname}?p=Help&amp;a=print'); return false;">Help</a>
          <a class="same" href="{/ow:wiki/ow:scriptname}?p=Help" onclick="javascript:openw('{/ow:wiki/ow:scriptname}?p=Help&amp;a=print'); return false;"><img src="ow/images/popup.gif" width="15" height="9" border="0" alt="" /></a>
          |
          <a class="same" href="{/ow:wiki/ow:scriptname}?p=HelpOnFormatting" onclick="javascript:openw('{/ow:wiki/ow:scriptname}?p=HelpOnFormatting&amp;a=print'); return false;">Help On Formatting</a>
          <a class="same" href="{/ow:wiki/ow:scriptname}?p=HelpOnFormatting" onclick="javascript:openw('{/ow:wiki/ow:scriptname}?p=HelpOnFormatting&amp;a=print'); return false;"><img src="ow/images/popup.gif" width="15" height="9" border="0" alt="" /></a>
          |
          <a class="same" href="{/ow:wiki/ow:scriptname}?p=HelpOnEditing" onclick="javascript:openw('{/ow:wiki/ow:scriptname}?p=HelpOnEditing&amp;a=print'); return false;">Help On Editing</a>
          <a class="same" href="{/ow:wiki/ow:scriptname}?p=HelpOnEditing" onclick="javascript:openw('{/ow:wiki/ow:scriptname}?p=HelpOnEditing&amp;a=print'); return false;"><img src="ow/images/popup.gif" width="15" height="9" border="0" alt="" /></a>
          |
          <a class="same" href="{/ow:wiki/ow:scriptname}?p=HelpOnEmoticons" onclick="javascript:openw('{/ow:wiki/ow:scriptname}?p=HelpOnEmoticons&amp;a=print'); return false;">Help On Emoticons</a>
          <a class="same" href="{/ow:wiki/ow:scriptname}?p=HelpOnEmoticons" onclick="javascript:openw('{/ow:wiki/ow:scriptname}?p=HelpOnEmoticons&amp;a=print'); return false;"><img src="ow/images/popup.gif" width="15" height="9" border="0" alt="" /></a>
          <br />
          <br />
          <xsl:if test="ow:page/@revision">
              <b>Editing old revision <xsl:value-of select="ow:page/@revision"/>. Saving this page will replace the latest revision with this text.</b>
          </xsl:if>
          <xsl:apply-templates select="ow:error"/>
  
          <xsl:if test="ow:textedits">
              <p>
                  The text you edited is shown below.
                  The text in the textarea box shows the latest version of this page.
              </p>
              <hr size="1" />
              <pre><xsl:value-of select="ow:textedits"/></pre>
              <hr size="1" />
          </xsl:if>
  
          <form name="f" method="post" onsubmit="setText(theTextAreaValue()); return true;">
              <xsl:attribute name="action"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?a=edit#preview</xsl:attribute>
              <input type="submit" name="save" value="Save" />
              &#160;
              <input type="button" name="prev1" value="Preview" onclick="javascript:preview();" />
              <!-- <input type="submit" name="preview" value="Preview" /> -->
              &#160;
              <input type="button" name="cancel" value="Cancel" onClick="javascript:window.location='{/ow:wiki/ow:scriptname}?p={$name}';" />
              <br />
              <br />
              <textarea id="text" name="text" wrap="virtual" onfocus="saveText(this.value)" onkeydown="saveDocumentCheck(event);"><xsl:attribute name="rows"><xsl:value-of select="/ow:wiki/ow:userpreferences/ow:rows"/></xsl:attribute><xsl:attribute name="cols"><xsl:value-of select="/ow:wiki/ow:userpreferences/ow:cols"/></xsl:attribute><xsl:value-of select="ow:page/ow:raw/text()"/></textarea><br />
              <input type="checkbox" name="rc" value="1">
                <xsl:if test="ow:page/ow:change/@minor='false' and not(starts-with(ow:page/ow:raw/text(), '#MINOREDIT'))">
                  <xsl:attribute name="checked">checked</xsl:attribute>
                </xsl:if>
              </input>
              Include page in
              <a href="{/ow:wiki/ow:scriptname}?p=RecentChanges" onclick="javascript:openw('{/ow:wiki/ow:scriptname}?p=RecentChanges&amp;a=print'); return false;">Recent Changes</a>
              <a href="{/ow:wiki/ow:scriptname}?p=RecentChanges" onclick="javascript:openw('{/ow:wiki/ow:scriptname}?p=RecentChanges&amp;a=print'); return false;"><img src="ow/images/popup.gif" width="15" height="9" border="0" alt="" /></a>
              list.
              <br />
              <br />
              Optional comment about this change:
              <br />
              <input type="text" name="comment" style="color:#333333; width:100%" maxlength="1000"><xsl:attribute name="size"><xsl:value-of select="/ow:wiki/ow:userpreferences/ow:cols"/></xsl:attribute><xsl:attribute name="value"><xsl:value-of select="ow:page/ow:change/ow:comment/text()"/></xsl:attribute></input>
              <br />
              <input type="hidden" name="revision" value="{ow:page/@revision}" />
              <input type="hidden" name="newrev" value="{ow:page/ow:change/@revision}" />
              <input type="hidden" name="p" value="{$name}" />
              <input type="submit" name="save" value="Save" />
              &#160;
              <input type="button" name="prev2" value="Preview" onclick="javascript:preview();" />
              <!-- <input type="submit" name="preview" value="Preview" /> -->
              &#160;
              <input type="button" name="cancel" value="Cancel" onClick="javascript:window.location='{/ow:wiki/ow:scriptname}?p={$name}';" />
          </form>
  
          <xsl:if test="ow:page/ow:body">
            <!-- this shows the preview, pre 0.74 versions -->
               <a name="preview"/>
               <hr size="1" />
               <h1>Preview</h1>
               <hr size="1" />
               <xsl:apply-templates select="ow:page/ow:body"/>
               <hr size="1" />
            <!-- end preview -->
          </xsl:if>
      </body>
    </html>
  </xsl:template>
  
  
  
  <xsl:template match="/ow:wiki" mode="print">
    <xsl:call-template name="pi"/>
    <html>
    <xsl:call-template name="head"/>
      <body bgcolor="#ffffff" onload="window.defaultStatus='{$brandingText}'">
        <h2>
          <a name="h0" class="same"><xsl:value-of select="ow:page/ow:link"/></a>
        </h2>
        <xsl:apply-templates select="ow:page/ow:body"/>
      </body>
    </html>
  </xsl:template>
  
  
  
  <xsl:template match="/ow:wiki" mode="naked">
    <xsl:call-template name="pi"/>
    <html>
    <xsl:call-template name="head"/>
      <body bgcolor="#ffffff" onload="window.defaultStatus='{$brandingText}'">
        <xsl:attribute name="ondblclick">location.href='<xsl:value-of select="/ow:wiki/ow:scriptname"/>?p=<xsl:value-of select="$name"/>&amp;a=edit<xsl:if test='ow:page/@revision'>&amp;revision=<xsl:value-of select="ow:page/@revision"/></xsl:if>'</xsl:attribute>
        <h2>
          <a name="h0" class="same"><xsl:value-of select="ow:page/ow:link"/></a>
        </h2>
        <xsl:apply-templates select="ow:page/ow:body"/>
      </body>
    </html>
  </xsl:template>
  
  
  <xsl:template match="/ow:wiki" mode="embedded">
      <xsl:apply-templates select="ow:page/ow:body"/>
  </xsl:template>
  
  
  
  <xsl:template match="ow:diff">
      <pre class="diff">
          <xsl:apply-templates/>
      </pre>
  </xsl:template>
  
  <xsl:template match="/ow:wiki" mode="diff">
    <xsl:call-template name="pi"/>
    <html>
    <xsl:call-template name="head"/>
          <body bgcolor="#ffffff" onload="window.defaultStatus='{$brandingText}'">
          <xsl:call-template name="brandingImage"/>
          <h1>
            <a class="same" href="{ow:scriptname}?a=fullsearch&amp;txt={$name}&amp;fromtitle=true" title="Do a full text search for {ow:page/ow:link/text()}">
              <xsl:value-of select="ow:page/ow:link/text()"/>
            </a>
          </h1>
          <xsl:apply-templates select="ow:userpreferences/ow:bookmarks"/>
          <hr noshade="noshade" size="1" />
  
          <xsl:choose>
              <xsl:when test="ow:diff = ''">
                  <b>No difference available. This is the first <xsl:value-of select="ow:diff/@type"/> revision.</b>
                  <hr noshade="noshade" size="1"/>
                  <xsl:apply-templates select="ow:trail"/>
                  <xsl:if test='ow:page/@revision'>
                      <b>Showing revision <xsl:value-of select="ow:page/@revision"/></b>
                      <p></p>
                  </xsl:if>
                  <xsl:apply-templates select="ow:page/ow:body"/>
              </xsl:when>
              <xsl:otherwise>
                  <xsl:if test="not(ow:diff/@type='selected')">
                      <b>Difference from prior <xsl:value-of select="ow:diff/@type"/>
                      revision<xsl:if test="not(ow:diff/@to = ow:page/@lastminor)"> relative to revision
                      <xsl:value-of select="ow:diff/@to"/>
                      </xsl:if>.</b>
                  </xsl:if>
                  <xsl:if test="ow:diff/@type='selected'">
                      <b>Difference from revision <xsl:value-of select="ow:diff/@from"/> to
                      <xsl:choose>
                          <xsl:when test="ow:diff/@to = ow:page/@lastminor">
                              the current revision.
                          </xsl:when>
                          <xsl:otherwise>
                              revision <xsl:value-of select="ow:diff/@to"/>.
                          </xsl:otherwise>
                      </xsl:choose>
                      </b>
                  </xsl:if>
                  <br />
                  <xsl:if test="not(ow:diff/@type='major')">
                      <a><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?p=<xsl:value-of select="$name"/>&amp;a=diff</xsl:attribute>major diff</a>
                      <xsl:text> </xsl:text>
                  </xsl:if>
                  <xsl:if test="not(ow:diff/@type='minor')">
                      <a><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?p=<xsl:value-of select="$name"/>&amp;a=diff&amp;diff=1</xsl:attribute>minor diff</a>
                      <xsl:text> </xsl:text>
                  </xsl:if>
                  <xsl:if test="not(ow:diff/@type='author')">
                      <a><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?p=<xsl:value-of select="$name"/>&amp;a=diff&amp;diff=2</xsl:attribute>author diff</a>
                      <xsl:text> </xsl:text>
                  </xsl:if>
                  <a><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?p=<xsl:value-of select="$name"/><xsl:if test="ow:diff/@to">&amp;revision=<xsl:value-of select="ow:diff/@to"/></xsl:if></xsl:attribute>hide diff</a>
                  <p></p>
                  <xsl:apply-templates select="ow:diff"/>
              </xsl:otherwise>
          </xsl:choose>
  
          <form name="f" method="get">
          <xsl:attribute name="action"><xsl:value-of select="/ow:wiki/ow:scriptname"/></xsl:attribute>
          <hr size="1" />
          <xsl:apply-templates select="ow:userpreferences/ow:bookmarks"/>
          <br />
          <a><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?p=<xsl:value-of select="$name"/>&amp;a=edit<xsl:if test='ow:page/@revision'>&amp;revision=<xsl:value-of select="ow:page/@revision"/></xsl:if></xsl:attribute>Edit <xsl:if test='ow:page/@revision'>revision <xsl:value-of select="ow:page/@revision"/> of</xsl:if> this page</a>
          <xsl:if test="ow:page/@revision or (ow:page/ow:change and not(ow:page/ow:change/@revision = 1))">
              |
              <a><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?p=<xsl:value-of select="$name"/>&amp;a=changes</xsl:attribute>View other revisions</a>
          </xsl:if>
          <xsl:if test='ow:page/@revision'>
              |
              <a><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?p=<xsl:value-of select="$name"/></xsl:attribute>View current revision</a>
          </xsl:if>
          <br />
          <a><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?p=<xsl:value-of select="$name"/>&amp;a=print&amp;revision=<xsl:value-of select="ow:page/ow:change/@revision"/></xsl:attribute>Print this page</a>
          |
          <a class="same"><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?p=<xsl:value-of select="$name"/>&amp;a=diff&amp;revision=<xsl:value-of select="ow:change/@revision"/>&amp;xml=1</xsl:attribute>View XML</a>
          <br />
          <a><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?p=FindPage&amp;txt=<xsl:value-of select="$name"/></xsl:attribute>Find page</a> by browsing, searching or an index
          <br />
          <xsl:if test="not(ow:page/@changes='0')">
              Edited <xsl:value-of select="string(ow:page/ow:change/ow:date)"/>
              <xsl:text> </xsl:text>
              <a><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?p=<xsl:value-of select="$name"/><xsl:if test="ow:diff/@to">&amp;revision=<xsl:value-of select="ow:diff/@to"/></xsl:if></xsl:attribute>(hide diff)</a>
              <br />
          </xsl:if>
          <input type="hidden" name="a" value="fullsearch"/>
          <input type="text" name="txt" size="30"/> <input type="submit" value="Search"/>
          </form>
          </body>
    </html>
  </xsl:template>
  
  
  
  
  
  <xsl:template match="ow:recentchanges" mode="shortversion">
      <table cellspacing="0" cellpadding="2" border="0">
      <xsl:for-each select="ow:page">
          <tr>
          <xsl:choose>
              <xsl:when test='not(substring-before(./preceding-sibling::*[position()=1]/ow:change/ow:date, "T") = substring-before(ow:change/ow:date, "T"))'>
                  <td width="1%" class="rc" nowrap="nowrap"><xsl:value-of select="ow:formatShortDate(string(ow:change/ow:date))"/></td>
              </xsl:when>
              <xsl:otherwise>
                  <td width="1%" class="rc">&#160;</td>
              </xsl:otherwise>
          </xsl:choose>
          <td class="rc">
          <xsl:value-of select="ow:formatTime(string(ow:change/ow:date))"/>
          -
          <xsl:apply-templates select="ow:link"/>&#160;<xsl:if test="ow:change/@status='new'"><span class="new">new</span></xsl:if><xsl:if test="ow:change/@status='deleted'"><span class="deprecated">deprecated</span></xsl:if>
          </td>
          </tr>
      </xsl:for-each>
      </table>
  </xsl:template>
  
  <xsl:template match="ow:recentchanges">
      <xsl:choose>
          <xsl:when test="@short='true'">
              <xsl:apply-templates select="." mode="shortversion"/>
          </xsl:when>
          <xsl:otherwise>
              <table cellspacing="0" cellpadding="2" width="100%" border="0">
              <xsl:for-each select="ow:page">
                  <xsl:if test='not(substring-before(./preceding-sibling::*[position()=1]/ow:change/ow:date, "T") = substring-before(ow:change/ow:date, "T"))'>
                      <tr class="rc">
                          <td colspan="4">&#160;</td>
                      </tr>
                      <tr class="rc">
                          <td colspan="4"><b><xsl:value-of select="string(ow:change/ow:date)"/></b></td>
                      </tr>
                  </xsl:if>
                  <tr class="rc">
                      <td align="left" width="1%"><xsl:value-of select="ow:formatTime(string(ow:change/ow:date))"/></td>
                      <td align="left" width="25%" nowrap="nowrap"><xsl:if test="@changes > 1">[<a><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?p=<xsl:value-of select="string(@name)"/>&amp;a=diff</xsl:attribute>diff</a>] <xsl:text> </xsl:text> [<xsl:value-of select="@changes"/>&#160;<a><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?p=<xsl:value-of select="string(@name)"/>&amp;a=changes</xsl:attribute>changes</a>]</xsl:if>&#160;</td>
                      <td align="left"><a><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?<xsl:value-of select="string(@name)"/></xsl:attribute><xsl:value-of select="ow:link/text()"/></a>&#160;<xsl:if test="ow:change/@status='new'"><span class="new">new</span></xsl:if><xsl:if test="ow:change/@status='deleted'"><span class="deprecated">deprecated</span></xsl:if></td>
  
                      <xsl:choose>
                        <xsl:when test="ow:change/ow:by/@alias">
                          <td align="left"><a><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?<xsl:value-of select="string(ow:change/ow:by/@alias)"/></xsl:attribute><xsl:value-of select="ow:change/ow:by/text()"/></a></td>
                        </xsl:when>
                        <xsl:otherwise>
                          <td align="left"><xsl:value-of select="ow:change/ow:by/@name"/></td>
                        </xsl:otherwise>
                      </xsl:choose>
  
                  </tr>
                  <xsl:if test="ow:change/ow:comment">
                      <tr class="rc">
                          <td align="left" colspan="2">&#160;</td>
                          <td align="left" colspan="2" class="comment"><xsl:value-of select="ow:change/ow:comment"/></td>
                      </tr>
                  </xsl:if>
  
                  <xsl:for-each select="ow:change/ow:attachmentchange">
                      <tr class="rc">
                          <td colspan="4">
                              <xsl:apply-templates select="."/>
                          </td>
                      </tr>
                  </xsl:for-each>
              </xsl:for-each>
              </table>
          </xsl:otherwise>
      </xsl:choose>
  </xsl:template>
  
  
  <xsl:template match="ow:recentchanges_original">
      <ul>
      <xsl:for-each select="ow:page">
          <xsl:if test='not(substring-before(./preceding-sibling::*[position()=1]/ow:change/ow:date, "T") = substring-before(ow:change/ow:date, "T"))'>
            <xsl:text disable-output-escaping="yes">&lt;/ul&gt;</xsl:text>
              <b><xsl:value-of select="string(ow:change/ow:date)"/></b>
            <xsl:text disable-output-escaping="yes">&lt;ul&gt;</xsl:text>
          </xsl:if>
          <li>
              <xsl:value-of select="ow:formatTime(string(ow:change/ow:date))"/>
              -
              <a><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?<xsl:value-of select="@name"/></xsl:attribute><xsl:value-of select="ow:link/text()"/></a>
              <xsl:if test="ow:change/@status='new'">
                <xsl:text> </xsl:text>
                <span class="new">new</span>
              </xsl:if>
              <xsl:text> </xsl:text>
              <xsl:if test="@changes > 1">
                  (<a><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?p=<xsl:value-of select="@name"/>&amp;a=diff</xsl:attribute>diff</a>)
                  (<xsl:value-of select="@changes"/>&#160;<a><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?p=<xsl:value-of select="@name"/>&amp;a=changes</xsl:attribute>changes</a>)
              </xsl:if>
              <xsl:if test="ow:change/ow:comment">
                  <xsl:text> </xsl:text>
                  <b>[<xsl:value-of select="ow:change/ow:comment"/>]</b>
              </xsl:if>
              . . . . . .
              <xsl:choose>
                <xsl:when test="ow:change/ow:by/@alias">
                  <a><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?<xsl:value-of select="ow:change/ow:by/@alias"/></xsl:attribute><xsl:value-of select="ow:change/ow:by/text()"/></a>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:value-of select="ow:change/ow:by/@name"/>
                </xsl:otherwise>
              </xsl:choose>
          </li>
      </xsl:for-each>
      </ul>
  </xsl:template>
  
  
  <xsl:template match="ow:wiki" mode="changes">
    <xsl:call-template name="pi"/>
    <html>
    <xsl:call-template name="head"/>
      <body bgcolor="#ffffff" onload="window.defaultStatus='{$brandingText}'">
          <h1>History of "<xsl:value-of select="ow:page/ow:link/text()"/>"</h1>
          <xsl:apply-templates select="ow:userpreferences/ow:bookmarks"/>
          <hr size="1" />
          <ul>
          <xsl:for-each select="ow:page/ow:change">
              <li>
                  Revision:
                  <xsl:value-of select="@revision"/>
                  . .
                  <xsl:value-of select="string(ow:date)"/>
                  <xsl:text> </xsl:text>
                  <xsl:value-of select="ow:formatTime(string(ow:date))"/>
                  <xsl:text> </xsl:text>
                  <a><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?p=<xsl:value-of select="$name"/>&amp;revision=<xsl:value-of select="@revision"/></xsl:attribute>View</a>
                  <xsl:if test="position() > 1">
                      (<a><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?p=<xsl:value-of select="$name"/>&amp;a=diff&amp;difffrom=<xsl:value-of select="@revision"/></xsl:attribute>diff</a>)
                  </xsl:if>
                  . . . . . .
                  <xsl:choose>
                    <xsl:when test="ow:by/@alias">
                      <a><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?<xsl:value-of select="string(ow:by/@alias)"/></xsl:attribute><xsl:value-of select="ow:by/text()"/></a>
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:value-of select="ow:by/@name"/>
                    </xsl:otherwise>
                  </xsl:choose>
                  <xsl:if test="ow:comment">
                      <br />
                      <xsl:text> </xsl:text>
                      <span class="comment"><xsl:value-of select="ow:comment"/></span>
                  </xsl:if>
              </li>
          </xsl:for-each>
          </ul>
          <form name="f" method="get">
          <xsl:attribute name="action"><xsl:value-of select="/ow:wiki/ow:scriptname"/></xsl:attribute>
          <hr size="1" />
          <xsl:apply-templates select="ow:userpreferences/ow:bookmarks"/>
          <br />
          <input type="hidden" name="a" value="fullsearch"/>
          <input type="text" name="txt" size="30"><xsl:attribute name="value"><xsl:value-of select="ow:titlesearch/@value"/></xsl:attribute></input> <input type="submit" value="Search"/>
          </form>
        </body>
    </html>
  </xsl:template>
  
  
  <xsl:template match="ow:titleindex">
      <center>
      <xsl:for-each select="ow:page">
          <xsl:if test="not(substring(./preceding-sibling::*[position()=1]/@name, 1, 1) = substring(@name, 1, 1))">
              <a><xsl:attribute name="href">#<xsl:value-of select="substring(@name, 1, 1)"/></xsl:attribute><xsl:value-of select="substring(@name, 1, 1)"/></a>
              <xsl:text> </xsl:text>
          </xsl:if>
      </xsl:for-each>
      </center>
      <xsl:for-each select="ow:page">
          <xsl:if test="not(substring(./preceding-sibling::*[position()=1]/@name, 1, 1) = substring(@name, 1, 1))">
              <br />
              <a><xsl:attribute name="name"><xsl:value-of select="substring(@name, 1, 1)"/></xsl:attribute></a>
              <b><xsl:value-of select="substring(@name, 1, 1)"/></b>
              <br />
          </xsl:if>
          <xsl:apply-templates select="ow:link"/>
          <br />
      </xsl:for-each>
  </xsl:template>
  
  
  <xsl:template match="ow:wordindex">
      <center>
      <xsl:for-each select="ow:word">
          <xsl:if test="not(substring(./preceding-sibling::*[position()=1]/@value, 1, 1) = substring(@value, 1, 1))">
              <a><xsl:attribute name="href">#<xsl:value-of select="substring(@value, 1, 1)"/></xsl:attribute><xsl:value-of select="substring(@value, 1, 1)"/></a>
          </xsl:if>
          <xsl:text> </xsl:text>
      </xsl:for-each>
      </center>
      <xsl:text disable-output-escaping="yes">&lt;ul&gt;</xsl:text>
      <xsl:for-each select="ow:word">
          <xsl:if test="not(substring(./preceding-sibling::*[position()=1]/@value, 1, 1) = substring(@value, 1, 1))">
              <xsl:text disable-output-escaping="yes">&lt;/ul&gt;</xsl:text>
              <a><xsl:attribute name="name"><xsl:value-of select="substring(@value, 1, 1)"/></xsl:attribute></a>
              <b><xsl:value-of select="substring(@value, 1, 1)"/></b>
              <xsl:text disable-output-escaping="yes">&lt;ul&gt;</xsl:text>
          </xsl:if>
          <xsl:if test="not(./preceding-sibling::*[position()=1]/@value = @value)">
              <xsl:text disable-output-escaping="yes">&lt;/ul&gt;</xsl:text>
              <b><xsl:value-of select="@value"/></b>
              <xsl:text disable-output-escaping="yes">&lt;ul&gt;</xsl:text>
          </xsl:if>
          <li><xsl:apply-templates select="ow:page/ow:link"/></li>
      </xsl:for-each>
      <xsl:text disable-output-escaping="yes">&lt;/ul&gt;</xsl:text>
  </xsl:template>
  
  
  <xsl:template match="ow:randompages">
      <xsl:choose>
          <xsl:when test='count(ow:page)=1'>
              <xsl:apply-templates select="ow:page/ow:link"/>
          </xsl:when>
          <xsl:otherwise>
              <ul>
              <xsl:for-each select="ow:page">
                  <li><xsl:apply-templates select="ow:link"/></li>
              </xsl:for-each>
              </ul>
          </xsl:otherwise>
      </xsl:choose>
  </xsl:template>
  
  
  <xsl:template match="ow:titlesearch">
      <ul>
      <xsl:for-each select="ow:page">
        <li>
          <xsl:if test="contains(@name, '/')">
              ....
          </xsl:if>
          <xsl:apply-templates select="ow:link"/>
        </li>
      </xsl:for-each>
      </ul>
  </xsl:template>
  
  
  <xsl:template match="/ow:wiki" mode="titlesearch">
    <xsl:call-template name="pi"/>
    <html>
    <xsl:call-template name="head"/>
      <body bgcolor="#ffffff" onload="window.defaultStatus='{$brandingText}'">
          <xsl:call-template name="brandingImage"/>
          <h1>Title search for "<xsl:value-of select="ow:titlesearch/@value"/>"</h1>
          <xsl:apply-templates select="ow:userpreferences/ow:bookmarks"/>
          <hr size="1" />
          <xsl:apply-templates select="ow:titlesearch"/>
          <xsl:value-of select="count(ow:titlesearch/ow:page)"/> hits out of
          <xsl:value-of select="ow:titlesearch/@pagecount"/> pages searched.
  
          <form name="f" method="get">
          <xsl:attribute name="action"><xsl:value-of select="/ow:wiki/ow:scriptname"/></xsl:attribute>
          <hr size="1" />
          <xsl:apply-templates select="ow:userpreferences/ow:bookmarks"/>
          <br />
          <input type="hidden" name="a" value="fullsearch"/>
          <input type="text" name="txt" size="30"><xsl:attribute name="value"><xsl:value-of select="ow:titlesearch/@value"/></xsl:attribute></input> <input type="submit" value="Search"/>
          </form>
      </body>
    </html>
  </xsl:template>
  
  
  <xsl:template match="ow:fullsearch">
      <ul>
      <xsl:for-each select="ow:page">
        <li>
          <xsl:if test="contains(@name, '/')">
              ....
          </xsl:if>
          <xsl:apply-templates select="ow:link"/>
        </li>
      </xsl:for-each>
      </ul>
  </xsl:template>
  
  
  <xsl:template match="/ow:wiki" mode="fullsearch">
    <xsl:call-template name="pi"/>
    <html>
    <xsl:call-template name="head"/>
      <body bgcolor="#ffffff" onload="window.defaultStatus='{$brandingText}'">
          <xsl:call-template name="brandingImage"/>
          <h1>Full text search for "<xsl:value-of select="ow:fullsearch/@value"/>"</h1>
          <xsl:apply-templates select="ow:userpreferences/ow:bookmarks"/>
          <hr size="1" />
          <xsl:apply-templates select="ow:fullsearch"/>
          <xsl:value-of select="count(ow:fullsearch/ow:page)"/> hits out of
          <xsl:value-of select="ow:fullsearch/@pagecount"/> pages searched.
  
          <form name="f" method="get">
          <xsl:attribute name="action"><xsl:value-of select="/ow:wiki/ow:scriptname"/></xsl:attribute>
          <hr size="1" />
          <xsl:apply-templates select="ow:userpreferences/ow:bookmarks"/>
          <br />
          <input type="hidden" name="a" value="fullsearch"/>
          <input type="text" name="txt" size="30"><xsl:attribute name="value"><xsl:value-of select="ow:fullsearch/@value"/></xsl:attribute></input> <input type="submit" value="Search"/>
          </form>
      </body>
    </html>
  </xsl:template>
  
  
  <xsl:template match="ow:message">
      <xsl:if test="@code='userpreferences_saved'">
        <b>User preferences saved successfully.</b>
      </xsl:if>
      <xsl:if test="@code='userpreferences_cleared'">
        <b>User preferences cleared successfully.</b>
      </xsl:if>
  </xsl:template>
  
  
  <xsl:template match="ow:userpreferences">
      <form name="f" method="post">
        <xsl:attribute name="action"><xsl:value-of select="/ow:wiki/ow:scriptname"/></xsl:attribute>
        <table>
          <tr><td>Username:</td><td><input type="text" name="username" ondblclick="event.cancelBubble=true;"><xsl:attribute name="value"><xsl:value-of select="/ow:wiki/ow:userpreferences/ow:username"/></xsl:attribute></input></td></tr>
          <tr><td>Bookmarks:</td><td><input type="text" name="bookmarks" size="60" ondblclick="event.cancelBubble=true;"><xsl:attribute name="value"><xsl:for-each select="/ow:wiki/ow:userpreferences/ow:bookmarks/ow:link"><xsl:value-of select="@name"/><xsl:text> </xsl:text></xsl:for-each></xsl:attribute></input></td></tr>
          <tr><td colspan="2">Edit form columns: <input type="text" name="cols" size="3" ondblclick="event.cancelBubble=true;"><xsl:attribute name="value"><xsl:value-of select="/ow:wiki/ow:userpreferences/ow:cols"/></xsl:attribute></input> rows: <input type="text" name="rows" size="3" ondblclick="event.cancelBubble=true;"><xsl:attribute name="value"><xsl:value-of select="/ow:wiki/ow:userpreferences/ow:rows"/></xsl:attribute></input></td></tr>
          <tr>
            <td colspan="2">
              <input type="checkbox" name="prettywikilinks" value="1">
                <xsl:if test="/ow:wiki/ow:userpreferences/ow:prettywikilinks"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if>
              </input>
              Show pretty wiki links
            </td>
          </tr>
          <tr>
            <td colspan="2">
              <input type="checkbox" name="bookmarksontop" value="1">
                <xsl:if test="/ow:wiki/ow:userpreferences/ow:bookmarksontop"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if>
              </input>
              Show bookmarks on top
            </td>
          </tr>
          <tr>
            <td colspan="2">
              <input type="checkbox" name="editlinkontop" value="1">
                <xsl:if test="/ow:wiki/ow:userpreferences/ow:editlinkontop"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if>
              </input>
              Show edit link on top
            </td>
          </tr>
          <tr>
            <td colspan="2">
              <input type="checkbox" name="trailontop" value="1">
                <xsl:if test="/ow:wiki/ow:userpreferences/ow:trailontop"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if>
              </input>
              Show trail on top
            </td>
          </tr>
          <tr>
            <td colspan="2">
              <input type="checkbox" name="opennew" value="1">
                <xsl:if test="/ow:wiki/ow:userpreferences/ow:opennew"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if>
              </input>
              Open external links in new window
            </td>
          </tr>
          <tr>
            <td colspan="2">
              <input type="checkbox" name="emoticons" value="1">
                <xsl:if test="/ow:wiki/ow:userpreferences/ow:emoticons"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if>
              </input>
              Show emoticons in text <small>(goto <a href="?HelpOnEmoticons">HelpOnEmoticons</a>)</small>
            </td>
          </tr>
          <tr>
            <td colspan="2">
              <input type="submit" name="save" value="Save Preferences"/>
              &#160;&#160;
              <input type="submit" name="clear" value="Clear Preferences"/>
            </td>
          </tr>
        </table>
        <input type="hidden" name="p"><xsl:attribute name="value"><xsl:value-of select="/ow:wiki/ow:page/@name"/></xsl:attribute></input>
        <input type="hidden" name="a" value="userpreferences"/>
      </form>
  </xsl:template>
  
  
  <xsl:template match="/ow:wiki" mode="login">
    <xsl:call-template name="pi"/>
    <html>
    <xsl:call-template name="head"/>
      <body bgcolor="#ffffff" onload="this.document.f.pwd.focus();">
          <table width="100%" height="100%">
            <tr>
              <td align="center" valign="center">
                  <table border="0" cellspacing="0" cellpadding="70" bgcolor="#eeeeee">
                    <tr><td>
                      <xsl:if test="ow:login/@mode='edit'">
                        <b>Enter password to edit content</b>
                        <br />
                        <br />
                      </xsl:if>
                      <xsl:apply-templates select="ow:error"/>
                      <table>
                      <form name="f" method="post" action="{/ow:wiki/ow:scriptname}?a=login&amp;mode={ow:login/@mode}">
                      <tr><td>password</td><td><input type="password" name="pwd" size="10"/>
                      <xsl:text> </xsl:text>
                      <input type="submit" name="submit" value="let me in!"/>
                      </td></tr>
                      <tr><td>&#160;</td><td>
                      <input type="checkbox" name="r" value="1">
                        <xsl:if test="ow:login/ow:rememberme='false'">
                          <xsl:attribute name="checked">checked</xsl:attribute>
                        </xsl:if>
                      </input>
                      Remember me
                      </td></tr>
                      <input type="hidden" name="backlink">
                        <xsl:attribute name="value"><xsl:value-of select="ow:login/ow:backlink"/></xsl:attribute>
                      </input>
                      </form>
                      </table>
                    </td></tr>
                  </table>
              </td>
            </tr>
          </table>
      </body>
    </html>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  cocoon-2.1/src/blocks/proxy/samples/cocoonhive/ow/xsl/mystyle.xsl
  
  Index: mystyle.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  xmlns:msxsl="urn:schemas-microsoft-com:xslt"
                  xmlns:ow="http://openwiki.com/2001/OW/Wiki"
                  xmlns="http://www.w3.org/1999/xhtml"
                  version="1.0">
  <xsl:output method="xml"/>
  
  <xsl:variable name="brandingText">OpenWiki, the post-it note of the web.</xsl:variable>
  
  <xsl:template name="head">
  	<p>No head today!</p>
  </xsl:template>
  
  <xsl:template name="brandingImage">
      <a href="{/ow:wiki/ow:frontpage/@href}"><img src="{/ow:wiki/ow:imagepath}/logo.gif" align="right" border="0" alt="OpenWiki" /></a>
  </xsl:template>
  
  <xsl:template name="poweredBy">
      <a href="http://openwiki.com"><img src="{/ow:wiki/ow:imagepath}/poweredby.gif" width="88" height="31" border="0" alt="" /></a>
  </xsl:template>
  
  <xsl:template name="validatorButtons">
      <a href="http://validator.w3.org/check/referer"><img src="{/ow:wiki/ow:imagepath}/valid-xhtml10.gif" alt="Valid XHTML 1.0!" width="88" height="31" border="0" /></a>
      <a href="http://jigsaw.w3.org/css-validator/validator?uri={/ow:wiki/ow:location}ow.css"><img src="{/ow:wiki/ow:imagepath}/valid-css.gif" alt="Valid CSS!" width="88" height="31" border="0" /></a>
  </xsl:template>
  
  
  </xsl:stylesheet>
  
  
  1.1                  cocoon-2.1/src/blocks/proxy/samples/cocoonhive/ow/xsl/owinc.xsl
  
  Index: owinc.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  xmlns:msxsl="urn:schemas-microsoft-com:xslt"
                  xmlns:ow="http://openwiki.com/2001/OW/Wiki"
                  extension-element-prefixes="msxsl ow"
                  exclude-result-prefixes=""
                  version="1.0">
  
  <msxsl:script language="JScript" implements-prefix="ow">
      var longMonths = new Array("January", "February", "March", "April", "May", "June",
                                 "July", "August", "September", "October", "November", "December");
      var shortMonths = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun",
                                  "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
  
      function urlencode(pData) {
          return escape(pData);
      }
  
      function formatLongDate(pData) {
          var year  = pData.substring(0, 4);
          var month = pData.substring(5, 7);
          var day   = pData.substring(8, 10);
          if (day.charAt(0) == '0') {
              day = day.charAt(1);
          }
  
          // euro-style:
          // return day + "-" + longMonths[month-1] + "-" + year;
  
          // us-style:
          return longMonths[month-1] + " " + day + ", " + year;
      }
  
      function formatShortDate(pData) {
          var year  = pData.substring(0, 4);
          var month = pData.substring(5, 7);
          var day   = pData.substring(8, 10);
          if (day.charAt(0) == '0') {
              day = day.charAt(1);
          }
  
          // euro-style:
          // return day + "-" + shortMonths[month-1] + "-" + year;
  
          // us-style:
          // return shortMonths[month-1] + " " + day + ", " + year;
          return shortMonths[month-1] + " " + day;
      }
  
      function formatTime(pData) {
          // euro-style
          return pData.substring(11, 16);
  
          // us-style
          // return 3:15 PM
      }
  
      function formatShortDateTime2(pData) {
          var year  = pData.substring(0, 4);
          var month = pData.substring(5, 7);
          var day   = pData.substring(8, 10);
          return formatShortDate(pData) + ", " + year + " " + formatTime(pData);
          //return day + "/" + month + "/" + year + " " + formatTime(pData);
      }
  
  
      function formatLongDateTime(pData) {
          return formatLongDate(pData) + " " + formatTime(pData);
      }
  
      function formatShortDateTime(pData) {
          return formatShortDate(pData) + ", " + formatTime(pData);
      }
  </msxsl:script>
  
  </xsl:stylesheet>
  
  
  1.1                  cocoon-2.1/src/blocks/proxy/samples/cocoonhive/ow/xsl/owattach.xsl
  
  Index: owattach.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  xmlns:msxsl="urn:schemas-microsoft-com:xslt"
                  xmlns:ow="http://openwiki.com/2001/OW/Wiki"
                  xmlns="http://www.w3.org/1999/xhtml"
                  version="1.0">
  <xsl:output method="xml"/>
  
  
  <!-- this shows the table of files -->
  <xsl:template match="ow:attachments">
      <xsl:param name="showhidden"/>
      <xsl:param name="showactions"/>
          <xsl:if test="$showhidden='true' or count(ow:attachment[@hidden='false' and @deprecated='false']) &gt; 0">
          <p />
          <table cellspacing="0" cellpadding="2" border="0" width="100%">
            <tr bgcolor="#eeeeee">
              <td width="1%">&#160;</td>
              <td class="fileattr" width="18%">Filename</td>
              <td class="fileattr" width="5%" align="right">Size&#160;&#160;&#160;</td>
              <td class="fileattr" width="10%">Modified</td>
              <td class="fileattr" width="15%">By</td>
              <td class="fileattr" width="50%">Comment</td>
              <td class="fileattr" width="1%">&#160;</td>
            </tr>
            <xsl:apply-templates select="ow:attachment">
                <xsl:with-param name="showhidden"><xsl:value-of select="$showhidden"/></xsl:with-param>
                <xsl:with-param name="showactions"><xsl:value-of select="$showactions"/></xsl:with-param>
            </xsl:apply-templates>
          </table>
      </xsl:if>
  </xsl:template>
  
  
  <!-- this shows one line in the table of files -->
  <xsl:template match="ow:attachments/ow:attachment">
      <xsl:param name="showhidden"/>
      <xsl:param name="showactions"/>
      <xsl:if test="$showhidden='true' or (@hidden='false' and @deprecated='false')">
          <tr bgcolor="#ffffff" valign="top">
              <td nowrap="nowrap" class="fileattr">
                  <a href="{ow:file/@href}" target="_blank"><img src="{/ow:wiki/ow:location}{/ow:wiki/ow:iconpath}/doc/{ow:file/@icon}.gif" border="0" hspace="2" width="16" height="16" /></a>
              </td>
              <td nowrap="nowrap" class="fileattr">
                  <a href="{ow:file/@href}"><xsl:value-of select="ow:file"/></a> (v<xsl:value-of select="@revision"/>)&#160;
              </td>
              <td nowrap="nowrap" align="right" class="fileattr"><xsl:value-of select="ow:file/@size" /> KB&#160;&#160;&#160;</td>
              <td nowrap="nowrap" class="fileattr"><xsl:value-of select="ow:formatShortDateTime2(string(ow:date))"/>&#160;&#160;</td>
  
              <xsl:choose>
                <xsl:when test="ow:by/@alias">
                  <td align="left" class="fileattr"><a><xsl:attribute name="href"><xsl:value-of select="/ow:wiki/ow:scriptname"/>?<xsl:value-of select="ow:urlencode(string(ow:by/@alias))"/></xsl:attribute><xsl:value-of select="ow:by/text()"/></a></td>
                </xsl:when>
                <xsl:otherwise>
                  <td align="left" class="fileattr"><xsl:value-of select="ow:by/@name"/></td>
                </xsl:otherwise>
              </xsl:choose>
  
              <td class="fileattr"><xsl:if test="@deprecated='true'"><font color="#ff0000"><b>This file will be permanently destroyed.</b></font><xsl:if test="ow:comment"><br /></xsl:if></xsl:if> <xsl:value-of select="ow:comment"/>&#160;</td>
              <td class="fileattr" nowrap="nowrap" align="right">
                  &#160;
                  <xsl:if test="$showactions='true'">
                      <xsl:choose>
                          <xsl:when test="@deprecated='true'">
                              &#160;
                          </xsl:when>
                          <xsl:when test="@hidden='true'">
                              <a href="{/ow:wiki/ow:scriptname}?p={$name}&amp;a=undohidefile&amp;file={ow:file}&amp;rev={@revision}" title="make visible on wikipage"><img src="ow/images/hidden_on.gif" border="0" hspace="2" width="12" height="12" alt="make visible on wikipage" /></a>
                          </xsl:when>
                          <xsl:otherwise>
                              <a href="{/ow:wiki/ow:scriptname}?p={$name}&amp;a=hidefile&amp;file={ow:file}&amp;rev={@revision}" title="hide file from wikipage"><img src="ow/images/hidden_off.gif" border="0" hspace="2" width="12" height="12" alt="hide file from wikipage" /></a>
                          </xsl:otherwise>
                      </xsl:choose>
                      <xsl:choose>
                          <xsl:when test="@deprecated='true'">
                              <a href="{/ow:wiki/ow:scriptname}?p={$name}&amp;a=undotrashfile&amp;file={ow:file}&amp;rev={@revision}" title="restore file"><img src="ow/images/undo.gif" border="0" hspace="2" width="16" height="12" alt="restore" /></a>
                          </xsl:when>
                          <xsl:otherwise>
                              <a href="{/ow:wiki/ow:scriptname}?p={$name}&amp;a=trashfile&amp;file={ow:file}&amp;rev={@revision}" title="trash file"><img src="ow/images/delico.gif" border="0" hspace="4" width="12" height="12" alt="trash" /></a>
                          </xsl:otherwise>
                      </xsl:choose>
                      <a href="{/ow:wiki/ow:scriptname}?p={$name}&amp;a=attachchanges&amp;file={ow:file}" title="view other revisions"><img src="ow/images/revs.gif" border="0" width="12" height="12" alt="view other revisions" /></a>
                  </xsl:if>
              </td>
          </tr>
      </xsl:if>
  </xsl:template>
  
  
  <!-- this will show when you link the attachment in wiki pages -->
  <xsl:template match="ow:attachment">
      <xsl:choose>
          <xsl:when test="ow:file/@image='true'">
              <img src="{ow:file/@href}"><xsl:attribute name="title">Last changed: <xsl:value-of select="ow:formatLongDate(string(ow:date))"/></xsl:attribute></img>
          </xsl:when>
          <xsl:otherwise>
              <!-- <a href="{ow:file/@href}" target="_blank"><img src="{/ow:wiki/ow:location}{/ow:wiki/ow:iconpath}/doc/{ow:file/@icon}.gif" border="0" hspace="2" width="16" height="16" /></a> -->
              <a href="{ow:file/@href}"><xsl:attribute name="title">Last changed: <xsl:value-of select="ow:formatLongDate(string(ow:date))"/></xsl:attribute><xsl:choose><xsl:when test="not(text()='')"><xsl:value-of select="text()"/></xsl:when><xsl:otherwise><xsl:value-of select="ow:file"/></xsl:otherwise></xsl:choose></a>
              <small>&#160;(<xsl:value-of select="ow:file/@size" /> KB)</small>
          </xsl:otherwise>
      </xsl:choose>
  </xsl:template>
  
  
  <!-- this is the line that will appear in the RecentChanges page -->
  <xsl:template match="ow:attachmentchange">
      <div align="right" class="fileattr">
              (<xsl:value-of select="ow:formatTime(string(ow:date))"/>)
              &#160;
              <xsl:value-of select="@name" /> (v<xsl:value-of select="@revision"/>)
              <xsl:value-of select="ow:action"/>
              by
              <xsl:choose>
                <xsl:when test="ow:by/@alias">
                  <a href="{/ow:wiki/ow:scriptname}?{ow:urlencode(string(ow:by/@alias))}"><xsl:value-of select="ow:by/text()"/></a>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:value-of select="ow:by/@name"/>
                </xsl:otherwise>
              </xsl:choose>
      </div>
  </xsl:template>
  
  
  <!-- this shows the page when you click on the "Attachment" link -->
  <xsl:template match="/ow:wiki" mode="attach">
    <xsl:call-template name="pi"/>
    <html>
    <xsl:call-template name="head"/>
      <body bgcolor="#ffffff" onload="window.defaultStatus='{$brandingText}'">
          <xsl:call-template name="brandingImage"/>
          <h1>Attachments for <xsl:value-of select="ow:page/@name"/></h1>
          <xsl:apply-templates select="ow:userpreferences/ow:bookmarks"/>
          <hr size="1" />
  
          <small>
              Back to <a href="{ow:wiki/ow:scriptname}?{$name}"><xsl:value-of select="ow:page/@name" /></a>.
          </small>
  
          <xsl:if test="ow:page/ow:attachments">
              <hr size="1" />
              <xsl:apply-templates select="ow:page/ow:attachments">
                  <xsl:with-param name="showhidden">true</xsl:with-param>
                  <xsl:with-param name="showactions">true</xsl:with-param>
              </xsl:apply-templates>
          </xsl:if>
  
          <hr size="1" />
          To upload a document, enter the full path to a file stored on
          your computer, or select "Browse" or "Choose" to find and select a file.
  
          <form name="fup" method="post" action="{/ow:wiki/ow:scriptname}?p={$name}&amp;a=upload" enctype="multipart/form-data">
            <table cellspacing="0" cellpadding="2" border="0">
              <tr>
                <td>File:</td>
                <td><input type="file" name="file" size="60" /></td>
              </tr>
              <tr>
                <td>Comment:</td>
                <td><input type="text" name="comment" size="60" /></td>
              </tr>
              <tr>
                <td>&#160;</td>
                <td><input type="checkbox" name="link" value="1" />Create a link to the attached file at the end of the WikiPage.</td>
              </tr>
              <tr>
                <td>&#160;</td>
                <td><input type="checkbox" name="hide" value="1" checked="checked" />Hide the attached file in normal view.</td>
              </tr>
              <tr>
                <td>&#160;</td>
                <td>
                  <input type="submit" value="Upload"/>
                  &#160;
                  <input type="button" name="cancel" value="Cancel" onClick="javascript:window.location='{/ow:wiki/ow:scriptname}?p={$name}';" />
                </td>
              </tr>
            </table>
          </form>
          <br />
  
          <form name="f" method="get" action="{/ow:wiki/ow:scriptname}">
              <hr size="1" />
              <xsl:apply-templates select="ow:userpreferences/ow:bookmarks"/>
              <br />
              <input type="hidden" name="a" value="fullsearch"/>
              <input type="text" name="txt" size="30"><xsl:attribute name="value"><xsl:value-of select="ow:fullsearch/@value"/></xsl:attribute></input> <input type="submit" value="Search"/>
          </form>
      </body>
    </html>
  </xsl:template>
  
  
  <!-- this shows the history of changes to a file -->
  <xsl:template match="/ow:wiki" mode="attachchanges">
    <xsl:call-template name="pi"/>
    <html>
    <xsl:call-template name="head"/>
      <body bgcolor="#ffffff" onload="window.defaultStatus='{$brandingText}'">
          <xsl:call-template name="brandingImage"/>
          <h1>History of <xsl:value-of select="ow:page/ow:attachments/ow:attachment/@name"/></h1>
          <xsl:apply-templates select="ow:userpreferences/ow:bookmarks"/>
          <hr size="1" />
  
          <xsl:apply-templates select="ow:page/ow:attachments">
              <xsl:with-param name="showhidden">true</xsl:with-param>
              <xsl:with-param name="showactions">false</xsl:with-param>
          </xsl:apply-templates>
  
          <form name="f" method="get" action="{/ow:wiki/ow:scriptname}">
              <hr size="1" />
              <xsl:apply-templates select="ow:userpreferences/ow:bookmarks"/>
              <br />
              <input type="hidden" name="a" value="fullsearch"/>
              <input type="text" name="txt" size="30"><xsl:attribute name="value"><xsl:value-of select="ow:fullsearch/@value"/></xsl:attribute></input> <input type="submit" value="Search"/>
          </form>
      </body>
    </html>
  </xsl:template>
  
  
  </xsl:stylesheet>
  
  
  1.1                  cocoon-2.1/src/blocks/proxy/samples/cocoonhive/amazon/listMania2xhtml.xsl
  
  Index: listMania2xhtml.xsl
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
  
  <xsl:output  method="xml" version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="no" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"  doctype-system="DTD/xhtml1-strict.dtd"/>
  
    <xsl:template match="/ProductInfo"> 
         <table class="content table">
           <xsl:if test="Details">
             <xsl:call-template name="bookRow">
               <xsl:with-param name="bookDetailsSet" select="Details"/>
             </xsl:call-template>                               
           </xsl:if>
           <xsl:apply-templates select="ErrorMsg"/>
         </table>
    </xsl:template>
  
  
    <!-- render multiple rows, each listing 3 books -->  
    <xsl:template name="bookRow">
      <xsl:param name="bookDetailsSet"/>
      <xsl:if test="$bookDetailsSet">
         <tr>
           <xsl:for-each select="$bookDetailsSet[position() &lt; 4]">
               <xsl:call-template name="bookInfo"/>
           </xsl:for-each>
         </tr>
         <xsl:call-template name="bookRow">
           <xsl:with-param name="bookDetailsSet" select="$bookDetailsSet[position() &gt; 3]"/>
         </xsl:call-template>
       </xsl:if>
    </xsl:template>
  
  
  
    <xsl:template name="bookInfo">
       <td>
         <xsl:element name="a">
           <xsl:attribute name="href">page-amazon-bookInfo?AsinSearch=<xsl:value-of select="Asin"/></xsl:attribute>
           <xsl:element name="img">
             <xsl:attribute name="src"><xsl:value-of   select="ImageUrlSmall"/></xsl:attribute>
             <xsl:attribute name="alt">cover art</xsl:attribute>
           </xsl:element>
         </xsl:element>
        </td>
        <TD>
         <xsl:element name="a">
           <xsl:attribute name="href">page-amazon-bookInfo?AsinSearch=<xsl:value-of select="Asin"/></xsl:attribute>
            <FONT face="Arial" size="-2" color="3366FF">
              <xsl:value-of select="ProductName"/>
            </FONT>
            <br/>
         </xsl:element>
          <FONT face="Arial" size="-2" color="000000">
            <xsl:value-of select="Manufacturer"/>
          </FONT>
          <br/>
          <font face="Arial" size="-2">
            <font color="990000">New <xsl:value-of select="OurPrice"/></font>
          </font>
        </TD>
    
    </xsl:template>
  
    <xsl:template match="ErrorMsg">
      <div title="Error Message">
      <xsl:value-of select="."/>
      </div>
    </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  
  1.1                  cocoon-2.1/src/blocks/proxy/samples/cocoonhive/amazon/bookInfo2page.xsl
  
  Index: bookInfo2page.xsl
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:ch="http://cocoonhive.org/portal/schema/2002"
    >
  	<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
  	
  	<xsl:template match="ch:menu">
  	  <xsl:copy>
            <ch:item>
              <ch:label>Book List</ch:label>
              <ch:command>page-amazon-listMania</ch:command>
            </ch:item>
  	    <xsl:apply-templates select="./*"/>
  	  </xsl:copy>
  	</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/proxy/samples/cocoonhive/amazon/bookInfo2xhtml.xsl
  
  Index: bookInfo2xhtml.xsl
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <xsl:stylesheet 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    version="1.0">
  
    <xsl:output method="xml" version="1.0" 
    	encoding="UTF-8" indent="yes" 
    	omit-xml-declaration="no" 
    	doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"  
    	doctype-system="DTD/xhtml1-strict.dtd"/>
    	
    <xsl:template match="/">
          <xsl:apply-templates select="ProductInfo/Details"/>
    </xsl:template>
    
    <xsl:template match="Details">
      <table border="0" width="100%" cellpadding="5">
        <tr>
          <td rowspan="4">
            <img src="{ImageUrlMedium}"/>
          </td>
          <td>
            <b><u><font size="+1"><xsl:value-of select="ProductName"/></font></u></b>
          </td>
        </tr>
        <tr>
          <td>
            <b>
              <xsl:text>Published: </xsl:text>
            </b>
            <xsl:value-of select="ReleaseDate"/>
          </td>
        </tr>
        <tr>
          <td>
            <xsl:call-template name="OurPrice">
              <xsl:with-param name="OurPrice" 
                select="substring(OurPrice, 2)"/>
              <xsl:with-param name="ListPrice" 
                select="substring(ListPrice, 2)"/>
            </xsl:call-template>
            <xsl:apply-templates select="UsedPrice | CollectiblePrice | ThirdPartyNewPrice"/> 
            <xsl:apply-templates select="SalesRank"/>
          </td>
        </tr>
        <tr>
          <td>
            <xsl:apply-templates select="Authors"/>
          </td>
        </tr>
        <tr>
          <td>
            <xsl:call-template name="BuyButton">
              <xsl:with-param name="Asin" 
                select="Asin"/>
            </xsl:call-template>
          </td>
        </tr>
        <xsl:apply-templates select="Reviews/AvgCustomerRating"/>
        <xsl:apply-templates select="Reviews/CustomerReview">
          <xsl:sort select="Rating"/>
        </xsl:apply-templates>
      </table>
      <hr/>
    </xsl:template>
  
    <xsl:template name="OurPrice">
      <xsl:param name="OurPrice"  select="'1.00'"/>
      <xsl:param name="ListPrice" select="'1.00'"/>
      <xsl:param name="UsedPrice"/>
      <xsl:param name="CollectiblePrice"/>
      <xsl:param name="ThirdPartyNewPrice"/>
  
      <xsl:choose>
        <xsl:when test="$OurPrice = $ListPrice">
          <b>Our price: </b><xsl:text>$</xsl:text>
          <xsl:value-of select="$OurPrice"/>
        </xsl:when>
        <xsl:otherwise>
          <b>Our price: </b><xsl:text>$</xsl:text>
          <xsl:value-of select="$OurPrice"/>
          <br />
          <b>List price: </b><xsl:text>$</xsl:text>
          <xsl:value-of select="$ListPrice"/>
          <xsl:text> (</xsl:text>
          <i>that's </i>
          <b>
            <xsl:value-of select="100 - round(($OurPrice div $ListPrice) * 100)"/>
            <xsl:text>%</xsl:text>
          </b>
          <i> off!</i>
          <xsl:text>)</xsl:text>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:template>
  
    <xsl:template match="SalesRank">
      <br />
      <b>
        <xsl:text>Sales rank: </xsl:text>
        <xsl:value-of select="."/>
      </b>
    </xsl:template>
  
    <xsl:template match="UsedPrice">
      <br />
      <b>Used price: </b>
      <xsl:value-of select="."/>
    </xsl:template>
  
    <xsl:template match="CollectiblePrice">
      <br />
      <b>Collectible price: </b>
      <xsl:value-of select="."/>
    </xsl:template>
  
    <xsl:template match="ThirdPartyNewPrice">
      <br />
      <b>Buy one from zShops for: </b>
      <xsl:value-of select="."/>
    </xsl:template>
  
    <xsl:template match="Authors">
      <xsl:choose>
        <xsl:when test="count(Author)&gt; 2">
          <b>Authors: </b>
          <xsl:for-each select="Author">
            <xsl:choose>
              <xsl:when test="not(position() = last())">
                <xsl:value-of select="."/>
                <xsl:text>, </xsl:text>
              </xsl:when>
              <xsl:otherwise>
                <xsl:text>and </xsl:text>
                <xsl:value-of select="."/>
              </xsl:otherwise>
            </xsl:choose>
          </xsl:for-each>
        </xsl:when>
        <xsl:when test="count(Author) = 2">
          <b>Authors: </b>
          <xsl:value-of select="Author[1]"/>
          <xsl:text> and </xsl:text>
          <xsl:value-of select="Author[2]"/>
        </xsl:when>
        <xsl:otherwise>
          <b>Author: </b>
          <xsl:value-of select="Author"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:template>
  
    <xsl:template name="BuyButton">
      <xsl:param name="Asin"/>
      <xsl:element name="a">
        <xsl:attribute name="href" xml:space="default">http://www.amazon.com/o/dt/assoc/handle-buy-box?asin=<xsl:value-of select="$Asin"/>&amp;tag_value=associates_tag&amp;dev-tag-value=D24H52G74BUDRY&amp;submit.add-to-cart=true</xsl:attribute>
        <xsl:attribute name="target" xml:space="default">_blank</xsl:attribute>
        <xsl:text>Buy from Amazon.com</xsl:text>
      </xsl:element>
    </xsl:template>
  
    <xsl:template match="AvgCustomerRating">
      <tr>
        <td colspan="2">
          <b>Average customer rating: </b>
          <xsl:call-template name="Stars">
            <xsl:with-param name="average" select="."/>
          </xsl:call-template>
        </td>
      </tr>
    </xsl:template>
  
    <xsl:template match="CustomerReview">
      <tr>
        <td colspan="2">
          <xsl:call-template name="Stars">
            <xsl:with-param name="average" select="Rating"/>
          </xsl:call-template>
          <xsl:text> </xsl:text>
          <b><xsl:value-of select="Summary"/></b>
          <br />
          <p><xsl:value-of select="Comment"/></p>
        </td>
      </tr>
    </xsl:template>
  
    <xsl:template name="Stars">
      <xsl:param name="average" select="5"/>
      <xsl:choose>
        <xsl:when test="$average &gt; 4.75">
          <img src="http://g-images.amazon.com/images/G/01/detail/stars-5-0.gif"/>
        </xsl:when>
        <xsl:when test="$average &gt; 4.25">
          <img src="http://g-images.amazon.com/images/G/01/detail/stars-4-5.gif"/>
        </xsl:when>
        <xsl:when test="$average &gt; 3.75">
          <img src="http://g-images.amazon.com/images/G/01/detail/stars-4-0.gif"/>
        </xsl:when>
        <xsl:when test="$average &gt; 3.25">
          <img src="http://g-images.amazon.com/images/G/01/detail/stars-3-5.gif"/>
        </xsl:when>
        <xsl:when test="$average &gt; 2.75">
          <img src="http://g-images.amazon.com/images/G/01/detail/stars-3-0.gif"/>
        </xsl:when>
        <xsl:when test="$average &gt; 2.25">
          <img src="http://g-images.amazon.com/images/G/01/detail/stars-2-5.gif"/>
        </xsl:when>
        <xsl:when test="$average &gt; 1.75">
          <img src="http://g-images.amazon.com/images/G/01/detail/stars-2-0.gif"/>
        </xsl:when>
        <xsl:when test="$average &gt; 1.25">
          <img src="http://g-images.amazon.com/images/G/01/detail/stars-1-5.gif"/>
        </xsl:when>
        <xsl:when test="$average &gt; .75">
          <img src="http://g-images.amazon.com/images/G/01/detail/stars-1-0.gif"/>
        </xsl:when>
        <xsl:when test="$average &gt; .25">
          <img src="http://g-images.amazon.com/images/G/01/detail/stars-0-5.gif"/>
        </xsl:when>
        <xsl:otherwise>
          <img src="http://g-images.amazon.com/images/G/01/detail/stars-0-0.gif"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  cocoon-2.1/src/blocks/proxy/java/org/apache/cocoon/generation/WebServiceProxyGenerator.java
  
  Index: WebServiceProxyGenerator.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.generation;
  
  import org.apache.avalon.framework.component.Component;
  import org.apache.avalon.framework.component.ComponentException;
  import org.apache.avalon.framework.parameters.Parameters;
  import org.apache.cocoon.ProcessingException;
  import org.apache.cocoon.components.source.SourceUtil;
  import org.apache.cocoon.environment.ObjectModelHelper;
  import org.apache.cocoon.environment.Request;
  import org.apache.cocoon.environment.Session;
  import org.apache.cocoon.environment.SourceResolver;
  import org.apache.commons.httpclient.HostConfiguration;
  import org.apache.commons.httpclient.HttpClient;
  import org.apache.commons.httpclient.HttpMethod;
  import org.apache.commons.httpclient.NameValuePair;
  import org.apache.commons.httpclient.URI;
  import org.apache.commons.httpclient.URIException;
  import org.apache.commons.httpclient.methods.GetMethod;
  import org.apache.commons.httpclient.methods.PostMethod;
  import org.apache.excalibur.source.Source;
  import org.apache.excalibur.source.SourceException;
  import org.apache.excalibur.xml.sax.SAXParser;
  import org.xml.sax.InputSource;
  import org.xml.sax.SAXException;
  
  import java.io.ByteArrayInputStream;
  import java.io.IOException;
  import java.util.ArrayList;
  import java.util.Enumeration;
  import java.util.Map;
  
  /**
   *
   *  The WebServiceProxyGenerator is intended to:
   *
   * 1) Allow easy syndication of dynamic interactive content as a natural extension of the currently popular static content syndication with RSS.
   *
   * 2) Allow transparent routing of web service request through GET, POST, SOAP-RPC and SOAP-DOC binding methods.
   *
   * 3) Allow almost full control through sitemap configuration.
   *
   * 4) Allow use of Cocoon components for content formatting, aggregation and styling through a tight integration with the Cocoon sitemap.
   *
   * 5) Require 0 (zero) lines of Java or other business logic code in most cases.
   *
   * 6) Be generic and flexible enough to allow custom extensions for advanced and non-typical uses.
   *
   * 7) Support sessions, authentication, http 1.1, https,  request manipulation, redirects following, connection pooling, and others.
   *
   * 8) Use the Jakarta HttpClient library which provides many sophisticated features for HTTP connections.
   *
   * 9) (TBD) Use Axis for SOAP-RPC and SOAP-DOC bindings.
   *
   *
   * @author <a href="mailto:ivelin@apache.org">Ivelin Ivanov</a>, June 30, 2002
   * @author <a href="mailto:tc@hist.umn.edu">Tony Collen</a>, December 2, 2002
   * @version CVS $Id: WebServiceProxyGenerator.java,v 1.1 2003/07/05 14:46:13 joerg Exp $
   */
  public class WebServiceProxyGenerator extends ComposerGenerator {
  
      private static final String HTTP_CLIENT = "HTTP_CLIENT";
      private static final String METHOD_GET = "GET";
      private static final String METHOD_POST = "POST";
  
      private HttpClient httpClient = null;
      private String configuredHttpMethod = null;
  
      public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par) throws ProcessingException, SAXException, IOException {
          super.setup(resolver, objectModel, src, par);
  
          try {
              Source inputSource = resolver.resolveURI(super.source);
              this.source = inputSource.getURI();
          } catch (SourceException se) {
              throw SourceUtil.handle("Unable to resolve " + super.source, se);
          }
  
          this.configuredHttpMethod = par.getParameter("wsproxy-method", METHOD_GET);
          this.httpClient = this.getHttpClient();
      }
  
      /**
       * Generate XML data.
       */
      public void generate() throws IOException, SAXException, ProcessingException {
          SAXParser parser = null;
          try {
              if (this.getLogger().isDebugEnabled()) {
                  this.getLogger().debug("processing Web Service request: " + this.source);
              }
  
              // forward request and bring response back
              byte[] response = this.fetch();
              if (this.getLogger().isDebugEnabled()) {
                  this.getLogger().debug("response: " + new String(response));
              }
  
              /* TODO: Though I avoided the getResponseBodyAsString(), the content
               *       seems not to be parsed correctly. Who cares about the encoding
               *       in the XML declaration?
               * {@link http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/HttpMethodBase.html#getResponseBodyAsString()}
               */
              ByteArrayInputStream responseStream = new ByteArrayInputStream(response);
              InputSource inputSource = new InputSource(responseStream);
              parser = (SAXParser)this.manager.lookup(SAXParser.ROLE);
              parser.parse(inputSource, super.xmlConsumer);
  
          } catch (ComponentException ex) {
              throw new ProcessingException("WebServiceProxyGenerator.generate() error", ex);
          } finally {
              this.manager.release((Component)parser);
          }
  
      } // generate
  
      /**
       * Recycle this component.
       * All instance variables are set to <code>null</code>.
       */
      public void recycle() {
          this.httpClient = null;
          this.configuredHttpMethod = null;
          super.recycle();
      }
  
      /**
       * Forwards the request and returns the response.
       * 
       * The rest is probably out of date:
       * Will use a UrlGetMethod to benefit the cacheing mechanism
       * and intermediate proxy servers.
       * It is potentially possible that the size of the request
       * may grow beyond a certain limit for GET and it will require POST instead.
       *
       * @return byte[] XML response
       */
      public byte[] fetch() throws ProcessingException {
          HttpMethod method = null;
  
          // check which method (GET or POST) to use.
          if (this.configuredHttpMethod.equalsIgnoreCase(METHOD_POST)) {
              method = new PostMethod(this.source);
          } else {
              method = new GetMethod(this.source);
          }
  
          if (this.getLogger().isDebugEnabled()) {
              this.getLogger().debug("request HTTP method: " + method.getName());
          }
  
          // this should probably be exposed as a sitemap option
          method.setFollowRedirects(true);
  
          // copy request parameters and merge with URL parameters
          Request request = ObjectModelHelper.getRequest(objectModel);
  
          ArrayList paramList = new ArrayList();
          Enumeration enum = request.getParameterNames();
          while (enum.hasMoreElements()) {
              String pname = (String)enum.nextElement();
              String[] paramsForName = request.getParameterValues(pname);
              for (int i = 0; i < paramsForName.length; i++) {
                  NameValuePair pair = new NameValuePair(pname, paramsForName[i]);
                  paramList.add(pair);
              }
          }
  
          if (paramList.size() > 0) {
              NameValuePair[] allSubmitParams = new NameValuePair[paramList.size()];
              paramList.toArray(allSubmitParams);
  
              String urlQryString = method.getQueryString();
  
              // use HttpClient encoding routines
              method.setQueryString(allSubmitParams);
              String submitQryString = method.getQueryString();
  
              // set final web service query string
              method.setQueryString(urlQryString + "&" + submitQryString);
          } // if there are submit parameters
  
          byte[] response = null;
          try {
              int httpStatus = httpClient.executeMethod(method);
              if (httpStatus < 400) {
                  if (this.getLogger().isDebugEnabled()) {
                      this.getLogger().debug("Return code when accessing the remote Url: " + httpStatus);
                  }
              } else {
                  throw new ProcessingException("The remote returned error " + httpStatus + " when attempting to access remote URL:" + method.getURI());
              }
          } catch (URIException e) {
              throw new ProcessingException("There is a problem with the URI: " + this.source, e);
          } catch (IOException e) {
              try {
                  throw new ProcessingException("Exception when attempting to access the remote URL: " + method.getURI(), e);
              } catch (URIException ue) {
                  throw new ProcessingException("There is a problem with the URI: " + this.source, ue);
              }
          } finally {
              /* It is important to always read the entire response and release the
               * connection regardless of whether the server returned an error or not.
               * {@link http://jakarta.apache.org/commons/httpclient/tutorial.html}
               */
              response = method.getResponseBody();
              method.releaseConnection();
          }
  
          return response;
      } // fetch
  
      /**
       * Create one per client session. 
       */
      protected HttpClient getHttpClient() throws ProcessingException {
          Request request = ObjectModelHelper.getRequest(objectModel);
          Session session = request.getSession(true);
          HttpClient httpClient = null;
          if (session != null) {
              httpClient = (HttpClient)session.getAttribute(HTTP_CLIENT);
          }
          if (httpClient == null) {
              httpClient = new HttpClient();
              HostConfiguration config = httpClient.getHostConfiguration();
              if (config == null) {
                  config = new HostConfiguration();
              }
              
              try {
                  config.setHost(new URI(this.source));
              } catch (URIException ex) {
                  throw new ProcessingException("URI format error: " + ex, ex);
              }
  
              if (System.getProperty("http.proxyHost") != null) {
                  String proxyHost = System.getProperty("http.proxyHost");
                  int proxyPort = Integer.parseInt(System.getProperty("http.proxyPort"));
                  config.setProxy(proxyHost, proxyPort);
              }
  
              httpClient.setHostConfiguration(config);
  
              session.setAttribute(HTTP_CLIENT, httpClient);
          }
          return httpClient;
      }
  
  
  } // class
  
  
  
  1.1                  cocoon-2.1/src/blocks/proxy/conf/wsproxy.xmap
  
  Index: wsproxy.xmap
  ===================================================================
  <?xml version="1.0"?>
  <xmap xpath="/sitemap/components/generators" unless="generator[@name='wsproxy']">
    <map:generator
    	label="content,data"
    	logger="sitemap.generator.wsproxy"
    	name="wsproxy"
    	src="org.apache.cocoon.generation.WebServiceProxyGenerator"/>
  </xmap>
  
  
  
  1.1                  cocoon-2.1/src/blocks/proxy/conf/proxy.xsamples
  
  Index: proxy.xsamples
  ===================================================================
  <?xml version="1.0"?>
  <xsamples xpath="/samples" unless="group[@name='Proxy']">
    <group name="Proxy">
      <sample name="Proxy" href="proxy/">
  	  Web Site Syndication using proxies: Integrate remote webapp functionality
  	  into your website.
     </sample>
    </group>
  </xsamples>
  
  
  
  
  1.1                  cocoon-2.1/src/blocks/proxy/samples/cocoonhive/stylesheets/page2html.xsl
  
  Index: page2html.xsl
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:ch="http://cocoonhive.org/portal/schema/2002"
    >
  	<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
  	
  	<xsl:template match="ch:page">
    	   <html>
            <head>
              <title>CocoonHive.org Portal</title>
              <link type="text/css" href="stylesheets/page.css" rel="stylesheet"/>
            </head>
            <body>
              <a href="http://www.cocoonhive.org">CocoonHive</a> Portal
              
              <a href="http://cvs.apache.org/viewcvs.cgi/cocoon-2.1/src/webapp/samples/webserviceproxy/">View source (CVS)</a>
              <br/>
              <xsl:apply-templates/>
            </body>
          </html>
  	</xsl:template>
  	
  	
  	<xsl:template match="ch:menu">
          <div class="frame warning">
            <div class="label">Menu</div>
              <div class="warning">
                <xsl:apply-templates/>
              </div>
            </div>
          <br/>
  	</xsl:template>
  	
  	<xsl:template match="ch:item">
              <xsl:element name="a">
                <xsl:attribute name="href"><xsl:value-of select="ch:command"/></xsl:attribute>
                <xsl:value-of select="ch:label"/>
              </xsl:element>
              <xsl:text> </xsl:text>
  	</xsl:template>
  	
  	<xsl:template match="ch:frame">
          <div class="frame note">
          <div class="label"><xsl:value-of select="ch:title"/></div>
          <div class="note ">
          	  <xsl:copy-of select="ch:content/*"/>
          </div>
          </div>
  	</xsl:template>
  
  	<xsl:template match="*"/>
  
  </xsl:stylesheet>
  
  
  
  1.1                  cocoon-2.1/src/blocks/proxy/samples/cocoonhive/stylesheets/service2page.xsl
  
  Index: service2page.xsl
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:ch="http://cocoonhive.org/portal/schema/2002"
    >
  	<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
  	
  	<xsl:param name="title"/>
  	
  	<xsl:template match="/">
  
            <ch:page xmlns:ch="http://cocoonhive.org/portal/schema/2002">
              <ch:menu>
                <ch:item>
                  <ch:label>Home</ch:label>
                  <ch:command>home</ch:command>
                </ch:item>
              </ch:menu>
  
              <ch:frame>
                <ch:title><xsl:value-of select="$title"/></ch:title>
                <ch:content>
                  <xsl:copy-of select="."/>
                </ch:content>      
              </ch:frame>
            
            </ch:page>
  	</xsl:template>
  
  	<xsl:template match="*"/>
  	
  </xsl:stylesheet>
  
  
  
  1.1                  cocoon-2.1/src/blocks/proxy/samples/cocoonhive/stylesheets/page.css
  
  Index: page.css
  ===================================================================
  body {  background-color: #FFFFFF; margin: 0px 0px 0px 0px; font-family: Arial, Helvetica, sans-serif;  font-size : 14px;  }
  
  a:link { color: #0F3660; }
  a:visited { color: #009999; }
  a:active { color: #000066; }
  a:hover { color: #000066; }
  
  .menu { background-color: #4C6C8F; margin: 0px; padding: 3px 8px 5px 3px;  font-size : 14px;  }
  .menu a:link { color: #FFFFFF;  text-decoration : none;  }
  .menu a:visited { color: #FFFFFF; text-decoration : none; }
  /*.menu a:active { font-weight: bold }*/
  .menu a:hover { color: #FFCC00; text-decoration : none; }
  .menu ul { margin: 0px 0px 0px 20px; padding: 0px; }
  .menu li  { list-style-image: url('images/label.gif'); }
  .menu ul ul li .sel { list-style-image: url('images/current.gif'); }
  .menu ul ul li  { list-style-image: url('images/page.gif'); }
  
  .content { padding: 5px 5px 5px 10px;  font : small;  font-size : 14px;   }
  .content table { width: 100%; background-color: #7099C5; color: #ffffff;  font-size : 14px;}
  .content table .caption { text-align: left; color: black; font-size : 14px; }
  .content table .th { text-align: center;  font-size : 14px;}
  .content td { background-color: #f0f0ff; color: black;  font-size : 14px;}
  
  .frame { margin: 5px 20px 5px 20px; font-size: 14px; }
  .frame .content { margin: 0px; }
  
  .note { border: solid 1px #7099C5; background-color: #f0f0ff; }
  .note .label { background-color: #7099C5; color: #ffffff; }
  
  .warning { border: solid 1px #D00000; background-color: #fff0f0; }
  .warning .label { background-color: #D00000; color: #ffffff; }
  
  .fixme { border: solid 1px #C6C600; background-color: #FAF9C3; }
  .fixme .label { background-color: #C6C600; color: #ffffff; }
  
  .code { border-color: #CFDCED; border-style: solid; border-width: 1px; }
  
  .highlight { background-color: yellow; }
  
  .minitoc {margin: 5px 5px 5px 40px;}
  
  
  
  1.1                  cocoon-2.1/src/blocks/proxy/samples/cocoonhive/portal/home.xml
  
  Index: home.xml
  ===================================================================
  <ch:page xmlns:ch="http://cocoonhive.org/portal/schema/2002" xmlns:cinclude="http://apache.org/cocoon/include/1.0">
    <ch:frame>
      <ch:title>Amazon.com</ch:title>
      <ch:content>
        <cinclude:include src="cocoon:/frame-amazon"/>
      </ch:content>
    </ch:frame>
    <ch:frame>
      <ch:title>OpenWiki</ch:title>
      <ch:content>
        <cinclude:include src="cocoon:/frame-openWiki?p=OpenWiki"/>
      </ch:content>
    </ch:frame>
  </ch:page>
  
  
  
  1.1                  cocoon-2.1/src/blocks/proxy/samples/cocoonhive/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  <?xml version="1.0"?>
  <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
    <!-- =========================== Resources ================================= -->
    <map:resources>
      <map:resource name="home">
        <!-- Load the home page frame -->
        <map:generate src="portal/home.xml" label="xml"/>
        <!-- Resolve CInclude references to remote services -->
        <map:transform type="cinclude"/>
        <!-- Dress up the content in a customized skin -->
        <map:transform src="stylesheets/page2html.xsl"/>
        <map:serialize type="html"/>
      </map:resource>
    </map:resources>
    <!-- =========================== Pipelines ================================= -->
    <map:pipelines>
      <map:pipeline>
        <!-- Portal content is not likely to expire within an hour -->
        <!-- This greatly improves user experience -->
        <map:parameter name="expires" value="access plus 1 hours"/>
  
        <!-- Portal Syndication - Home -->
        <map:match pattern="">
          <map:call resource="home"/>
        </map:match>
        <!-- Commands section -->
        <map:match pattern="home">
          <map:call resource="home"/>
        </map:match>
  
        <!-- Amazon.com section -->
        <map:match pattern="frame-amazon">
          <map:generate src="cocoon:/amazon-listMania-resource"/>
          <map:serialize type="xml"/>
        </map:match>
        <map:match pattern="page-amazon-listMania*">
          <map:generate src="cocoon:/amazon-listMania-resource"/>
          <map:transform src="stylesheets/service2page.xsl">
  		  <map:parameter name="title" value="Amazon List Mania"/>
  	    </map:transform>
          <map:transform src="stylesheets/page2html.xsl"/>
          <map:serialize type="html"/>
        </map:match>
        <map:match pattern="page-amazon-bookInfo*">
          <map:generate src="cocoon:/amazon-bookInfo-resource"/>
          <map:transform src="stylesheets/service2page.xsl">
  		  <map:parameter name="title" value="Amazon Book Details"/>
    	    </map:transform>
          <map:transform src="amazon/bookInfo2page.xsl"/>
          <map:transform src="stylesheets/page2html.xsl"/>
          <map:serialize type="html"/>
        </map:match>
  
        <!-- OpenWiki.com section -->
        <map:match pattern="frame-openWiki">
          <map:generate src="cocoon:/openWiki-resource"/>
          <map:serialize type="xml"/>
        </map:match>
        <map:match pattern="ow.asp*">
          <map:generate src="cocoon:/openWiki-resource"/>
          <map:transform src="stylesheets/service2page.xsl">
  		  <map:parameter name="title" value="OpenWiki"/>
   	    </map:transform>
          <map:transform src="stylesheets/page2html.xsl"/>
          <map:serialize type="html"/>
        </map:match>
        <map:match pattern="openWiki">
          <map:generate src="cocoon:/openWiki-resource"/>
          <map:serialize type="xhtml"/>
        </map:match>
        
      </map:pipeline>
  
  
      <!-- Internal resources (@todo should be moved in a resource section?) -->
      <map:pipeline>
       
  	  <map:match pattern="amazon-listMania-resource">
  		<map:generate type="wsproxy" src="http://xml.amazon.com/onca/xml?v=1.0&amp;t=webservices-20&amp;dev-t=D2GNXHNXXYM094&amp;ListManiaSearch=1AU8KSU46JLPD&amp;type=lite&amp;f=xml" label="xml"/>
  		<map:transform src="amazon/listMania2xhtml.xsl"/>
  		<map:serialize type="xhtml"/>
  	  </map:match>
  	  <map:match pattern="amazon-bookInfo-resource">
  		<map:generate type="wsproxy" src="http://xml.amazon.com/onca/xml?v=1.0&amp;t=webservices-20&amp;dev-t=D2GNXHNXXYM094&amp;type=heavy&amp;f=xml" label="xml"/>
  		<map:transform src="amazon/bookInfo2xhtml.xsl"/>
  		<map:serialize type="xhtml"/>
  	  </map:match>
  
  	  <map:match pattern="openWiki-resource">
  		<map:generate type="wsproxy" src="http://www.openwiki.com/ow.asp?xml=1" label="xml"/>
  		<map:transform type="xalan" src="ow/xsl/ow.xsl"/>
  		<map:serialize type="xml"/>
  	  </map:match>
  
      </map:pipeline>
  
      <map:pipeline>
        <map:parameter name="expires" value="access plus 1 hours"/>
  
        <!-- Static files section -->
        <map:match pattern="stylesheets/*">
          <map:read src="stylesheets/{1}"/>
        </map:match>
        <map:match pattern="ow/**">
          <map:read src="http://www.openwiki.com/ow/{1}"/>
        </map:match>
      </map:pipeline>
    </map:pipelines>
  </map:sitemap>
  <!-- end of file -->
  
  
  
  1.20      +1 -22     cocoon-2.1/src/webapp/samples/samples.xml
  
  Index: samples.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/webapp/samples/samples.xml,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- samples.xml	27 Jun 2003 20:10:43 -0000	1.19
  +++ samples.xml	5 Jul 2003 14:46:14 -0000	1.20
  @@ -52,27 +52,6 @@
      </sample>
     </group>
     
  -<!-- 
  - 
  -  FIXME (SM) this should move into the proxy block 
  -  
  -  <group name="Web Site Syndication">
  -    <sample name="Examples" href="webserviceproxy/">
  -    Demonstrates how to embed One Web Site functionality
  -    in Another. Using the WebServiceProxyGenerator remote web app
  -    integration is easy.
  -    </sample>
  -    <sample name="Virtual Portal Demo" href="webserviceproxy/cocoonhive/">
  -    A more sophisticated example including Amazon and OpenWiki. 
  -    Shows how a personalized
  -    portal can be built by connecting multiple remote
  -    services without writing a single line of business logic code.
  -    Only styling is used in addition to the proxy.
  -   </sample>
  -  </group> 
  -  
  --->
  -   
     <group name="The Power of Sitemap">
      <sample name="Input Modules" href="modules/">
       This example shows the usage of Input Modules in sitemap attribute expressions.
  
  
  
  1.26      +1 -2      cocoon-2.1/src/webapp/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/webapp/sitemap.xmap,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- sitemap.xmap	3 Jul 2003 23:43:58 -0000	1.25
  +++ sitemap.xmap	5 Jul 2003 14:46:14 -0000	1.26
  @@ -60,7 +60,6 @@
       <map:generator label="data" logger="sitemap.generator.request" name="request" pool-grow="2" pool-max="16" pool-min="2" src="org.apache.cocoon.generation.RequestGenerator"/>
       <map:generator label="content,data" logger="sitemap.generator.stream" name="stream" pool-grow="2" pool-max="16" pool-min="1" src="org.apache.cocoon.generation.StreamGenerator"/>
       <map:generator label="data" logger="sitemap.generator.status" name="status" pool-grow="2" pool-max="16" pool-min="2" src="org.apache.cocoon.generation.StatusGenerator"/>
  -    <map:generator label="data" logger="sitemap.generator.proxy" name="proxy" pool-grow="2" pool-max="16" pool-min="2" src="org.apache.cocoon.generation.WebServiceProxyGenerator"/>    
       <!-- The notifying generator can only be used in a <handle-errors> section : it produces an XML
            representation of the exception that caused the error handler to be executed -->
       <map:generator name="notifying" src="org.apache.cocoon.sitemap.NotifyingGenerator"/>
  
  
  
  1.1                  cocoon-2.1/src/blocks/proxy/samples/stylesheets/newWizard2html.xsl
  
  Index: newWizard2html.xsl
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!--
  	Cocoon WebServiceProxyGenerator 
      Feedback Wizard processing and displaying stylesheet.	
    
    This stylesheet merges an XMLForm document into 
    a pre-final HTML document. It includes other presentational
    parts of a page orthogonal to the xmlform.
  
    author: Ivelin Ivanov, ivelin@apache.org, June 2002
  
  -->
  
  <xsl:stylesheet 
      version="1.0" 
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:xf="http://apache.org/cocoon/xmlform/1.0"
      exclude-result-prefixes="xalan"
  >
  
  	<xsl:template match="document">
  		<html>
  			<head>
  				<title>Embedding One Web Site into another with Cocoon WebServiceProxyGenerator Demo </title>		
  				<style type="text/css">
  				<![CDATA[
                H1{font-family : sans-serif,Arial,Tahoma;color : white;background-color : #009900;} 
                BODY{font-family : sans-serif,Arial,Tahoma;color : black;background-color : #AAFFAA;} 
                B{color : white;background-color : #5090a0;} 
                HR{color : #0086b2;}
                input { background-color: #FFFFFF; color: #000099; border: 1px solid #0000FF; }		
                table { background-color: #DDDDFF; color: #000099; font-size: x-small; border: 2px solid brown;}
                select { background-color: #FFFFFF; color: #000099 }
               .error { color: #FF0000; }	      
               .invalid { color: #FF0000; border: 2px solid #FF0000; }
               .info { color: #0000FF; border: 1px solid #0000FF; }
               .repeat { background-color: #AAAACC; border: 0px inset #999999;border: 1px inset #999999; width: 100%; }
               .group { background-color: #AAAACC; border: 0px inset #999999;border: 0px inset #999999;  width: 100%; }
               .sub-table { background-color: #AAAACC; border: 1px inset black; }
               .button { background-color: green; color: white; border: 5px solid #AAFFAA; width: 90px; }
               .plaintable { background-color: #AAAACC; border: 1px inset black;border: 1px inset black; width: 100%; }
                ]]>
  				</style>			
                </head>
  			<body>
                  <table border="3">
                    <tr>
                      <td colspan="2" align="center">
                          <br/>
                          Embedding One Web Site into Another 
                          <br/><br/>
                          made easy with Cocoon 
                          <br/><br/>
                      </td>
                    </tr>
                    <tr>
                      <td width="20%" valign="top">
                        Navigation bar of the containing web site
                          <ul>
                            <li>
                                Remote Web Site
                            </li>
                            <li>
                                Local Content
                            </li>
                            <li>
                                All look like ONE.
                            </li>
                          </ul>
                      </td>
                      <td>
                        This is area for an embedded web site.
                        <br/>
                        <xsl:apply-templates />
                      </td>
                    </tr>
                    <tr>
                      <td colspan="2">
                        <p>
                        Remote Web Site Integration is an easy task with Cocoon.
                        This demo shows how the WebServiceProxyGenerator sitemap component, 
                        combined with the XMLForm framework and XSLT, allows 
                        vendors to share interactive content with little effort.
                        </p>
                        <p>
                        The Web Service Proxy takes advantage of the fact that 
                        a Cocoon web application produces XML content
                        which is later translated into multiple presentation formats, like HTML or WML.
                        </p>
                        <p>
                        This demo embeds the Cocoon Feedback Wizard application, which produces an XML
                        view containing both static data and interactive forms.
                        Having a client independent content format, allows this view to be 
                        pulled to the embedding web site (this demo) and styled with XSLT 
                        in the Look &amp; Feel of the site.
                        </p>
                        <p>
                        <i>
                        Ok, styling presentation is easy to understand, but how is a form submitted to the original site?
                        </i>
                        <br/>
                        Since the form markup in the XML content of an embedded page uses relative URL
                        address for the target, once the end user submits, the form data is sent to the 
                        containing site, which captures the form data and the relative URL.
                        The Web Service Proxy then takes this information and re-submits it to the
                        original site. It then reads the XML response and makes it available to the 
                        sitemap for styling again. 
                        </p>
                        <p>
                        <i>
                        Hm, but the Feedback Wizard example maintains a session while going through
                        multiple pages. So, how is the containing site propagating the end user session to the 
                        to the embedded site?
                        </i>
                        <br/>
                        The answer is simple. The Web Service Proxy simply hooks to the end user session,
                        and automatically starts its own session with the remote site.
                        If the remote site does not require authentication, then everything is transparent
                        to the developer of the containing web site. Otherwise the WebServiceProxyGenerator 
                        has to be extended to override the procedure for initating session with the remote site.
                        </p>
                        <p>
                        <i>What transport protocols are supported?</i>
                        <br/>
                        HTTP 1.0, HTTP 1.1, HTTPS.
                        </p>
                        <p>
                        Have more questions? Look at the code, it is really simple.
                        If you need advise, search through the Cocoon mailing lists archives.
                        If you can't find the answer, email your question to the Cocoon mailing lists.
                        Finally, if you need to contact me, send email to Ivelin Ivanov, ivelin@apache.org.
                        </p>
                        <p>
                        If you like this component, please help with documentation.
                        Write an FAQ, HOW-TO or User Guide.
                        </p>
                        <p>
                        </p>
                      </td>
                    </tr>
                  </table> 
  			</body>
  		</html>
  	</xsl:template>
  	
  	<xsl:template match="xf:form">
      <xf:form method="post">
        <xsl:copy-of select="@*" />
          <br/><br/>
          <i><u>... and This is a Personalized HTML Form:</u></i>
          <br/><br/>
          <table align="center" border="0" class="sub-table">
            <tr>
              <td align="center" colspan="3">
                  <h1>
                      <xsl:value-of select="xf:caption"/>
                      <hr/>
                  </h1>
              </td>
            </tr>
            <xsl:if test="count(error/xf:violation) > 0">
                <tr>
                  <td align="left" colspan="3" class="{error/xf:violation[1]/@class}">
                      <p>
                      * There are
                      [<b><xsl:value-of select="count(error/xf:violation)"/></b>]
                      errors. Please fix these errors and submit the form again.
                      </p>
                      <p>
                        <xsl:variable name="localViolations" select=".//xf:*[ child::xf:violation ]"/>
                        <xsl:for-each 
                          select="error/xf:violation">
                          <xsl:variable name="eref" select="./@ref"/>
                          <xsl:if test="count ($localViolations[ @ref=$eref ]) = 0">
                              * 
                              <xsl:value-of select="." />
                              <br/>
                          </xsl:if>
                        </xsl:for-each>
                      </p>
                      <p/>
                  </td>
                </tr>
            </xsl:if>
  
           <xsl:for-each select="*[name() != 'xf:submit']">
            <xsl:choose>
              <xsl:when test="name() = 'error'"/>
              <xsl:when test="xf:*">
                  <xsl:apply-templates select="."/>
              </xsl:when>
              <xsl:otherwise>
                  <xsl:copy-of select="."/>
              </xsl:otherwise>
             </xsl:choose>
           </xsl:for-each>
          <tr>
            <td align="center" colspan="3">
              <xsl:for-each select="*[name() = 'xf:submit']">
                <xsl:copy-of select="." />
                <xsl:text> </xsl:text>
              </xsl:for-each>
            </td>
          </tr>
        </table>
      </xf:form>
  	</xsl:template>
      
  	<xsl:template match="xf:repeat">
          <tr  width="100%">
              <td colspan="3" width="100%">
                Repeat elements:
                  <table class="repeat">
                 	    <xsl:apply-templates select="*"/>
                  </table>
              </td>
          </tr>
    	</xsl:template>
  
  	<xsl:template match="xf:group">
          <tr width="100%">
              <td width="100%" colspan="2">
                  Group element:
                  <table class="group" border="0">
                 	    <xsl:apply-templates select="*"/>
                  </table>
              </td>
          </tr>
    	</xsl:template>
      
  	<xsl:template match="xf:output[@form]">
          <div align="center"> 
              <hr width="30%"/>
              <br/>
              <font size="-1">
                <code>
                [*]
                  <xsl:value-of select="xf:caption" /> :
                  <xsl:copy-of select="." />
                </code>
              </font>
              <br/>
          </div>
  	</xsl:template>
  	
  
      <xsl:template match="xf:*">
        <tr>
            <td align="left">
              <xsl:value-of select="xf:caption" />
            </td>
            <td align="left">
          <table class="plaintable">
           <tr>
            <td align="left">
              <xsl:copy-of select="." />
            </td>
            <xsl:if test="xf:violation">
                <td align="left" class="{xf:violation[1]/@class}" width="100%">
                  <xsl:for-each select="xf:violation">
                    * <xsl:value-of select="." />
                    <br/>
                  </xsl:for-each>
                </td>
            </xsl:if>
           </tr>
          </table>
            </td>
        </tr>
      </xsl:template>
      
          
  	<xsl:template match="*">
  	    <xsl:copy-of select="." />
  	</xsl:template>
      
  </xsl:stylesheet>