You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by ov...@apache.org on 2002/02/01 02:44:14 UTC

cvs commit: xml-cocoon2/src/scratchpad/schecoon/webapp sitemap.xmap

ovidiu      02/01/31 17:44:14

  Modified:    src/scratchpad/schecoon/webapp sitemap.xmap
  Log:
  Added an example of a named resource, and two possible ways to invoke
  it: one dynamically, the other one statically. The function code for
  the resource is now generated correctly, and it is invoked optimally,
  depending on how the resource name is specified.
  
  Revision  Changes    Path
  1.2       +65 -12    xml-cocoon2/src/scratchpad/schecoon/webapp/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/schecoon/webapp/sitemap.xmap,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- sitemap.xmap	19 Jan 2002 00:58:51 -0000	1.1
  +++ sitemap.xmap	1 Feb 2002 01:44:14 -0000	1.2
  @@ -2,22 +2,75 @@
   
   <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
   
  - <map:pipelines>
  +  <map:resources>
   
  -  <map:pipeline>
  +    <map:resource name="document2html">
  +      <map:generate src="{source}" type="file"/>
  +      <map:transform src="stylesheets/document2html.xsl"/>
  +      <map:serialize/>
  +    </map:resource>
   
  -   <map:match pattern="documentation/(.*).html">
  -     <map:generate src="docs/{1}.xml" type="file"/>
  -     <map:transform src="stylesheets/document2html.xsl"/>
  -     <map:serialize/>
  -   </map:match>
  +  </map:resources>
   
  -   <map:match pattern="sites/images/(.*).gif">
  -     <map:read src="{1}.gif" mime-type="image/gif"/>
  -   </map:match>
  +  <map:pipelines>
  +   <map:pipeline>
   
  -  </map:pipeline>
  +      <!-- Simple pipeline which has the pipeline definition inline. -->
  +      <map:match pattern="documentation/(.*).html">
  +        <map:generate src="docs/{1}.xml" type="file"/>
  +        <map:transform src="stylesheets/document2html.xsl"/>
  +        <map:serialize/>
  +      </map:match>
   
  - </map:pipelines>
  +      <!-- Simple pipeline that reads an image from the filesystem -->
  +      <map:match pattern="sites/images/(.*).gif">
  +        <map:read src="{1}.gif" mime-type="image/gif"/>
  +      </map:match>
  +
  +      <!-- An example of calling a pipeline defined as resource. The
  +      name of the pipeline to be invoked is specified in the URL of
  +      the request. To test, send a request to
  +      /schecoon/document/index.html
  +      -->
  +      <map:match pattern="(.*)/(.*).html">
  +        <map:call resource="{1}2html">
  +          <map:parameter name="source" value="docs/{2}.xml"/>
  +        </map:call>
  +      </map:match>
  +
  +      <!-- The above example using a predefined pipeline. The
  +      generated sitemap code will notice that the resource reference
  +      is predefined, and will invoke the function definition for the
  +      resource statically, without doing a dynamic lookup as in the
  +      above example. -->
  +      <map:match pattern="(.*).html">
  +        <map:call resource="document2html">
  +          <map:parameter name="source" value="docs/{1}.xml"/>
  +        </map:call>
  +      </map:match>
  +
  +      <!-- This example invokes a Scheme function, defined using
  +      "function":
  +
  +      (function (my-function sitemap env a b)
  +        ...)
  +
  +      The function's argument names can appear as parameters inside
  +      the <map:param> elements, like below. A parameter defined in
  +      <map:call> using <map:param>, which is not a formal argument of
  +      the Scheme function, is simply ignored (like the "c" parameter
  +      below).
  +
  +      -->
  +      <map:match pattern="function/(.*)">
  +        <map:call function="{1}">
  +          <map:param name="a" value="1"/>
  +          <map:param name="b" value="2"/>
  +          <map:param name="c" value="3"/>
  +        </map:call>
  +      </map:match>
  +
  +    </map:pipeline>
  +  </map:pipelines>
   
   </map:sitemap>
  
  
  

----------------------------------------------------------------------
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