cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject cvs commit: xml-cocoon2/src/webapp/samples/sub sitemap.xmap
Date Fri, 31 Jan 2003 16:40:40 GMT
haul        2003/01/31 08:40:40

  Modified:    src/webapp/samples sitemap.xmap
               src/webapp/samples/chaperon sitemap.xmap
               src/webapp/samples/common/style/xsl/html
                        simple-samples2html.xsl
               src/webapp/samples/docs/samples sample-apps.xml
               src/webapp/samples/docs/samples/xsp cacheable.xsp
               src/webapp/samples/hello-world sitemap.xmap
               src/webapp/samples/jsp sitemap.xmap
               src/webapp/samples/linkstatus sitemap.xmap
               src/webapp/samples/misc sitemap.xmap
               src/webapp/samples/poi sitemap.xmap
               src/webapp/samples/profiler sitemap.xmap
               src/webapp/samples/protected sitemap.xmap
               src/webapp/samples/search sitemap.xmap
               src/webapp/samples/stylesheets/page simple-page2html.xsl
               src/webapp/samples/sub sitemap.xmap
  Added:       src/webapp/samples/common/style/css samples.css
               src/webapp/samples/simpleform ERROR.xsp OK.xsp
                        descriptor.xml sform.xml sitemap.xmap success.xml
  Removed:     src/webapp/samples/docs/samples/formvalidation ERROR.xsp
                        OK.xsp descriptor.xml
  Log:
  sample cosmetics
  
  Revision  Changes    Path
  1.27      +126 -46   xml-cocoon2/src/webapp/samples/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/sitemap.xmap,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- sitemap.xmap	17 Jan 2003 17:28:53 -0000	1.26
  +++ sitemap.xmap	31 Jan 2003 16:40:25 -0000	1.27
  @@ -55,7 +55,13 @@
     <map:transformers default="xslt"/>
     <map:readers default="resource"/>
     <map:serializers default="html"/>
  -  <map:matchers default="wildcard"/>
  +  <map:matchers default="wildcard">
  +     <map:matcher logger="sitemap.matcher.header" name="filename" src="org.apache.cocoon.matching.modular.CachingRegexpMatcher">
  +        <input-module name="request-param">
  +           <parameter>filename</parameter>
  +        </input-module>
  +     </map:matcher>
  +  </map:matchers>
     <map:selectors default="browser"/>
       
   <!--
  @@ -125,8 +131,12 @@
   
     <map:resource name="dynamic-page">
        <map:generate src="{target}.xsp" type="serverpages"/>
  -     <map:transform src="stylesheets/dynamic-page2html.xsl">
  -       <map:parameter name="view-source" value="{target}.xsp"/>
  +     <map:transform src="context://samples/stylesheets/dynamic-page2html.xsl">
  +        <map:parameter name="servletPath" value="{request:servletPath}"/>
  +        <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
  +        <map:parameter name="contextPath" value="{request:contextPath}"/>
  +        <map:parameter name="file" value="{target}.xsp"/>
  +        <map:parameter name="remove" value="{remove}"/>
        </map:transform>
        <map:serialize/>
     </map:resource>
  @@ -146,6 +156,7 @@
           -->
           <map:call resource="dynamic-page">
              <map:parameter name="target" value="{../target}/state{../../../0}{../../0}"/>
  +           <map:parameter name="remove" value="{../remove}"/>
           </map:call>
        </map:act>
     </map:resource>
  @@ -155,14 +166,19 @@
           <map:parameter name="new-state" value="1"/>
           <map:call resource="dynamic-page">
              <map:parameter name="target" value="{../target}1"/>
  +           <map:parameter name="remove" value="{../remove}"/>
           </map:call>
        </map:act>
     </map:resource>
   
     <map:resource name="simple-page">
        <map:generate src="{target}.xml" type="file"/>
  -     <map:transform src="stylesheets/page/simple-page2html.xsl">
  -        <map:parameter name="view-source" value="{target}.xml"/>
  +     <map:transform src="context://samples/stylesheets/page/simple-page2html.xsl">
  +        <map:parameter name="servletPath" value="{request:servletPath}"/>
  +        <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
  +        <map:parameter name="contextPath" value="{request:contextPath}"/>
  +        <map:parameter name="file" value="{target}.xml"/>
  +        <map:parameter name="remove" value="{remove}"/>
        </map:transform>
        <map:serialize/>
     </map:resource>
  @@ -228,7 +244,9 @@
   
       <map:match pattern="welcome">
         <map:generate src="samples.xml"/>
  -      <map:transform type="xalan" src="common/style/xsl/html/simple-samples2html.xsl"/>
  +      <map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
  +         <map:parameter name="contextPath" value="{request:contextPath}"/>
  +      </map:transform>
         <map:serialize/>
       </map:match>
     </map:pipeline>
  @@ -308,8 +326,11 @@
         <map:generate src="docs/samples/xsp-js/{1}.xsp" type="serverpages">
           <map:parameter name="programming-language" value="js"/>
         </map:generate>
  -      <map:transform src="stylesheets/dynamic-page2html.xsl">
  -        <map:parameter name="view-source" value="docs/samples/xsp-js/{1}.xsp"/>
  +      <map:transform src="context://samples/stylesheets/dynamic-page2html.xsl">
  +         <map:parameter name="servletPath" value="{request:servletPath}"/>
  +         <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
  +         <map:parameter name="contextPath" value="{request:contextPath}"/>
  +         <map:parameter name="file" value=".xsp"/>
         </map:transform>
         <map:serialize/>
       </map:match>
  @@ -349,19 +370,30 @@
       <!--
       <map:select>
         <map:when test="wap">
  -        <map:transform src="stylesheets/simple-samples2html.xsl"/>
  +    	<map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
  +    	   <map:parameter name="contextPath" value="{request:contextPath}"/>
  +    	</map:transform>
         </map:when>
         <map:when test="netscape">
  -        <map:transform src="stylesheets/simple-samples2html.xsl"/>
  +    	<map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
  +    	   <map:parameter name="contextPath" value="{request:contextPath}"/>
  +    	</map:transform>
         </map:when>
         <map:otherwise>
  -        <map:transform src="stylesheets/simple-samples2html.xsl"/>
  +    	<map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
  +    	   <map:parameter name="contextPath" value="{request:contextPath}"/>
  +    	</map:transform>
         </map:otherwise>
       </map:select>
       -->
  -    <map:transform type="xslt" src="stylesheets/simple-samples2html.xsl"/>
  +    <map:transform type="xslt" src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
  +       <map:parameter name="contextPath" value="{request:contextPath}"/>
  +    </map:transform>
       <!-- uncomment the following if you want to use Xalan's interpreter as the XSLT processor -->
  -    <!-- <map:transform type="xalan" src="stylesheets/simple-samples2html.xsl"/> -->
  +    <!-- <map:transform type="xalan" src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
  +            <map:parameter name="contextPath" value="{request:contextPath}"/>
  +         </map:transform>
  +    -->
       <!--
          These events are consumed by the default transformer, which
          uses "stylesheets/simple-samples2html.xsl" as parameter. Since
  @@ -383,7 +415,9 @@
   
      <map:match pattern="sample-*">
       <map:generate src="docs/samples/sample-{1}.xml"/>
  -    <map:transform src="stylesheets/simple-samples2html.xsl"/>
  +    <map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
  +       <map:parameter name="contextPath" value="{request:contextPath}"/>
  +    </map:transform>
       <map:serialize/>
      </map:match>
   
  @@ -448,7 +482,13 @@
   
      <map:match pattern="hello.html">
       <map:generate src="docs/samples/hello-page.xml"/>
  -    <map:transform src="stylesheets/page/simple-page2html.xsl"/>
  +    <map:transform src="context://samples/stylesheets/page/simple-page2html.xsl">
  +       <map:parameter name="servletPath" value="{request:servletPath}"/>
  +       <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
  +       <map:parameter name="contextPath" value="{request:contextPath}"/>
  +       <map:parameter name="file" value="docs/samples/hello-page.xml"/>
  +       <map:parameter name="remove" value="{0}"/>
  +    </map:transform>
       <map:serialize type="html"/>
      </map:match>
   
  @@ -593,16 +633,26 @@
   
      <map:match pattern="scripts/*">
       <map:generate src="docs/samples/scripts/{1}" type="script"/>
  -    <map:transform src="stylesheets/page/simple-page2html.xsl"/>
  +    <map:transform src="context://samples/stylesheets/page/simple-page2html.xsl">
  +       <map:parameter name="servletPath" value="{request:servletPath}"/>
  +       <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
  +       <map:parameter name="contextPath" value="{request:contextPath}"/>
  +       <map:parameter name="file" value="docs/samples/scripts/{1}"/>
  +       <map:parameter name="remove" value="{0}"/>
  +    </map:transform>
       <map:serialize type="html"/>
      </map:match>
   
      <map:match pattern="templates/*">
       <map:generate src="templates/{1}" type="velocity">
  -    <map:parameter name="name" value="Velocity"/>
  -    <map:parameter name="project" value="Cocoon"/>
  +       <map:parameter name="name" value="Velocity"/>
  +       <map:parameter name="project" value="Cocoon"/>
       </map:generate>
  -    <map:transform src="stylesheets/page/simple-page2html.xsl"/>
  +    <map:transform src="context://samples/stylesheets/page/simple-page2html.xsl">
  +       <map:parameter name="servletPath" value="{request:servletPath}"/>
  +       <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
  +       <map:parameter name="contextPath" value="{request:contextPath}"/>
  +    </map:transform>
       <map:serialize type="html"/>
      </map:match>
   
  @@ -643,8 +693,12 @@
      <!-- =========================== Dynamic ================================ -->
      <map:match pattern="xsp/*">
       <map:generate src="docs/samples/xsp/{1}.xsp" type="serverpages"/>
  -    <map:transform src="stylesheets/dynamic-page2html.xsl">
  -        <map:parameter name="view-source" value="samples/docs/samples/xsp/{1}.xsp"/>
  +    <map:transform src="context://samples/stylesheets/dynamic-page2html.xsl">
  +        <map:parameter name="servletPath" value="{request:servletPath}"/>
  +        <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
  +        <map:parameter name="contextPath" value="{request:contextPath}"/>
  +        <map:parameter name="file" value="docs/samples/xsp/{1}.xsp"/>
  +        <map:parameter name="remove" value="{0}"/>
       <!--
          Run-time configuration is done through these
          <map:parameter/> elements. Again, let's have a look at the
  @@ -662,20 +716,6 @@
       <map:serialize/>
      </map:match>
   
  -   <!-- ======================= FormValidation ============================= -->
  -
  -   <map:match pattern="formvalidation/test">
  -     <map:act type="form-validator">
  -        <map:parameter name="descriptor" value="docs/samples/formvalidation/descriptor.xml"/>
  -        <map:parameter name="validate-set" value="car-reservation"/>
  -        <map:call resource="dynamic-page">
  -           <map:parameter name="target" value="docs/samples/formvalidation/OK"/>
  -        </map:call>
  -     </map:act>
  -     <map:call resource="dynamic-page">
  -        <map:parameter name="target" value="docs/samples/formvalidation/ERROR"/>
  -     </map:call>
  -   </map:match>
   
     <!-- ========================== session state ================================= -->
   
  @@ -696,12 +736,14 @@
              <map:match pattern="1" type="next-page">
                 <map:call resource="dynamic-page1">
                    <map:parameter name="target" value="docs/samples/session-state"/>
  +                 <map:parameter name="remove" value="session-state/example"/>
                 </map:call>
                 <!-- by calling this resource, the rest of this fragment here is irrelevant -->
              </map:match>
              <map:match pattern="2" type="next-page">
                 <map:call resource="dynamic-page1">
                    <map:parameter name="target" value="docs/samples/session-state"/>
  +                 <map:parameter name="remove" value="session-state/example"/>
                 </map:call>
              </map:match>
           </map:match>
  @@ -710,42 +752,49 @@
              <map:match pattern="1" type="next-page">
                 <map:call resource="dynamic-page1">
                    <map:parameter name="target" value="docs/samples/session-state"/>
  +                 <map:parameter name="remove" value="session-state/example"/>
                 </map:call>
              </map:match>
              <map:match pattern="2" type="next-page">
                 <map:call resource="dynamic-page1">
                    <map:parameter name="target" value="docs/samples/session-state"/>
  +                 <map:parameter name="remove" value="session-state/example"/>
                 </map:call>
              </map:match>
           </map:match>
   
           <map:call resource="dynamic-page2">
              <map:parameter name="target" value="docs/samples/session-state/state0"/>
  +           <map:parameter name="remove" value="session-state/example"/>
           </map:call>
         </map:act>
         <!-- end if session is valid -->
   
         <map:call resource="dynamic-page">
            <map:parameter name="target" value="docs/samples/session-state/start"/>
  +         <map:parameter name="remove" value="session-state/example"/>
         </map:call>
     </map:match>
   
      <!-- ========================== referer ================================= -->
   
     <map:match pattern="referer/*">
  -     <map:match pattern="http://*/cocoon/referer/a" type="referer-match">
  +     <map:match pattern="http://*/cocoon/samples/referer/a" type="referer-match">
           <map:call resource="simple-page">
              <map:parameter name="target" value="docs/samples/referer/a/{../1}"/>
  +           <map:parameter name="remove" value="{../0}"/>
           </map:call>
        </map:match>
  -     <map:match pattern="http://*/cocoon/referer/b" type="referer-match">
  +     <map:match pattern="http://*/cocoon/samples/referer/b" type="referer-match">
           <map:call resource="simple-page">
              <map:parameter name="target" value="docs/samples/referer/b/{../1}"/>
  +           <map:parameter name="remove" value="{../0}"/>
           </map:call>
        </map:match>
   
        <map:call resource="simple-page">
           <map:parameter name="target" value="docs/samples/referer/a/a"/>
  +        <map:parameter name="remove" value="{0}"/>
        </map:call>
     </map:match>
   
  @@ -759,7 +808,12 @@
   
      <map:match pattern="Order">
        <map:generate src="docs/samples/stream/OrderPage.xml"/>
  -     <map:transform src="stylesheets/dynamic-page2html.xsl"/>
  +     <map:transform src="context://samples/stylesheets/dynamic-page2html.xsl">
  +        <map:parameter name="servletPath" value="{request:servletPath}"/>
  +        <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
  +        <map:parameter name="contextPath" value="{request:contextPath}"/>
  +        <map:parameter name="file" value=".xsp"/>
  +     </map:transform>
        <map:serialize type="html"/>
      </map:match>
   
  @@ -773,6 +827,16 @@
       <map:serialize/>
      </map:match>
   
  +   <map:match pattern="view-file">
  +    <!-- colourize files that are known to be XML -->
  +    <map:match type="filename" pattern="((xml)|(xsp)|(xmap)|(xconf))$">
  +       <map:generate src="docs/samples/slides/view-source.xsp" type="serverpages"/>
  +       <map:serialize/>
  +    </map:match>
  +    <!-- all other files are just send as text -->
  +    <map:read mime-type="text/plain" src="../{request-param:filename}"/>
  +   </map:match>
  +
      <!-- ========================== SOAP ============================== -->
      <map:match pattern="soap/*">
       <map:generate src="docs/samples/soap/{1}.xml" type="serverpages"/>
  @@ -783,16 +847,24 @@
      <map:match pattern="xscript/soap-getquote1">
        <map:generate src="docs/samples/xscript/soap-getquote1.xsp" type="serverpages"/>
        <map:transform src="docs/samples/xscript/soap-getquote1.xsl"/>
  -     <map:transform src="stylesheets/dynamic-page2html.xsl">
  -       <map:parameter name="view-source" value="docs/samples/xscript/soap-getquote1.xsp"/>
  +     <map:transform src="context://samples/stylesheets/dynamic-page2html.xsl">
  +        <map:parameter name="servletPath" value="{request:servletPath}"/>
  +        <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
  +        <map:parameter name="contextPath" value="{request:contextPath}"/>
  +        <map:parameter name="file" value="docs/samples/{0}.xsp"/>
  +        <map:parameter name="remove" value="{0}"/>
        </map:transform>
        <map:serialize/>
      </map:match>
   
      <map:match pattern="xscript/*">
        <map:generate src="docs/samples/xscript/{1}.xsp" type="serverpages"/>
  -     <map:transform src="stylesheets/dynamic-page2html.xsl">
  -       <map:parameter name="view-source" value="docs/samples/xscript/{1}.xsp"/>
  +     <map:transform src="context://samples/stylesheets/dynamic-page2html.xsl">
  +        <map:parameter name="servletPath" value="{request:servletPath}"/>
  +        <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
  +        <map:parameter name="contextPath" value="{request:contextPath}"/>
  +        <map:parameter name="file" value="docs/samples/{0}.xsp"/>
  +        <map:parameter name="remove" value="{0}"/>
        </map:transform>
        <map:serialize/>
      </map:match>
  @@ -819,7 +891,9 @@
   
      <map:match pattern="generror">
       <map:generate src="docs/samples/error-giving-page.xml"/>
  -    <map:transform src="stylesheets/simple-samples2html.xsl"/>
  +    <map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
  +       <map:parameter name="contextPath" value="{request:contextPath}"/>
  +    </map:transform>
       <map:serialize/>
      </map:match>
   
  @@ -885,19 +959,25 @@
   
      <map:match pattern="welcome">
       <map:generate src="samples.xml"/>
  -    <map:transform type="xalan" src="common/style/xsl/html/simple-samples2html.xsl"/>
  +    <map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
  +       <map:parameter name="contextPath" value="{request:contextPath}"/>
  +    </map:transform>
       <map:serialize/>
      </map:match>
   
      <map:match pattern="scratchpad">
       <map:generate src="scratchpad-samples.xml"/>
  -    <map:transform type="xalan" src="common/style/xsl/html/simple-samples2html.xsl"/>
  +    <map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
  +       <map:parameter name="contextPath" value="{request:contextPath}"/>
  +    </map:transform>
       <map:serialize/>
      </map:match>
   
      <map:match pattern="blocks">
       <map:generate src="block-samples.xml"/>
  -    <map:transform type="xalan" src="common/style/xsl/html/simple-samples2html.xsl"/>
  +    <map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
  +       <map:parameter name="contextPath" value="{request:contextPath}"/>
  +    </map:transform>
       <map:serialize/>
      </map:match>
     
  
  
  
  1.5       +3 -1      xml-cocoon2/src/webapp/samples/chaperon/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/chaperon/sitemap.xmap,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- sitemap.xmap	17 Jan 2003 11:29:23 -0000	1.4
  +++ sitemap.xmap	31 Jan 2003 16:40:29 -0000	1.5
  @@ -98,7 +98,9 @@
      
      <map:match pattern="welcome">
       <map:generate src="misc/samples.xml"/>
  -    <map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl"/>
  +    <map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
  +       <map:parameter name="contextPath" value="{request:contextPath}"/>
  +    </map:transform>
       <map:serialize/>
      </map:match>
   
  
  
  
  1.1                  xml-cocoon2/src/webapp/samples/common/style/css/samples.css
  
  Index: samples.css
  ===================================================================
  <!-- $Id: samples.css,v 1.1 2003/01/31 16:40:31 haul Exp $ -->
  
  body { background-color: white;
         }
  
  p { text-align: left;
      font-style: italic;
      }
  
  h2 { color: navy; 
       text-align: center 
       }
  
  h1 { color: navy; 
       text-align: center 
       }
  
  div.resources, div.footer { background-color: #c0d0f0; }
  div.footer    { font-size: small; }
  div.footer > table { font-size: small; }
  
  td.doc { background-color: #e0ffff; }
  td.file { background-color: #d0f0ff; }
  
  a:link { color: blue; }
  a:visited { color: blue; }
  a:hover {  color: red; }
  
  
  
  
  1.7       +19 -7     xml-cocoon2/src/webapp/samples/common/style/xsl/html/simple-samples2html.xsl
  
  Index: simple-samples2html.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/common/style/xsl/html/simple-samples2html.xsl,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- simple-samples2html.xsl	17 Jan 2003 11:29:23 -0000	1.6
  +++ simple-samples2html.xsl	31 Jan 2003 16:40:33 -0000	1.7
  @@ -4,6 +4,8 @@
   <!-- Author: Christian Haul "haul@apache.org" -->
   <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xlink="http://www.w3.org/1999/xlink">
   
  +  <xsl:param name="contextPath" select="string('/cocoon')"/>
  +
    <xsl:template match="/">
     <html>
      <head>
  @@ -14,7 +16,7 @@
       <table border="0" cellspacing="2" cellpadding="2" align="center" width="100%">
        <tr>
         <td width="*"><font face="arial,helvetica,sanserif" color="#000000">The Apache Software Foundation is proud to present...</font></td>
  -      <td width="40%" align="center"><img border="0" src="/cocoon/samples/images/cocoon.gif"/></td>
  +      <td width="40%" align="center"><img border="0" src="{concat($contextPath,'/samples/images/cocoon.gif')}"/></td>
         <td width="30%" align="center"><font face="arial,helvetica,sanserif" color="#000000"><b>version @version@</b></font></td>
        </tr>
        <tr>
  @@ -179,12 +181,22 @@
    </xsl:template>
    
    <xsl:template match="sample">
  -  <tr>
  -   <td width="100%" bgcolor="#ffffff" align="left">
  -    <font size="+0" face="arial,helvetica,sanserif" color="#000000">    
  -      <a href="{@href}"><xsl:value-of select="@name"/></a><xsl:text> - </xsl:text>
  -      <xsl:value-of select="."/>
  -    </font>
  +   <xsl:variable name="link">
  +     <xsl:choose>
  +       <xsl:when test="starts-with(@href,'/')">
  +         <xsl:value-of select="concat($contextPath,@href)"/>
  +       </xsl:when>
  +       <xsl:otherwise>
  +         <xsl:value-of select="@href"/>
  +       </xsl:otherwise>
  +     </xsl:choose>
  +   </xsl:variable>
  +   <tr>
  +     <td width="100%" bgcolor="#ffffff" align="left">
  +       <font size="+0" face="arial,helvetica,sanserif" color="#000000">    
  +       <a href="{$link}"><xsl:value-of select="@name"/></a><xsl:text> - </xsl:text>
  +       <xsl:value-of select="."/>
  +     </font>
      </td>
     </tr>
    </xsl:template>
  
  
  
  1.4       +6 -2      xml-cocoon2/src/webapp/samples/docs/samples/sample-apps.xml
  
  Index: sample-apps.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/docs/samples/sample-apps.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- sample-apps.xml	17 Jan 2003 11:29:22 -0000	1.3
  +++ sample-apps.xml	31 Jan 2003 16:40:34 -0000	1.4
  @@ -44,7 +44,11 @@
           <xlink:a href="http://java.sun.com/products/javabeans/">JavaBeans</xlink:a> and 
           <xlink:a href="http://www.w3.org/DOM/">DOM</xlink:a> instances.
       </sample>
  -    <sample name="Form Validation" href="formvalidation/test" xlink:role="dynamic">
  +    <sample name="Simple Form Validation - Transformer" href="simpleform/sform" xlink:role="dynamic">
  +      This example demonstrates the use of an action to validate user
  +      input and report validation errors to the user through a transfomer.
  +    </sample>
  +    <sample name="Simple Form Validation - Logicsheet" href="simpleform/formval" xlink:role="dynamic">
         This example demonstrates the use of an action to validate user
         input and report validation errors to the user through a taglib.
       </sample>
  
  
  
  1.2       +9 -8      xml-cocoon2/src/webapp/samples/docs/samples/xsp/cacheable.xsp
  
  Index: cacheable.xsp
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/docs/samples/xsp/cacheable.xsp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- cacheable.xsp	2 Jul 2002 13:06:39 -0000	1.1
  +++ cacheable.xsp	31 Jan 2003 16:40:36 -0000	1.2
  @@ -7,9 +7,7 @@
             xmlns:xsp-request="http://apache.org/xsp/request/2.0">
   
   <xsp:structure>
  -<xsp:include>org.apache.cocoon.caching.CacheValidity</xsp:include>
  -<xsp:include>org.apache.cocoon.caching.DeltaTimeCacheValidity</xsp:include>
  -<xsp:include>org.apache.cocoon.util.HashUtil</xsp:include>
  +<xsp:include>org.apache.excalibur.source.SourceValidity</xsp:include>
   </xsp:structure>
   
   <xsp:logic>
  @@ -21,10 +19,10 @@
        * @return The generated key or 0 if the component
        *         is currently not cacheable.
        */
  -    public long generateKey()
  +    public java.io.serializable generateKey()
       {
           // Generate unique key; add parameters' values here
  -        return HashUtil.hash("" + request.getParameter("param"));
  +        return super.generateKey()+request.getParameter("param");
       }
       
       /**
  @@ -35,9 +33,12 @@
        * @return The generated validity object or null if the
        *         component is currently not cacheable.
        */
  -    public CacheValidity generateValidity() {
  +    public SourceValidity generateValidity() {
           // Check all dependencies here
  -        return new DeltaTimeCacheValidity(0, 5);
  +        java.util.Calendar cal = new java.util.GregorianCalendar();
  +        cal.add(java.util.Calendar.SECOND, +5); // valid for 5 seconds
  +        return new
  +           org.apache.excalibur.source.impl.validity.TimeStampValidity(cal.getTimeInMillis());
       }
   </xsp:logic>
   
  
  
  
  1.9       +14 -2     xml-cocoon2/src/webapp/samples/hello-world/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/hello-world/sitemap.xmap,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- sitemap.xmap	20 Oct 2002 12:25:45 -0000	1.8
  +++ sitemap.xmap	31 Jan 2003 16:40:39 -0000	1.9
  @@ -95,7 +95,13 @@
     <map:pipeline>
      <map:match pattern="hello.html">
       <map:generate src="content/xml/hello-page.xml"/>
  -    <map:transform src="style/xsl/simple-page2html.xsl"/>
  +    <map:transform src="context://samples/stylesheets/page/simple-page2html.xsl">
  +       <map:parameter name="servletPath" value="{request:servletPath}"/>
  +       <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
  +       <map:parameter name="contextPath" value="{request:contextPath}"/>
  +       <map:parameter name="file" value="content/xml/hello-page.xml"/>
  +       <map:parameter name="remove" value="{0}"/>
  +    </map:transform>
       <map:serialize type="html"/>
      </map:match>
   
  @@ -116,7 +122,13 @@
   
      <map:match pattern="hello.xhtml">
       <map:generate src="content/xml/hello-page.xml"/>
  -    <map:transform src="style/xsl/simple-page2html.xsl"/>
  +    <map:transform src="context://samples/stylesheets/page/simple-page2html.xsl">
  +       <map:parameter name="servletPath" value="{request:servletPath}"/>
  +       <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
  +       <map:parameter name="contextPath" value="{request:contextPath}"/>
  +       <map:parameter name="file" value="content/xml/hello-page.xml"/>
  +       <map:parameter name="remove" value="{0}"/>
  +    </map:transform>
       <map:serialize type="xhtml"/>
      </map:match>
      
  
  
  
  1.4       +6 -1      xml-cocoon2/src/webapp/samples/jsp/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/jsp/sitemap.xmap,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- sitemap.xmap	20 Oct 2002 12:25:45 -0000	1.3
  +++ sitemap.xmap	31 Jan 2003 16:40:39 -0000	1.4
  @@ -42,7 +42,12 @@
   
         <map:match pattern="*.jsp">
           <map:generate type="jsp" src="{1}.jsp"/>
  -        <map:transform src="simple-page2html.xsl"/>
  +     	<map:transform src="context://samples/stylesheets/dynamic-page2html.xsl">
  +     	   <map:parameter name="servletPath" value="{request:servletPath}"/>
  +     	   <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
  +     	   <map:parameter name="contextPath" value="{request:contextPath}"/>
  +     	   <map:parameter name="file" value=".jsp"/>
  +     	</map:transform>
           <map:serialize type="html"/>
         </map:match>
   
  
  
  
  1.5       +3 -1      xml-cocoon2/src/webapp/samples/linkstatus/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/linkstatus/sitemap.xmap,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- sitemap.xmap	20 Oct 2002 12:25:45 -0000	1.4
  +++ sitemap.xmap	31 Jan 2003 16:40:39 -0000	1.5
  @@ -34,7 +34,9 @@
   
      <map:match pattern="welcome">
       <map:generate src="samples.xml"/>
  -    <map:transform src="context://samples/stylesheets/simple-samples2html.xsl"/>
  +    <map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
  +       <map:parameter name="contextPath" value="{request:contextPath}"/>
  +    </map:transform>
       <map:serialize/>
      </map:match>
   
  
  
  
  1.4       +3 -1      xml-cocoon2/src/webapp/samples/misc/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/misc/sitemap.xmap,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- sitemap.xmap	29 Nov 2002 07:21:42 -0000	1.3
  +++ sitemap.xmap	31 Jan 2003 16:40:39 -0000	1.4
  @@ -19,7 +19,9 @@
   
      <map:match pattern="welcome">
       <map:generate src="samples.xml"/>
  -    <map:transform src="context://samples/stylesheets/simple-samples2html.xsl"/>
  +    <map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
  +       <map:parameter name="contextPath" value="{request:contextPath}"/>
  +    </map:transform>
       <map:serialize/>
      </map:match>
   
  
  
  
  1.4       +11 -4     xml-cocoon2/src/webapp/samples/poi/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/poi/sitemap.xmap,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- sitemap.xmap	4 Jul 2002 05:20:43 -0000	1.3
  +++ sitemap.xmap	31 Jan 2003 16:40:39 -0000	1.4
  @@ -27,7 +27,9 @@
   
      <map:match pattern="welcome">
       <map:generate src="content/samples.xml"/>
  -    <map:transform src="context://samples/stylesheets/simple-samples2html.xsl"/>
  +    <map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
  +       <map:parameter name="contextPath" value="{request:contextPath}"/>
  +    </map:transform>
       <map:serialize/>
      </map:match>
   
  @@ -88,9 +90,14 @@
   
      <map:match pattern="xsp/*">
       <map:generate src="content/dynamic/{1}.xsp" type="serverpages"/>
  -<!--    <map:transform src="stylesheets/dynamic-page2html.xsl">
  -        <map:parameter name="view-source" value="docs/samples/xsp/{1}.xsp"/>
  -    </map:transform>-->
  +<!--
  +     <map:transform src="context://samples/stylesheets/dynamic-page2html.xsl">
  +        <map:parameter name="servletPath" value="{request:servletPath}"/>
  +        <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
  +        <map:parameter name="contextPath" value="{request:contextPath}"/>
  +        <map:parameter name="file" value=".xsp"/>
  +     </map:transform>
  +-->
       <map:serialize type="xml"/>
      </map:match>
      
  
  
  
  1.4       +3 -1      xml-cocoon2/src/webapp/samples/profiler/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/profiler/sitemap.xmap,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- sitemap.xmap	14 Jan 2003 10:36:52 -0000	1.3
  +++ sitemap.xmap	31 Jan 2003 16:40:39 -0000	1.4
  @@ -81,7 +81,9 @@
   
      <map:match pattern="welcome">
       <map:generate src="samples.xml"/>
  -    <map:transform src="context://samples/stylesheets/simple-samples2html.xsl"/>
  +    <map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
  +       <map:parameter name="contextPath" value="{request:contextPath}"/>
  +    </map:transform>
       <map:serialize/>
      </map:match>
     
  
  
  
  1.5       +7 -1      xml-cocoon2/src/webapp/samples/protected/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/protected/sitemap.xmap,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- sitemap.xmap	20 Oct 2002 12:25:45 -0000	1.4
  +++ sitemap.xmap	31 Jan 2003 16:40:39 -0000	1.5
  @@ -45,7 +45,13 @@
         <!-- ================= -->
         <map:match pattern="login">
           <map:generate src="docs/login.xml"/>
  -        <map:transform src="stylesheets/simple-page2html.xsl"/>
  +     	<map:transform src="context://samples/stylesheets/page/simple-page2html.xsl">
  +     	   <map:parameter name="servletPath" value="{request:servletPath}"/>
  +     	   <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
  +     	   <map:parameter name="contextPath" value="{request:contextPath}"/>
  +       	   <map:parameter name="file" value="docs/login.xml"/>
  +       	   <map:parameter name="remove" value="{0}"/>
  +     	</map:transform>
           <map:serialize/>
         </map:match>
   
  
  
  
  1.5       +6 -3      xml-cocoon2/src/webapp/samples/search/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/search/sitemap.xmap,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- sitemap.xmap	13 Aug 2002 15:16:33 -0000	1.4
  +++ sitemap.xmap	31 Jan 2003 16:40:39 -0000	1.5
  @@ -57,9 +57,12 @@
       
         <map:match pattern="**">
           <map:generate type="serverpages" src="{1}-index.xsp"/>
  -        <map:transform src="context://samples/stylesheets/dynamic-page2html.xsl">
  -          <map:parameter name="view-source" value="search/{1}-index.xsp"/>
  -        </map:transform>
  +     	<map:transform src="context://samples/stylesheets/dynamic-page2html.xsl">
  +     	   <map:parameter name="servletPath" value="{request:servletPath}"/>
  +     	   <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
  +     	   <map:parameter name="contextPath" value="{request:contextPath}"/>
  +     	   <map:parameter name="file" value="-index.xsp"/>
  +     	</map:transform>
           <map:serialize/>
         </map:match>
       </map:pipeline>
  
  
  
  1.1                  xml-cocoon2/src/webapp/samples/simpleform/ERROR.xsp
  
  Index: ERROR.xsp
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?><!-- -*- sgml -*- -->
  
  <xsp:page language="java"
            xmlns:xsp="http://apache.org/xsp"
            xmlns:xsp-formval="http://apache.org/xsp/form-validator/2.0"
            xmlns:xsp-request="http://apache.org/xsp/request/2.0">
  
     <page>
  
      <resources>
         <resource type="file" href="descriptor.xml">Descriptor</resource>
         <resource type="doc" href="userdocs/xsp/logicsheet-forms.html">Action &amp; Logicsheet</resource>
      </resources>
  
      <title>Car Reservation</title>
      <content>
  
      <para>
         Informal validation results <xsp:expr><xsp-formval:results/></xsp:expr>
      </para>
  
      <form method="POST">
       <!-- use this to get a clue if the user had a chance to fill in
            any date already. This is necessary if no validation results should be
            displayed when the user first encounters the form. If the error messages
            should be used to guide the user from the beginning, this is not needed.
        -->
       <input type="hidden" name="visited" value="true"/>
       <xsp:logic>
          boolean userHasSeenForm = (<xsp-request:get-parameter name="visited"/>!=null);
       </xsp:logic>
  
  
  
       <!-- if validation constraints should be included in the error messages, a
            reference to the file containing the validation rules is needed. Otherwise
            it can be removed.
       -->
       <xsp-formval:descriptor name="descriptor.xml" constraint-set="car-reservation">
  
        <table>
         <tbody>
  
          <!-- the first example field illustrates the simplest usage, passing the current
               validation field name every time.
          -->
          <tr>
           <td>How many persons should the car seat?</td>
           <td>
            <input type="TEXT" name="persons" size="2">
             <xsp:attribute name="value"><xsp-request:get-parameter name="persons" default=""/></xsp:attribute>
            </input>
           </td>
           <td>
            <xsp:logic>
              if (userHasSeenForm) {
                if (<xsp-formval:is-toosmall name="persons"/> ) {
                   <b> The smallest available car seats <xsp-formval:get-attribute parameter="persons" name="min"/></b>
                } else if ( <xsp-formval:is-toolarge name="persons"/> ) {
                   <b> The largest available car seats <xsp-formval:get-attribute parameter="persons" name="max"/></b>
                } else if (<xsp-formval:is-error name="persons"/> ) {
                   <b> Some error occured. Your input is not correct. </b>
                }
              }
            </xsp:logic>
           </td>
          </tr>
  
  
          <!-- another possibility is to create a context that is used for all nested 
               validation tags. Note that here no validation parameter name is added to
               the validation tags.
          -->
          <xsp-formval:validate name="deposit">
           <tr>
            <td>Please enter your deposit EUR</td>
            <td>
             <input type="TEXT" name="deposit" size="10">
              <xsp:attribute name="value"><xsp-request:get-parameter name="deposit" default=""/></xsp:attribute>
             </input>
            </td>
            <td>
             <xsp:logic>
              if (userHasSeenForm) {
                if ( <xsp-formval:is-null/>) {
                   <b> You need to specify a deposit </b>
                } else if ( <xsp-formval:is-toosmall/> ) {
                   <b> The deposit has to be at least EUR <xsp-formval:get-attribute name="min"/></b>
                } else if ( <xsp-formval:is-toolarge/> ) {
                   <b> The deposit has to be at most EUR <xsp-formval:get-attribute name="max"/></b>
                } else if (<xsp-formval:is-notpresent/> ) {
                   <b></b>
                } else if ( <xsp-formval:is-error/>) {
                   <b> Some error occured. Your input is not correct. </b>
                }
              }
             </xsp:logic>
            </td>
           </tr>
          </xsp-formval:validate>
  
          <xsp-formval:validate name="email">
           <tr>
            <td>Please enter your email</td>
            <td>
             <input type="TEXT" name="email" size="50">
              <xsp:attribute name="value"><xsp-request:get-parameter name="email" default=""/></xsp:attribute>
             </input>
            </td>
            <td>
             <xsp:logic>
              if (userHasSeenForm) {
                 if ( <xsp-formval:is-null/>) {
                    <b> You need to specify an email </b>
                 } else if ( <xsp-formval:is-nomatch/> ) {
                    <b> This does not seem to be a valid email
                        address. Expected 
                        <pre><xsp-formval:get-attribute parameter="email" name="matches-regex"/></pre>
                    </b>
                 } else if ( <xsp-formval:is-toolarge/> ) {
                    <b> Only addresses with up to 
                        <xsp-formval:get-attribute parameter="email" name="max-len"/> 
                        characters are accepted
                    </b>
                 } else if (<xsp-formval:is-notpresent/> ) {
                    <b></b>
                 } else if ( <xsp-formval:is-error/>) {
                    <b> Some error occured. Your input is not correct. </b>
                 }
              }
             </xsp:logic>
            </td>
           </tr>
          </xsp-formval:validate>
  
  
          <!-- less embedded java is needed when using the <xsp-formval:on-XXX/> tags. They are
               equivalent to the above "<xsp:logic>if (<xsp-formval:is-XXX/>) { ... } </xsp:logic>"
               but much cleaner. 
          -->
          <xsp-formval:validate name="address">
           <tr>
            <td>Please enter the billing address</td>
            <td>
             <textarea rows="6" cols="40" name="address"><xsp-request:get-parameter name="address" default=""/></textarea>
            </td>
            <td>
             <xsp:logic>
              if (userHasSeenForm) {
                 <xsp-formval:on-null>
                   <b> You need to specify an address. </b>
                 </xsp-formval:on-null>
  
                 <xsp-formval:on-toolarge>
                   <b> Only addresses with up to 
                       <xsp-formval:get-attribute parameter="address" name="max-len"/> 
                       characters are accepted.
                   </b>
                 </xsp-formval:on-toolarge>
  
                 <xsp-formval:on-notpresent/>
              
                 <xsp-formval:on-error>
                   <b> Some error occured. Your input is not correct. </b>
                 </xsp-formval:on-error>
              }
             </xsp:logic>
            </td>
           </tr>
          </xsp-formval:validate>
         </tbody>
        </table>
           
       </xsp-formval:descriptor>
       <input type="submit" name="submit" value="submit"/>
      </form>
  
     </content>
    </page>
  </xsp:page>
  
  
  
  1.1                  xml-cocoon2/src/webapp/samples/simpleform/OK.xsp
  
  Index: OK.xsp
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?><!-- -*- sgml -*- -->
  <xsp:page
     language="java"
     xmlns:xsp="http://apache.org/xsp"
     xmlns:xsp-formval="http://apache.org/xsp/form-validator/2.0"
     xmlns:xsp-request="http://apache.org/xsp/request/2.0"
  >
  
     <page>
      <resources>
         <resource type="file" href="descriptor.xml">Descriptor</resource>
         <resource type="doc" href="userdocs/xsp/logicsheet-forms.html">Action &amp; Logicsheet</resource>
      </resources>
  
        <title>Car Reservation</title>
        <content>
  
        <para>You've successfully reserved a car for
        <b><xsp-request:get-parameter name="persons"/></b> with a deposit of
        <b>EUR <xsp-request:get-parameter name="deposit"/></b>.</para> 
  
        <para> Details will be sent to your e-mail address
        <tt><xsp-request:get-parameter name="email"/></tt></para>
  
        <para> The bill will be sent to <pre>
  <xsp-request:get-parameter name="address"/></pre></para>
  
        <para>You can make a new reservation <a href="formval">here</a></para>
  
        </content>
     </page>
  </xsp:page>
  
  
  
  1.1                  xml-cocoon2/src/webapp/samples/simpleform/descriptor.xml
  
  Index: descriptor.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <root>
  
     <parameter name="persons" type="long" min="2" default="9" nullable="yes"/>
     <parameter name="deposit" type="double" min="10.0" max="999.99"/>
     <parameter name="email" type="string" max-len="50" matches-regex="^[\d\w][\d\w\-_\.]*@([\d\w\-_]+\.)\w\w\w?$"/>
     <parameter name="address" type="string" min-len="10" max-len="200" nullable="no"/>
  
     <constraint-set name="car-reservation">
         <validate name="persons"/>
         <validate name="deposit" min="50.0"/>
         <validate name="email"/>
         <validate name="address"/>
      </constraint-set>
  
  
    <parameter name="person/name" type="string" max-len="10"/>
  
    <constraint-set name="testform">
      <validate name="person/name"/>
    </constraint-set>
  
  </root>
  
  
  
  1.1                  xml-cocoon2/src/webapp/samples/simpleform/sform.xml
  
  Index: sform.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <page>
  
    <resources>
       <resource type="file" href="descriptor.xml">Descriptor</resource>
       <resource type="doc" href="userdocs/xsp/logicsheet-forms.html">Action &amp; Logicsheet</resource>
    </resources>
  
    <title>Formvalidation and -prefilling</title>
    <content>
  
      <para>
        This page demonstrates the use of the following components:
        <ul>
           <li>FormValidatorAction</li>
           <li>SimpleFormTransformer</li>
           <li>SimpleFormInstanceTransformer</li>
        </ul>
      </para>
  
      <para>
        In general, there is no need to use this particular combination of
        components to achive form validation. Actually, you should consider to
        use the XMLForms components for this rather than the components listed
        above. However, if you feel that XMLForms does not match your
        requirements, this simpler model may be of interest to you. 
      </para>
  
      <para>
        more
      </para>
  
      <form name="person" method="get">
         <form-instance>
            <name>Doe</name>    
            <firstname>John</firstname>
            <address>
              <street>Hollywood Boulevard</street>
              <place>Los Angeles</place>
            </address>
         </form-instance>
         
         <para>
           Please enter your name: <input type="text" size="20" name="person/firstname"/>
           <input type="text" size="20" name="person/name"/>
         </para>
  
         <para>
           Your address: <input type="text" size="30" name="person/address/street"/>
         </para>
         <para>
           <input type="text" size="30" name="person/address/place"/>
         </para>
         <para>
           <input type="submit" name="validate" value="validate input"/>
         </para>
  
         <error name="*" when="ok"><para>All went <b>well.</b></para></error>
         <error name="*" when-ge="error"><para>An <b>error</b> occurred.</para></error>
  
      </form>
  
    </content>
  </page>
  
  
  
  1.1                  xml-cocoon2/src/webapp/samples/simpleform/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
  
  <!-- ========================= Components ================================ -->
  
   <map:components>
    <map:generators default="file"/>
  
    <map:transformers default="xslt">
  
     <!-- This transformer is used to extract the form instance data from the xml document. See
          the javadocs of this class for more information on the default configuration and 
          configuration options.
          The instance data is stored as an attribute with the same name as the form using an
          output module. Here we decide to use the RequestAttributeMap module. This would allows
          a) to store instances for several forms and b) to access a particular instance and value
          using JXPath syntax.
          Per default, the map key is the name of the form as is the root node of the new Document.
      -->
     <map:transformer name="sfinstance" 
                      logger="sitemap.transformer.simpleform" 
                      src="org.apache.cocoon.transformation.SimpleFormInstanceExtractionTransformer">
         <output name="request-attr-map"/>
     </map:transformer>
  
     <!-- the SimpleFormTransformer acts upon HTML4 form element tags and replaces their
          value attribute or their content in case of the textarea element with data obtained
          from an input module attribute with the same name. In addition, it checks the result 
          of the FormValidatorAction when it encounters <error/> tags and includes / excludes
          them depending on the result. 
  
          While many configuration options are available at run time, the input module has
          to be configured at declaration time. Thus a second instance of the SimpleFormTransformer
          is needed.
  
          How is the instance data accessed?
          If the user submitted data, those parameters shall be used, otherwise,
          it is stored as Document (DOM) in a Map that is stored in a request attribute.
          Thus, first a request attribute is read, passing a fixed attribute name because the name 
          of the map is fixed. This is the default name for attributes set by the RequestAttributeMap
          module.
          Next, a JXPath expression is applied to this map. The expression is the name attribute of the
          HTML form tag currently transformed! Since both map key and root node is the same (here: "person"),
          and we don't want to reflect this in our HTML form, the simplemap input module is used to
          prepend the string "/person/" to the jxpath expression.
      -->
     <map:transformer name="simpleform" 
                      logger="sitemap.transformer.simpleform" 
                      src="org.apache.cocoon.transformation.SimpleFormTransformer">
      <input-module name="chain">
         <input-module name="request-param"/>
         <input-module name="simplemap">
            <prefix>/person/</prefix>
            <input-module name="jxpath">
              <!-- "jxpath" does not pass the attribute name to the module it
                   obtains the value to act from. Thus an additional attribute
                   name needs to be injected. 
              -->
              <from-parameter>org.apache.cocoon.components.modules.output.OutputModule</from-parameter>
              <input-module name="request-attr"/>
            </input-module>
         </input-module>
      </input-module>
     </map:transformer>
     
    </map:transformers>
    
    
    <map:readers default="resource"/>
    <map:serializers default="html"/>
    <map:matchers default="wildcard"/>
    <map:selectors default="browser"/>
   </map:components>
  
  <!-- =========================== Resources ================================= -->
  
   <map:resources>
    <map:resource name="dynamic-page">
       <map:generate src="{target}.xsp" type="serverpages"/>
       <map:transform src="context://samples/stylesheets/dynamic-page2html.xsl">
          <map:parameter name="servletPath" value="{request:servletPath}"/>
          <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
          <map:parameter name="contextPath" value="{request:contextPath}"/>
          <map:parameter name="file" value="{target}.xsp"/>
          <map:parameter name="remove" value="{remove}"/>
       </map:transform>
       <map:serialize/>
    </map:resource>
   </map:resources>
  
  <!-- =========================== Views =================================== -->
  
   <map:views>
    <map:view name="content" from-label="content">
     <map:serialize type="xml"/>
    </map:view>
  
    <map:view name="pretty-content" from-label="data">
      <map:transform src="context://samples/common/style/xsl/html/simple-xml2html.xsl"/>
      <map:serialize type="html"/>
    </map:view>
    
    <map:view name="links" from-position="last">
     <map:serialize type="links"/>
    </map:view>
  
   </map:views>
  
  <!-- =========================== Pipelines ================================= -->
  
   <map:pipelines>
  
    <map:pipeline>
  
     <map:match pattern="">
       <map:redirect-to uri="simpleform"/>
     </map:match>
     
     <!-- ============ form validation using xsp and logicsheet ============== -->
  
     <map:match pattern="formval">
       <map:act type="form-validator">
          <map:parameter name="descriptor" value="descriptor.xml"/>
          <map:parameter name="validate-set" value="car-reservation"/>
          <map:call resource="dynamic-page">
             <map:parameter name="target" value="OK"/>
             <map:parameter name="remove" value="{../0}"/>
          </map:call>
       </map:act>
       <map:call resource="dynamic-page">
          <map:parameter name="target" value="ERROR"/>
          <map:parameter name="remove" value="{0}"/>
       </map:call>
     </map:match>
  
  
     <!-- ============ form validation using transformers ======================== -->
  
     <map:match pattern="*">
  
      <!-- Check the request parameters using the FormValidatorAction -->
      <map:act type="form-validator">
        <!-- parameters to the action -->
        <!-- file that contains the validation rules and rule sets -->
        <map:parameter name="descriptor" value="descriptor.xml"/>
        <!-- rule set to use -->
        <map:parameter name="validate-set" value="testform"/>
        
        <!-- this is only applied if the validation has been successful -->
        <!--map:generate src="success.xml"/>
        <map:transform type="simpleform"/>
        <map:transform src="context://samples/stylesheets/page/simple-page2html.xsl">
           <map:parameter name="servletPath" value="{request:servletPath}"/>
           <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
           <map:parameter name="contextPath" value="{request:contextPath}"/>
           <map:parameter name="file" value=".xml"/>
        </map:transform>
        <map:serialize/-->
        <!-- because of the above serializer the "success" pipeline ends here. -->
  
      </map:act>
      <!-- continue processing -->
      <!-- since the "success" pipeline ends with a serializer, the following is only 
           applied if validation has not been successful.
       -->
  
      <map:generate type="file" src="{1}.xml"/>    
      <map:transform type="sfinstance"/> <!-- extract the instance data -->
      <map:transform type="simpleform"/><!-- fill in the instance data, request parameters, and error tags -->
       <map:transform src="context://samples/stylesheets/page/simple-page2html.xsl">
          <map:parameter name="servletPath" value="{request:servletPath}"/>
          <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
          <map:parameter name="contextPath" value="{request:contextPath}"/>
          <map:parameter name="file" value=".xml"/>
       </map:transform>
      <map:serialize/>
     </map:match>
          
    </map:pipeline>
   </map:pipelines>
  
  </map:sitemap>
  
  <!-- end of file -->
  
  
  
  1.1                  xml-cocoon2/src/webapp/samples/simpleform/success.xml
  
  Index: success.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <page>
    <title>Formvalidation and -prefilling</title>
    <content>
  
      <para>
        The entered data successfully passed the validation stage.
      </para>
  
  
      <form name="testform" method="get">
         <para>
           <input type="text" size="20" name="person/firstname" readonly="true"/>
           <input type="text" size="20" name="person/name" readonly="true"/>
         </para>
  
         <para>
           <input type="text" size="30" name="person/address/street" readonly="true"/>
         </para>
         <para>
           <input type="text" size="30" name="person/address/place" readonly="true"/>
         </para>
         <error name="*" when="ok"><para>All went <b>well.</b></para></error>
      </form>
  
    </content>
  </page>
  
  
  
  1.2       +84 -17    xml-cocoon2/src/webapp/samples/stylesheets/page/simple-page2html.xsl
  
  Index: simple-page2html.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/stylesheets/page/simple-page2html.xsl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- simple-page2html.xsl	2 Jul 2002 13:06:41 -0000	1.1
  +++ simple-page2html.xsl	31 Jan 2003 16:40:40 -0000	1.2
  @@ -2,34 +2,101 @@
   
   <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
   
  -  <xsl:param name="view-source"/>
  -  <xsl:param name="path">../</xsl:param>
  +  <xsl:param name="servletPath" select="string('/samples')"/>
  +  <xsl:param name="sitemapURI"/>
  +  <xsl:param name="file"/><!-- relative path to file or file suffix -->
  +  <xsl:param name="remove"/><!-- path to remove from servletPath -->
  +  <xsl:param name="contextPath" select="string('/cocoon')"/>
  +
  +  <xsl:variable name="realpath">
  +    <xsl:choose>
  +      <xsl:when test="$remove=''">
  +        <xsl:value-of select="$servletPath"/>        
  +      </xsl:when>
  +      <xsl:otherwise>
  +        <xsl:value-of select="substring-before($servletPath,$remove)"/>        
  +      </xsl:otherwise>
  +    </xsl:choose>
  +  </xsl:variable>
  +  <xsl:variable name="path" select="concat($contextPath,'/samples/view-file?filename=')"/>
  +  <xsl:variable name="view-source" select="concat($realpath,$file)"/>
  +  <xsl:variable name="directory" select="substring-before($servletPath,$sitemapURI)"/>
  +  <!-- assume that sitemapURIs don't occur in servletPath more than once -->
  +  <xsl:variable name="sitemap" select="concat($directory,'sitemap.xmap')"/>
   
     <xsl:template match="page">
      <html>
  +     <link rel="stylesheet" href="{concat($contextPath,'/samples/samples.css')}" title="Default Style"/>
       <head>
        <title>
         <xsl:value-of select="title"/>
        </title>
       </head>
  -    <body bgcolor="white" alink="red" link="blue" vlink="blue">
  -     <xsl:apply-templates/>
  +    <body>
  +      <xsl:call-template name="resources"/>
  +      <xsl:apply-templates/>
  +      <xsl:call-template name="footer"/>
       </body>
      </html>
     </xsl:template>
   
  +  <xsl:template name="footer">
  +    <div class="footer">
  +      <table>
  +        <tbody>
  +          <tr><td>Source:  </td><td>$COCOON<xsl:value-of select="$view-source"/></td></tr>
  +          <tr><td>Sitemap: </td><td>$COCOON<xsl:value-of select="$sitemap"/></td></tr>
  +        </tbody>
  +      </table>
  +    </div>
  +  </xsl:template>
  +
  +  <xsl:template name="resources">
  +    <div class="resources">
  +      <table width="100%">
  +        <tbody>
  +          <tr>
  +            <td>
  +              <a target="_blank" href="{concat($contextPath,$servletPath,'?cocoon-view=content')}">Content</a>
  +            </td>
  +            <td>
  +              <a target="_blank" href="{concat($path,$view-source)}">Source</a>
  +            </td>
  +            <td>
  +              <a target="_blank" href="{concat($path,$sitemap)}">Sitemap</a>
  +            </td>
  +            <xsl:for-each select="resources/resource">
  +              <td class="{@type}">
  +                <xsl:choose>
  +                  <xsl:when test="@type='file'">
  +                    <a target="_blank" href="{concat($path,$directory,@href)}">
  +                      <xsl:apply-templates/>
  +                    </a>
  +                  </xsl:when>
  +                  <xsl:when test="@type='doc'">
  +                    <a target="_blank" href="{concat($contextPath,'/documents/',@href)}">
  +                      <xsl:apply-templates/>
  +                    </a>
  +                  </xsl:when>
  +                  <xsl:otherwise>
  +                    <a target="_blank" href="{concat($contextPath,'/',@href)}">
  +                      <xsl:apply-templates/>
  +                    </a>
  +                  </xsl:otherwise>
  +                </xsl:choose>
  +              </td>
  +            </xsl:for-each>
  +          </tr>
  +        </tbody>
  +      </table>
  +    </div>
  +  </xsl:template>
  +
  +  <xsl:template match="resources"/>
  +
     <xsl:template match="title">
  -   <h2 style="color: navy; text-align: center">
  -      <xsl:if test="not($view-source)">
  -         <xsl:apply-templates/>
  -      </xsl:if>     
  -      <xsl:if test="$view-source">
  -      <A>
  -        <xsl:attribute name="HREF"><xsl:value-of select="$path"/>view-source?filename=/<xsl:value-of select="$view-source"/></xsl:attribute>
  - 		 <xsl:attribute name="TARGET">_blank</xsl:attribute>
  -         <xsl:apply-templates/>
  -      </A>
  -      </xsl:if>     
  +   <h2>
  +     <xsl:apply-templates/>
      </h2>
     </xsl:template>
     
  @@ -38,8 +105,8 @@
     </xsl:template>
   
     <xsl:template match="para">
  -   <p align="left">
  -    <i><xsl:apply-templates/></i>
  +   <p>
  +     <xsl:apply-templates/>
      </p>
     </xsl:template>
   
  
  
  
  1.4       +6 -2      xml-cocoon2/src/webapp/samples/sub/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/sub/sitemap.xmap,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- sitemap.xmap	20 Oct 2002 12:25:45 -0000	1.3
  +++ sitemap.xmap	31 Jan 2003 16:40:40 -0000	1.4
  @@ -24,7 +24,9 @@
   
      <map:match pattern="welcome">
       <map:generate src="docs/samples.xml"/>
  -    <map:transform src="stylesheets/simple-samples2html.xsl"/>
  +    <map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
  +       <map:parameter name="contextPath" value="{request:contextPath}"/>
  +    </map:transform>
       <map:serialize/>
      </map:match>
   
  @@ -120,7 +122,9 @@
      <!-- Test error handler in parent sitemap -->
      <map:match pattern="generror">
       <map:generate src="docs/error-giving-page.xml"/>
  -    <map:transform src="stylesheets/simple-samples2html.xsl"/>
  +    <map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
  +       <map:parameter name="contextPath" value="{request:contextPath}"/>
  +    </map:transform>
       <map:serialize/>
      </map:match>
   
  
  
  

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


Mime
View raw message