You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ling Kok Choon <ko...@brel.com> on 2001/08/14 08:11:03 UTC

Sitemap and Action

Hi,

  I am developing a WEB Page Content Management System. This system able to create a new web 
page within cocoon2 environment. Because user can add new page, delete page, add folder with the 
content management system, so I will need a dinamic sitemap to handler all the request.

  I start to find out the solution to dinamically generate a sitemap, but fail. But at the time 
i found a very powerfull feature in cocoon2 that is Action. Here is how i use action to get a 
dinamic Sitemap:

Sitemap.xmap

 <map:components>
  ...
  ... 
  <map:actions>
   <!-- here i register my action -->
   <map:action name="path-selector" src="action.PathSelector"/>      
  </map:actions>
 </map:components>
 
 <map:pipelines>
   <map:pipeline>
  
   <!-- here is the aggregation part -- >

   <!-- here is the center part of the aggregation -- >
   <!-- Note: the web page is a aggregated page, it aggregated from 5 smaller part -->   
   <!-- The path-selector action return the requested path URL and XSLPath for this web page -->
   <!-- path-selection action will search the database to get the centerXSLPath and return to
        the sitemap -- >

    <map:match pattern="**.agg">
       <map:act type="path-selector">  
         <map:parameter name="skel"  value="false" /> 
         <map:parameter name="template"  value="1" /> 
         <map:generate src="{path}"/> 
         <map:transform src="{centerXSLPath}"/> 
       </map:act>	       
         <map:serialize type="html"/>       
     </map:match>

    <!-- here is the foot_note of the aggregation page-- >
    <!-- this part will only show the copyright information and address -->
     <map:match pattern="foot_note.xml">
         <map:generate src="xml/foot_note.xml"/> 
         <map:transform src="stylesheet/foot_note.xsl"/>        
         <map:serialize type="html"/>       
     </map:match>
     
    <!-- here is the side_menu of the aggregation page-- >
    <!-- here we use the dummy xml file, because we don't have any infomation to put -->
    <!-- this part is only contain picture and javascript -- >  
     <map:match pattern="side_menu.xml">
         <map:generate src="xml/dummy.xml"/> 
         <map:transform src="stylesheet/side_menu.xsl"/>        
         <map:serialize type="html"/>       
     </map:match>
     
     <!-- here is the Navigation Link of the aggregation page-- >     
     <!-- User may use the Content Management System to select which page will be linked -->
     <!-- and the linked page information will stored in database. -- >
     <!-- This link will be generated according the information from database -- >
     <!-- and we use esql tanglib to connect to the database -- >
     <map:match pattern="links.xml">
          <map:generate type="serverpages" src="xml/link.xsp"/> 
          <map:transform src="stylesheet/links.xsl"/>               
         <map:serialize/>       
     </map:match>
     
    <!-- here is the aggregation mapping -->     
     <map:match pattern="**.xml">
       <map:act type="path-selector"> 
          <map:parameter name="skel"  value="true" />        
      	<map:aggregate element="page" >
      	  <map:part src="{path}" element="maincontent" ns="http://www.brel.com/maincontent"/>    
   	  
      	  <map:part src="foot_note.xml" element="foot_note" ns="http://www.brel.com/foot_note"/> 

      	  <map:part src="side_menu.xml" element="side_menu" ns="http://www.brel.com/side_menu"/> 

      	  <map:part src="links.xml" element="links" ns="http://www.brel.com/links"/> 
      	</map:aggregate>      	
      	<map:transform src="{aggXSLPath}"/> 
       </map:act>	
       
       <map:serialize type="html"/>    	
    </map:match>
   
      
      <map:match pattern="**.gif">
         <map:act type="path-selector">
             <map:read src="{path}" mime-type="image/gif"/>  
         </map:act>          
      </map:match>
      
      <map:match pattern="**.css">
             <map:act type="path-selector">
                 <map:read src="{path}" mime-type="text/css"/>  
             </map:act>          
      </map:match>
      
      <map:match pattern="**.jpg">
              <map:act type="path-selector">
                  <map:read src="{path}" mime-type="image/jpg"/>  
              </map:act>    
      
      </map:match>
      
      <map:match pattern="**.png">
          <map:act type="path-selector">
             <map:read src="{path}" mime-type="image/png"/>  
          </map:act>       
      </map:match>
      
      <map:match pattern="**.swf">
         <map:act type="path-selector">
         <map:read src="{path}" mime-type="application/x-shockwave-flash"/>
         </map:act>       
      </map:match>

      <map:match pattern="**.js">
        <map:act type="path-selector">
           <map:read src="{path}" mime-type="text/javascript"/>
        </map:act>
      </map:match>
      
      
      
      <map:match pattern="**.doc">
        <map:act type="path-selector">
           <map:read src="{path}" mime-type="application/winword"/>
        </map:act>    
      </map:match>
      
      <map:match pattern="**.rtf">
            <map:act type="path-selector">
               <map:read src="{path}" mime-type="application/winword"/>
            </map:act>    
      </map:match>

   <map:match pattern="*">
       <map:act type="path-selector">
           <map:read src="{path}" mime-type="application/winword"/>
       </map:act>    
   </map:match>


I post this mail is to get your opinions and suggestions, is it the right way to solve the 
problem ?


Thank

Kok Choon


--------------------------------------------------------
Name: Ling Kok Choon
E-mail: Ling Kok Choon <ko...@brel.com>
Date: 08/14/01
Time: 14:11:03

This message was sent by Z-Mail Pro - from NetManage
NetManage - delivers Standards Based IntraNet Solutions
--------------------------------------------------------

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: Sitemap and Action

Posted by Sergio Carvalho <se...@acm.org>.
Thanks for sharing your solution. C2 is in its infancy, in terms of user 
base, so the rate of new users is high. Use cases are always helpfull.

Yes, actions are one possible way to do it. They are definitely the 
correct way if you think of CMS in terms of an adapting sitemap.

One other, equally valid solution would be to think of it in terms of a 
configurable generator. In other words, a generator that multiplexes a 
set of datasources, and selects the correct one for each request.


Ling Kok Choon wrote:

> Hi,
> 
>   I am developing a WEB Page Content Management System. This system able to create a new web 
> page within cocoon2 environment. Because user can add new page, delete page, add folder with the 
> content management system, so I will need a dinamic sitemap to handler all the request.
> 
>   I start to find out the solution to dinamically generate a sitemap, but fail. But at the time 
> i found a very powerfull feature in cocoon2 that is Action. Here is how i use action to get a 
> dinamic Sitemap:
> 
> Sitemap.xmap
> 
>  <map:components>
>   ...
>   ... 
>   <map:actions>
>    <!-- here i register my action -->
>    <map:action name="path-selector" src="action.PathSelector"/>      
>   </map:actions>
>  </map:components>
>  
>  <map:pipelines>
>    <map:pipeline>
>   
>    <!-- here is the aggregation part -- >
> 
>    <!-- here is the center part of the aggregation -- >
>    <!-- Note: the web page is a aggregated page, it aggregated from 5 smaller part -->   
>    <!-- The path-selector action return the requested path URL and XSLPath for this web page -->
>    <!-- path-selection action will search the database to get the centerXSLPath and return to
>         the sitemap -- >
> 
>     <map:match pattern="**.agg">
>        <map:act type="path-selector">  
>          <map:parameter name="skel"  value="false" /> 
>          <map:parameter name="template"  value="1" /> 
>          <map:generate src="{path}"/> 
>          <map:transform src="{centerXSLPath}"/> 
>        </map:act>	       
>          <map:serialize type="html"/>       
>      </map:match>
> 
>     <!-- here is the foot_note of the aggregation page-- >
>     <!-- this part will only show the copyright information and address -->
>      <map:match pattern="foot_note.xml">
>          <map:generate src="xml/foot_note.xml"/> 
>          <map:transform src="stylesheet/foot_note.xsl"/>        
>          <map:serialize type="html"/>       
>      </map:match>
>      
>     <!-- here is the side_menu of the aggregation page-- >
>     <!-- here we use the dummy xml file, because we don't have any infomation to put -->
>     <!-- this part is only contain picture and javascript -- >  
>      <map:match pattern="side_menu.xml">
>          <map:generate src="xml/dummy.xml"/> 
>          <map:transform src="stylesheet/side_menu.xsl"/>        
>          <map:serialize type="html"/>       
>      </map:match>
>      
>      <!-- here is the Navigation Link of the aggregation page-- >     
>      <!-- User may use the Content Management System to select which page will be linked -->
>      <!-- and the linked page information will stored in database. -- >
>      <!-- This link will be generated according the information from database -- >
>      <!-- and we use esql tanglib to connect to the database -- >
>      <map:match pattern="links.xml">
>           <map:generate type="serverpages" src="xml/link.xsp"/> 
>           <map:transform src="stylesheet/links.xsl"/>               
>          <map:serialize/>       
>      </map:match>
>      
>     <!-- here is the aggregation mapping -->     
>      <map:match pattern="**.xml">
>        <map:act type="path-selector"> 
>           <map:parameter name="skel"  value="true" />        
>       	<map:aggregate element="page" >
>       	  <map:part src="{path}" element="maincontent" ns="http://www.brel.com/maincontent"/>    
>    	  
>       	  <map:part src="foot_note.xml" element="foot_note" ns="http://www.brel.com/foot_note"/> 
> 
>       	  <map:part src="side_menu.xml" element="side_menu" ns="http://www.brel.com/side_menu"/> 
> 
>       	  <map:part src="links.xml" element="links" ns="http://www.brel.com/links"/> 
>       	</map:aggregate>      	
>       	<map:transform src="{aggXSLPath}"/> 
>        </map:act>	
>        
>        <map:serialize type="html"/>    	
>     </map:match>
>    
>       
>       <map:match pattern="**.gif">
>          <map:act type="path-selector">
>              <map:read src="{path}" mime-type="image/gif"/>  
>          </map:act>          
>       </map:match>
>       
>       <map:match pattern="**.css">
>              <map:act type="path-selector">
>                  <map:read src="{path}" mime-type="text/css"/>  
>              </map:act>          
>       </map:match>
>       
>       <map:match pattern="**.jpg">
>               <map:act type="path-selector">
>                   <map:read src="{path}" mime-type="image/jpg"/>  
>               </map:act>    
>       
>       </map:match>
>       
>       <map:match pattern="**.png">
>           <map:act type="path-selector">
>              <map:read src="{path}" mime-type="image/png"/>  
>           </map:act>       
>       </map:match>
>       
>       <map:match pattern="**.swf">
>          <map:act type="path-selector">
>          <map:read src="{path}" mime-type="application/x-shockwave-flash"/>
>          </map:act>       
>       </map:match>
> 
>       <map:match pattern="**.js">
>         <map:act type="path-selector">
>            <map:read src="{path}" mime-type="text/javascript"/>
>         </map:act>
>       </map:match>
>       
>       
>       
>       <map:match pattern="**.doc">
>         <map:act type="path-selector">
>            <map:read src="{path}" mime-type="application/winword"/>
>         </map:act>    
>       </map:match>
>       
>       <map:match pattern="**.rtf">
>             <map:act type="path-selector">
>                <map:read src="{path}" mime-type="application/winword"/>
>             </map:act>    
>       </map:match>
> 
>    <map:match pattern="*">
>        <map:act type="path-selector">
>            <map:read src="{path}" mime-type="application/winword"/>
>        </map:act>    
>    </map:match>
> 
> 
> I post this mail is to get your opinions and suggestions, is it the right way to solve the 
> problem ?
> 
> 
> Thank
> 
> Kok Choon
> 
> 
> --------------------------------------------------------
> Name: Ling Kok Choon
> E-mail: Ling Kok Choon <ko...@brel.com>
> Date: 08/14/01
> Time: 14:11:03
> 
> This message was sent by Z-Mail Pro - from NetManage
> NetManage - delivers Standards Based IntraNet Solutions
> --------------------------------------------------------
> 
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> 
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
> 
> 




---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>