home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-cocoon-addon-1.4.9-installer.exe / sitemap-working-draft.xmap < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  20.7 KB  |  572 lines

  1. <?xml version="1.0"?>
  2. <!--
  3.   Copyright 1999-2004 The Apache Software Foundation
  4.  
  5.   Licensed under the Apache License, Version 2.0 (the "License");
  6.   you may not use this file except in compliance with the License.
  7.   You may obtain a copy of the License at
  8.  
  9.       http://www.apache.org/licenses/LICENSE-2.0
  10.  
  11.   Unless required by applicable law or agreed to in writing, software
  12.   distributed under the License is distributed on an "AS IS" BASIS,
  13.   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.   See the License for the specific language governing permissions and
  15.   limitations under the License.
  16. -->
  17.  
  18. <!-- =============== Cocoon Sitemap Working Draft ============================
  19.  
  20. This document contains an example used as a working draft for 
  21. Cocoon architects to test and understand the issues associated with 
  22. sitemaps and XML publishing in general. It must be considered as a working 
  23. draft and may be updated at any time.
  24.  
  25. This document is based on ideas and design patterns inspired by Stefano 
  26. Mazzocchi <stefano@apache.org> and Pierpaolo Fumagalli <pier@apache.org>
  27. but grew as a collaborative effort to provide a solid foundation of
  28. design patterns and usability guidelines to the Cocoon Publishing 
  29. Framework.
  30.  
  31. The goal of the sitemap is to allow non-programmers to create web sites
  32. and web applications built from logic components and XML documents.
  33.  
  34. It finds inspiration from both Apache's httpd.conf/.htaccess files as well
  35. as from Servlet API 2.2 WAR archives. It uses concepts such as Cascading
  36. from W3C CSS, as well as declarative approaches integrated into the W3C 
  37. XSLT language. It also uses some element/attribute equivalence patterns
  38. used in W3C RDF.
  39.  
  40. The following goals were identified as engineering constraints:
  41.  
  42.  - minimal verbosity is of maximum importance.
  43.  - the schema should be sufficiently expressive to allow learning by
  44.    examples.
  45.  - sitemap authoring should not require assistive tools, but be
  46.    sufficiently future-compatible to allow them.
  47.  - sitemaps must scale along with the site and should not impose growth
  48.    limitation to the site as a whole nor limit its administration with size
  49.    increase.
  50.  - sitemaps should contain all the information required to Cocoon to
  51.    generate all the requests it receives.
  52.  - sitemaps should contain information for both dynamic operation as
  53.    well as offline static generation.
  54.  - uri mapping should be powerful enough to allow every possible mapping
  55.    need.
  56.  - basic web-serving functionalities (redirection, error pages,
  57.    resource authorisation) should be provided.
  58.  - sitemaps should not limit Cocoon's intrinsic modular extensibility.
  59.  - resources must be matched with all possible state variables, not
  60.    only with URI (http parameters, environment variables, server
  61.    parameters, time, etc...).
  62.  - sitemaps should embed the notion of "semantic resources" to be
  63.    future-compatible with sematic crawling and indexing.
  64.  - sitemaps should be flexible enough to allow a complete web site to
  65.    be built with Cocoon.
  66.  - sitemaps should include the notion of "multi-dimensional resource views"
  67.    even if HTTP doesn't provide them explicitly.
  68.  - sitemaps should include the ability to provide resource creation tracing 
  69.    and error handling.
  70.  
  71.   The default namespaces are used mainly for versioning, instead of using 
  72.   attributes such as version="1.0" which could create confusion. People are 
  73.   used to writing URIs with no spelling mistakes, while versioning could be 
  74.   used for their own sitemap versions and this might break operation.
  75.   
  76.   The versioning schema will be "major.minor" where major will be increased
  77.   by one each time a new release breaks back compatibility, while minor
  78.   is increased each time a change has been made that doesn't create
  79.   back incompatible problems.
  80.  
  81.   The syntax
  82.     
  83.       <xxx map:value="yyy">
  84.       
  85.   is deprecated (and not supported) in favor of
  86.     
  87.       <xxx>yyy</xxx>
  88.       
  89. ============================================================================ -->
  90.  
  91. <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
  92.              xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
  93.              xsi:schemaLocation="sitemap-working-draft.xsd">
  94. <!--         xsi:schemaLocation="http://apache.org/cocoon/sitemap/1.0/schema"> -->
  95.  
  96. <!-- =========================== Components ================================ --> 
  97.  
  98.  <map:components>
  99.  
  100.    <!-- 
  101.        Generators generate XML content as SAX events and initialize the 
  102.        pipeline processing.
  103.    -->
  104.   <map:generators default="parser">
  105.    <map:generator name="parser" src="class:///org.apache.cocoon.generation.FileGenerator" label="content"/>
  106.    <map:generator name="dir"    src="file:///home/mystuff/java/MyDirGenerator.class"     label="content"/>
  107.    <map:generator name="serverpages"    src="class:///org.apache.cocoon.generation.XSPGenerator" label="content">
  108.     ...
  109.    </map:generator>
  110.   </map:generators>
  111.  
  112.    <!-- 
  113.        Transformers transform SAX events in SAX events.
  114.    -->
  115.   <map:transformers default="xslt">
  116.    <map:transformer name="xslt" src="class:///org.apache.cocoon.transformation.XSLTTransformer">
  117.     <compile-stylesheets>true</compile-stylesheets>
  118.    </map:transformer>
  119.    <map:transformer name="xinclude" src="class:///org.apache.cocoon.transformation.XIncludeTransformer" label="content"/>
  120.    <map:transformer name="schema" src="class:///org.apache.cocoon.transformation.SchemaLoader"/>
  121.    <map:transformer name="rdf" src="class:///org.apache.cocoon.transformation.RDFizer"/>
  122.   </map:transformers>
  123.  
  124.    <!--  
  125.        Readers generate and serialize directly from a resource in binary or char streams for  
  126.        final client consumption. 
  127.    --> 
  128.   <map:readers default="binary">
  129.    <map:reader name="binary" mime-type="image/svg" src="class:///org.apache.cocoon.reading.BinaryReader"/> 
  130.   </map:readers> 
  131.  
  132.    <!--  
  133.        Serializers serialize SAX events in binary or char streams for  
  134.        final client consumption. 
  135.    --> 
  136.   <map:serializers default="html">
  137.    <map:serializer name="html" mime-type="text/html" src="class:///org.apache.cocoon.serialization.HTMLSerializer">
  138.     <doctype-public>-//W3C//DTD HTML 4.0 Transitional//EN</doctype-public>
  139.     <doctype-system>http://www.w3.org/TR/REC-html40/loose.dtd</doctype-system>
  140.     <preserve-space>true"</preserve-space>
  141.     <encoding>UTF-8"</encoding>
  142.     <indent>1</indent>
  143.     <colors>
  144.      <foreground>white</foreground>
  145.      <borders>
  146.       <left>blue</left>
  147.       <right>red</right>
  148.      </borders>
  149.      <text>black</text>
  150.      <lines>
  151.       <left>cyan</left>
  152.       <right>orange</right>
  153.      </lines>
  154.      <background>green</background>
  155.     </colors>
  156.     <foo>bar</foo>
  157.     <baz>foobar</baz>
  158.     <line-width>120</line-width>
  159.    </map:serializer>
  160.  
  161.    <map:serializer name="wap" mime-type="text/vnd.wap.wml" src="class:///org.apache.cocoon.serialization.XMLSerializer">
  162.     <doctype-public>-//WAPFORUM//DTD WML 1.1//EN</doctype-public>
  163.     <doctype-system>http://www.wapforum.org/DTD/wml_1.1.xml</doctype-system>
  164.     <encoding>UTF-8</encoding>
  165.    </map:serializer>
  166.  
  167.    <map:serializer name="svg2jpg" mime-type="image/jpg" src="class:///org.apache.cocoon.serialization.SVGSerializer">
  168.     <format>jpg</format>
  169.     <compression-level>80%</compression-level>
  170.    </map:serializer>
  171.  
  172.    <map:serializer name="svg2png" mime-type="image/png" src="class:///org.apache.cocoon.serialization.SVGSerializer">
  173.     <format>png</format>
  174.     <color-depth>24</color-depth>
  175.    </map:serializer>
  176.   </map:serializers>
  177.   
  178.    <!-- 
  179.        Selectors are classes that contain programming logic that perform
  180.        boolean evaluation based on environment state during the call (state
  181.        includes request parameters, machine state as well as any other
  182.        accessible information)
  183.        
  184.        Selectors can only respond with true/false when called.
  185.    -->
  186.   <map:selectors default="browser">
  187.    <map:selector name="load" src="class:///org.apache.cocoon.selection.MachineLoadSelector">
  188.     ...
  189.    </map:selector>
  190.  
  191.    <map:selector name="user" src="class:///org.apache.cocoon.selection.AuthenticationSelector">
  192.     ...
  193.    </map:selector>
  194.  
  195.    <map:selector name="ip-filter" src="class:///org.apache.cocoon.selection.IPFilterSelector">
  196.     ...
  197.    </map:selector>
  198.  
  199.    <map:selector name="browser" factory="org.apache.cocoon.selection.BrowserSelector">
  200.     ...
  201.    </map:selector>
  202.   </map:selectors>
  203.  
  204.    <!--
  205.        Matchers are classes that are able to test if the request parameters
  206.        match the given pattern and, if this is the case, they are able to
  207.        return a Map of tokens that resulted from the matching or any
  208.        depending on the matcher own logic (this is up to the matcher implementation).
  209.    -->
  210.   <map:matchers default="uri-wildcard">
  211.    <map:matcher name="uri-wildcard" src="org.apache.cocoon.matching.WildcardURIMatcher">
  212.     ...
  213.    </map:matcher>
  214.  
  215.    <map:matcher name="uri-regexp" factory="org.apache.cocoon.matching.RegexpURIMatcher">
  216.     ...
  217.    </map:matcher>
  218.  
  219.    <map:matcher name="browser" src="org.apache.cocoon.matching.BrowserMatcher">
  220.     <foo>bar</foo>
  221.     <lines>
  222.      <left>red</left>
  223.      <right>white</right>
  224.     </lines>
  225.    </map:matcher>
  226.   </map:matchers>
  227.  
  228.    <!--
  229.        Action are classes that are able to modify the underlying application model and
  230.        are meant as extensions to the sitemap functionality. They get access to the
  231.        objectModel containing all objects that make up a request. An Action can return 
  232.        a Map of tokens that resulted from the processing logic (this is up to the action
  233.        implementation). An Action is references in the pipeline section with the type 
  234.        attribute as it is with all the other sitemap components.
  235.    -->
  236.   <map:actions>
  237.    <map:action name="session-validator" src="org.apache.cocoon.acting.SessionValidationAction">
  238.     ...
  239.    </map:action>
  240.  
  241.    <map:action name="db-adder"    src="org.apache.cocoon.acting.DBAddingAction">
  242.     <db-connection>postgresql-connection</db-connection>
  243.    </map:action>
  244.  
  245.    <map:action name="db-modifier" src="org.apache.cocoon.acting.DBModifyingAction"/>
  246.     <db-connection>postgresql-connection</db-connection>
  247.    </map:action>
  248.  
  249.    <map:action name="db-delete"   src="org.apache.cocoon.acting.DBDeletingAction"/>
  250.     <db-connection>postgresql-connection</db-connection>
  251.    </map:action>
  252.  
  253.    <map:action name="form-dispatcher" src="org.apache.cocoon.acting.FormDispatcherAction"/>
  254.     <layout-description>somewhere/layout-employee-app</layout-description>
  255.    </map:action>
  256.  
  257.   </map:actions>
  258.  
  259.  </map:components>
  260.  
  261. <!-- =========================== Views =================================== -->
  262.  
  263.  <!--
  264.      the <view> element introduces the notion of multi-dimensional resource
  265.      views which are an extension to the HTTP paradigm of web resources. Views
  266.      do not increase sitemap functionality, but allow substantial verbosity
  267.      reduction and should help users in the creation of complex sitemaps that
  268.      are able to produce different views of the resource they handle for each
  269.      "aspect" requested.
  270.  
  271.      Views can be pictured as generator-less pipelines which use, as a generator,
  272.      the result of another pipeline from the "label" they indicate or from the
  273.      position (first/last) in the pipeline.
  274.  
  275.      Labels can be seen as non-standard exit points from the normal pipelines
  276.      and "first" identifies the position right after the generator while "last
  277.      indentifies the position right before the serializer.
  278.  
  279.      Both generators and transformers are allowed to attach a default label to
  280.      them. If no <label> element is explicitly indicated, the sitemap handler
  281.      will scan for default labels attached to the components, starting from the
  282.      serializer and going backward, until it finds a component to start.
  283.      If none is found, the generator is assumed to be the view generator.
  284.   -->
  285.  <map:views>
  286.  
  287.   <map:view name="content" from-position="first">
  288.    <map:serialize type="xml"/>
  289.   </map:view>
  290.  
  291.   <map:view name="schema" from-label="content">
  292.    <map:transform type="schema"/>
  293.    <map:serialize type="xml"/>
  294.   </map:view>
  295.  
  296.   <map:view name="semantics" from-label="content">
  297.    <map:transform type="rdf"/>
  298.    <map:serialize type="xml"/>
  299.   </map:view>
  300.  
  301.   <map:view name="hyperlinks" from-position="last">
  302.    <map:transform src="./stylesheets/xlink-filter.xsl"/>
  303.    <map:serialize type="xml"/>
  304.   </map:view>
  305.  
  306.  </map:views>
  307.  
  308. <!-- =========================== Resources ================================= -->
  309.  
  310.  <!--
  311.      the <resource> element is used as a placeholder for pipelines
  312.      that are used several times inside the document. This element
  313.      is redundant and its functionality is not directly related
  314.      to the sitemap, but could be cloned by the use of internal
  315.      XInclude, for example
  316.  
  317.          <xinclude:include href="#xpointer(resource[@name='Access refused'])"/>
  318.  
  319.      but given the usability constraints and very specific operation
  320.      it is much easier to include such an element instead of forcing
  321.      the use of xinclude/xpointer.
  322.  -->
  323.  <map:resources>
  324.  
  325.   <map:resource name="Access refused">
  326.    <map:generate src="./error-pages/restricted.xml"/>
  327.    <map:transform src="./stylesheets/general-browser.xsl"/>
  328.    <map:serialize status-code="401"/>
  329.   </map:resource>
  330.  
  331.  </map:resources>
  332.  
  333. <!-- ========================== Action Sets ================================ -->
  334.  
  335.  <!--
  336.      the <action-set> element is used as a collection of related actions
  337.      that are used either several times inside the pipelines or in conjuction
  338.      with form actions which are selected by the sitemap for processing.
  339.      These action-sets are referenced in the pipeline section by using a
  340.      set attribute instead of a type attribute.
  341.      All the tokens returned by the individual actions in a action-set are
  342.      collected by the sitemap engine into one big map which can be used as
  343.      replacements in src attributes from generators/transformers.
  344.  -->
  345.  <map:action-sets>
  346.  
  347.   <!--
  348.       The following action-set defines:
  349.       a) a "session-validator" action which will be executed whenever this
  350.          action-set is referenced in a pipeline.
  351.       b) several "db-*" action which have a additional action attribute which the
  352.          sitemap engine uses as a value to compare against the action value supplied
  353.          from the Environment object. Every action with a matching action value will
  354.          be processed.
  355.       c) a "form-dispatcher" action which will tell the sitemap which is the
  356.          next resource to display (usually used for the generator in charge).
  357.   -->
  358.   <map:action-set name="employee-form">
  359.    <map:act type="session-validator"/>
  360.    <map:act type="db-adder"    action="Add"/>
  361.    <map:act type="db-modifier" action="Update"/>
  362.    <map:act type="db-deleter"  action="Delete"/>
  363.    <map:act type="form-dispatcher"/>
  364.   </map:action-set>
  365.  
  366.  </map:action-sets>
  367.  
  368. <!-- =========================== Pipelines ================================= -->
  369.  
  370.  <map:pipelines>
  371.   <map:pipeline>
  372.  
  373.    <!--
  374.        Mount points allow sitemaps to be cascaded and site management
  375.        workload to be parallelized. 
  376.      --> 
  377.    <map:match pattern="cocoon/*"> 
  378.     <map:mount uri-prefix="cocoon/{1}" check-reload="yes"
  379.       src="cvs:pserver:anonymous@xml.apache.org://home/cvs/cocoon/xdocs/{1}"/> 
  380.    </map:match> 
  381.    
  382.    <map:match pattern="bugs/*"> 
  383.     <map:mount uri-prefix="bugs/{1}" check-reload="true"
  384.       src="jar://apps/bugs.cocoon#{1}"/> 
  385.    </map:match> 
  386.  
  387.    <map:match pattern="dist/*"> 
  388.     <map:mount uri-prefix="dist/{1}" check-reload="false"  src="./dist/{1}"/> 
  389.    </map:match>
  390.  
  391.    <map:match pattern="faq/*"> 
  392.     <map:mount uri-prefix="faq/{1}" check-reload="no"
  393.       src="jar://apps/faq-o-matic.cocoon#{1}"/> 
  394.    </map:match> 
  395.  
  396.    <map:match type="uri-regexp" pattern="^/xerces-(j|c|p)/(.*)$">
  397.     <map:mount uri-prefix="/xerces-{1}/{2}"
  398.       src="cvs:pserver:anonymous@xml.apache.org://home/cvs/xerces-{1}/xdocs/{2}"/>
  399.    </map:match>
  400.  
  401.    <map:handle-errors> 
  402.     <map:serialize type="html"/>   
  403.    </map:handle-errors> 
  404.     
  405.   </map:pipeline> 
  406.    
  407.   <map:pipeline>
  408.  
  409.    <!-- 
  410.         Matchers declarative dispatch the requests to the pipelines that
  411.         match some of their parameters
  412.      -->
  413.    <map:match pattern="cocoon/dist/*"> 
  414.     <map:select type="ip-filter">
  415.      <map:when test="allowsAddress()">
  416.       <!--
  417.           the <redirect-to> element is used to redirect one requested URI 
  418.           to another. This is somewhat equivalent to URI rewriting.
  419.         -->
  420.       <map:redirect-to uri="dist/cocoon/{1}"/>
  421.      </map:when>
  422.      <map:otherwise>
  423.       <map:redirect-to resource="Access refused"/>
  424.      </map:otherwise>
  425.     </map:select>
  426.    </map:match>
  427.    
  428.    <!-- 
  429.         When no "type" attribute is present, the sitemap intepreter will use the
  430.         default one, this allows a very compact and user friendly syntax as the
  431.         one below 
  432.      -->
  433.    <map:match pattern="printer-friendly/*">
  434.     <map:generate src="{1}.xml"/>
  435.     <map:transform src="./stylesheet/printer-friendly.xsl"/>
  436.     <map:serialize/>
  437.    </map:match>
  438.  
  439.    <map:match pattern="images/logo">
  440.     <map:select>
  441.      <map:when test="accepts('image/svg')">
  442.       <!-- 
  443.          the <map:read> element is used to read the src directly without 
  444.          applying any processing. This is mostly useful when clients
  445.          are capable of handling XML content directly.
  446.         -->
  447.       <map:read src="./images/logo.svg"/>
  448.      </map:when>
  449.      <map:otherwise>
  450.       <map:generate src="./images/logo.svg"/>
  451.       <map:select>
  452.        <map:when test="accepts('image/png')">
  453.         <map:serialize type="svg2png"/>
  454.        </map:when>
  455.        <map:otherwise>
  456.         <map:serialize type="svg2jpg"/>
  457.        </map:otherwise>
  458.       </map:select>
  459.      </map:otherwise>
  460.     </map:select>
  461.    </map:match>
  462.   
  463.    <map:match pattern="restricted/*">
  464.     <map:select type="user">
  465.      <map:when test="is('administrator')">
  466.       <map:generate src="./restricted/{1}"/>
  467.       <map:transform src="./stylesheets/restricted.xsl"/>
  468.       <map:serialize/>
  469.      </map:when>
  470.      <map:otherwise>
  471.       <map:redirect-to resource="Access refused"/>
  472.      </map:otherwise>
  473.     </map:select>
  474.    </map:match>
  475.  
  476.    <!--
  477.        Example to show the notion of pipeline labels for view generation.
  478.      -->
  479.    <map:match pattern="labelled/*">
  480.     <map:label name="links">
  481.      <map:label name="content">
  482.       <map:generate src="./slides/{1}"/>
  483.      </map:label>
  484.      <map:transform src="./filters/add-navigation-links.xsl"/>
  485.     </map:label>
  486.     <map:transform src="./stylesheet/slides2html.xsl"/>
  487.     <map:serialize/>
  488.    </map:match>
  489.  
  490.    <!--
  491.        Complex example to show how some xpath-like syntax is used to get access
  492.        to the pattern tokens generated by the matchers.
  493.      -->
  494.    <map:match pattern="nested-matchers/*">
  495.     <map:match type="browser" pattern="name('Mozilla ?\\?*')">
  496.      <map:mount uri-prefix="nested-matchers/{1}"
  497.        src="file:///home/www/mozilla-{1}-{2}/{../1}"/>
  498.     </map:match>
  499.    </map:match>
  500.  
  501.    <map:match type="uri-regexp" pattern="([0-9]{4})/([0-9]{2})/([0-9]{2})/">
  502.     <!--
  503.          Here we implement the ability to indicate semantic information
  504.          on the processed URI. This is mostly used to avoid to encode
  505.          URI specific information in the XSP since the sitemap maintainer
  506.          is the only one responsible to manage the URI space. This removes
  507.          a URI contract between the XSP writer and the URI space manager,
  508.          moving it to parameter names which normally change less frequently.
  509.     -->
  510.     <map:parameter name="year" value="{1}"/>
  511.     <map:parameter name="month" value="{2}"/>
  512.     <map:parameter name="day" value="{3}"/>
  513.  
  514.     <map:generate type="serverpages" src="./dailynews.xsp"/>
  515.     <map:transform src="./stylesheet/{1}/news.xsl"/>
  516.     <map:serialize/>
  517.    </map:match>
  518.  
  519.    <!--
  520.        Here we show the use of action-sets. The scenario used is a form
  521.        generated which enables the visitor to add, modify and delete entries
  522.        in an employee database
  523.    -->
  524.    <map:match pattern="form/employee">
  525.     <map:act set="employee-form">
  526.      <map:generate src="forms/{next-form}.xml"/>
  527.      <map:transform src="forms2html.xsl"/>
  528.      <map:serialize/>
  529.     </map:act>
  530.    </map:match>
  531.  
  532.  
  533.    <map:match pattern="*">
  534.     <map:generate src="{1}.xml"/>
  535.     <map:select type="load">
  536.      <map:when test="greaterThen('2.5')">
  537.       <map:transform src="./stylesheet/low-graphics.xsl"/>
  538.      </map:when>
  539.      <map:otherwise>
  540.       <map:select>
  541.        <map:when test="is('Mozilla5')">
  542.         <map:transform src="./stylesheet/xul-enabled.xsl"/>
  543.        </map:when>
  544.        <map:otherwise>
  545.         <map:transform src="./stylesheet/general-browser.xsl"/>
  546.        </map:otherwise>
  547.       </map:select>
  548.      </map:otherwise>
  549.     </map:select>
  550.     <map:serialize/>
  551.    </map:match>
  552.  
  553.    <map:handle-errors>
  554.     <map:select>
  555.      <map:when test="accepts('text/vnd.wap.wml')">
  556.       <map:transform src="./styles/Pipeline2WML.xsl"/>
  557.       <map:serialize type="wap"/>
  558.      </map:when>
  559.      <map:otherwise>
  560.       <map:transform src="./styles/Pipeline2HTML.xsl"/>
  561.       <map:serialize/>
  562.      </map:otherwise>
  563.     </map:select>
  564.    </map:handle-errors>
  565.   
  566.   </map:pipeline>
  567.  </map:pipelines>
  568.     
  569. </map:sitemap>
  570.  
  571. <!-- end of file -->
  572.