cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kpiroum...@apache.org
Subject cvs commit: xml-cocoon2/src/webapp/myapp/xsl style.xsl
Date Tue, 30 Apr 2002 15:32:21 GMT
kpiroumian    02/04/30 08:32:21

  Modified:    src/webapp sitemap.xmap
  Added:       src/webapp/myapp myapp.spp readme.html sitemap.xmap
               src/webapp/myapp/xml page.xml
               src/webapp/myapp/xsp page.xsp
               src/webapp/myapp/xsl style.xsl
  Log:
  Added a "Quick start" application template to be used
  for "minimal Cocoon" build target.
  
  Revision  Changes    Path
  1.49      +6 -0      xml-cocoon2/src/webapp/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/sitemap.xmap,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- sitemap.xmap	25 Apr 2002 16:26:29 -0000	1.48
  +++ sitemap.xmap	30 Apr 2002 15:32:21 -0000	1.49
  @@ -482,6 +482,12 @@
   -->
   
    <map:pipelines>
  +  <!-- MyApp - minimal Cocoon Application Mount -->
  +  <map:pipeline>
  +    <map:match pattern="myapp/**">
  +      <map:mount uri-prefix="myapp" src="myapp/" check-reload="yes"/>
  +    </map:match>
  +  </map:pipeline>
   
     <!-- sub-sitemap example pipeline -->
     <map:pipeline>
  
  
  
  1.1                  xml-cocoon2/src/webapp/myapp/myapp.spp
  
  Index: myapp.spp
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <Project>
  	<Folder FolderName="XML Files" ExtStr="xml;cml;math;mtx;rdf;smil;svg;wml">
  		<File FilePath=".\xml\page.xml" HomeFolder="Yes"/>
  	</Folder>
  	<Folder FolderName="XSP" ExtStr="xsp">
  		<File FilePath=".\xsp\page.xsp" HomeFolder="Yes"/>
  	</Folder>
  	<Folder FolderName="XSL Files" ExtStr="xsl;xslt">
  		<File FilePath=".\xsl\style.xsl" HomeFolder="Yes"/>
  	</Folder>
  	<Folder FolderName="HTML Files" ExtStr="html;htm;xhtml;asp">
  		<File FilePath=".\readme.html" HomeFolder="Yes"/>
  		<File FilePath=".\readme.txt" HomeFolder="Yes"/>
  	</Folder>
  	<Folder FolderName="DTD/Schemas" ExtStr="dtd;dcd;xdr;biz;xsd"/>
  	<Folder FolderName="Entities" ExtStr="ent"/>
  	<File FilePath=".\sitemap.xmap" HomeFolder="Yes"/>
  </Project>
  
  
  
  1.1                  xml-cocoon2/src/webapp/myapp/readme.html
  
  Index: readme.html
  ===================================================================
  <!-- CVS: $Id: readme.html,v 1.1 2002/04/30 15:32:21 kpiroumian Exp $ -->
  
  <html>
     <head>
        <title>Minimal Cocoon Web Application - README</title>
     </head>
     <body>
  <pre>
  ==================================================================
               Minimal Cocoon Web Application Template
  
  	 by Konstantin Piroumian (kpiroumian@apache.org)
  	 Date: $Date: 2002/04/30 15:32:21 $
  ==================================================================
  
  
  This is the place where you can start hacking with Cocoon.
  
  What you have to know before using this template
  ------------------------------------------------
  1. You should know basics of XML: how to create content
  
  2. You should be familiar more or less with XSLT
  
  3. You should be familiar with Web Applications 
  and servlet environment
  
  4. It's not neccessary, but it'd be fine if you were familiar
  with Java language, so you could create dynamic pages
  
  
  For newbies
  ------------
  
  1. Create XML files, drop them into 'xml' directory
  
  2. Edit the stylesheet named style.xsl to render your xml, 
     just drop it into 'xsl' directory
  
  3. Access this URL: http://localhost:<port>/cocoon/myapp/<page>.xml 
     where 
         'page' is actual name of your xml file, say 'index.xml'
         'port' your app server port where it handles servlet requests, 
          8080 for Tomcat
        
  4. Enjoy!
  
  Note: Templates for XML, XSLT files are provided for your convenience.
  
  
  A little more advanced users
  ----------------------------
  
  1. Create XSP files, drop them into 'xml' directory
  
  2. Create/reuse stylesheet(s) to render your XSP output
  
  3. Access this URL: http://localhost:<port>/cocoon/myapp/<page>.xsp
  
  4. Fix your XSP, try again
  
  5. Enjoy!
  
   
  Very advanced users
  --------------------
  
  1. Read User docs (http://xml.apache.org/cocoon/userdocs/)
  
  2. Edit your sitemap.xmap as needed for your application: 
  	- add/use components (see root sitemap to see what is availble)
  	- add/modify pipelines (change matching patterns, add actions)
  	- use more transformations in pipeline
  	- use aggregation
  	- create sitemap resources
  	- create sitemap views
  
  Not all the above is necessary for every application. 
  
  For advanced developers
  ------------------------
  You don't need this application, you can create your own, if no, 
  then look a few lines upper  ;)
  
  1. Read Developer docs (http://xml.apache.org/cocoon/developing/extending.html)
  
  2. Implement your own components:
  	- actions
  	- generators
  	- transformers
  	- serializers
  	- sources
  	- [add your own]
  
  Note: You can find a lot of samples to learn from in Cocoon sources.
  
  3. Declare your components in sitemap
  
  4. Debug your sitemap
  
  5. Debug your components
  
  6. Enjoy when it works!
  
  
  For all kind of users
  ---------------------
  
  - Join Cocoon Users mail list and ask questions if you don't find the answer in FAQ or docs
  - Join Cocoon Dev mail list to participate in Cocoon development
  
  That's all folks!
  
  Cocoon Team wishes you Happy Hacking with Cocoon 2.1!
  </pre>
     </body>
  </html>
  
  
  
  1.1                  xml-cocoon2/src/webapp/myapp/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  <?xml version="1.0"?>
  <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
  <!-- CVS: $Id: sitemap.xmap,v 1.1 2002/04/30 15:32:21 kpiroumian Exp $ -->
  <!--
      Minimal sitemap to start making XML/XSP/XSLT transformations.
  
      Author: Konstantin Piroumian "kpiroumian@apache.org" 
  -->
      <map:components>
          <map:generators default="file"/>
          <map:transformers default="xslt"/>
          <map:readers default="resource"/>
          <map:serializers default="html"/>
          <map:matchers default="wildcard"/>
          <map:selectors default="browser"/>
      </map:components>
     <!-- =========================== Pipelines ================================= -->
      <map:pipelines>
          <map:pipeline>
          
                  <!-- Default URL matcher. Matches '/' URLs-->
                  <map:match pattern="">
                      <map:redirect-to uri="readme.html" />
                  </map:match>
  
                  <!-- This matches requests like 'page.xml' to display static output -->
                  <map:match pattern="*.xml">
                          <!-- {1} contains the value that substituted '*' in the pattern-->
                          <map:generate src="xml/{1}.xml"/>
                          <!-- You can change 'src' to 'xsl/{1}.xsl' to use custom stylesheets
                          for every page, e.g.: mypage.xml -> mypage.xsl  -->
                          <map:transform src="xsl/style.xsl"/>
                          <!-- Just output the result as HTML (default) 
                              Add 'type' attribute with 'xml' value to get XML output
                          -->
                          <map:serialize/>
                  </map:match>            
                  
                  <!-- This matches requests like 'page.xsp' to display dynamic output
-->
                  <map:match pattern="*.xsp">
                          <!-- This generator uses 'serverpages' generator. 
                          See the root sitemap for other types of available components -->
                          <map:generate type="serverpages" src="xsp/{1}.xsp"/>
                          <map:transform src="xsl/style.xsl"/>
                          <map:serialize/>
                  </map:match>                            
  
                  <!-- Display static HTML files, like readme.html -->             
  
                  <map:match pattern="*.html">
                      <map:read src="{1}.html" mime-type="text/html" />
                  </map:match>
  
                  <!-- Add your pipelines here -->
                  
              </map:pipeline>                
      </map:pipelines>
  </map:sitemap>
  <!-- end of file -->
  
  
  
  1.1                  xml-cocoon2/src/webapp/myapp/xml/page.xml
  
  Index: page.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!-- CVS: $Id: page.xml,v 1.1 2002/04/30 15:32:21 kpiroumian Exp $ -->
  <page>
      <title>My App page</title>
      <content>
          <para>Just a static contents</para>
      </content>
  </page>
  
  
  
  1.1                  xml-cocoon2/src/webapp/myapp/xsp/page.xsp
  
  Index: page.xsp
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <!-- CVS: $Id: page.xsp,v 1.1 2002/04/30 15:32:21 kpiroumian Exp $ -->
  
  <!--
       XSP can be assotiated with the logicsheet using processing
       instruction xml-logicsheet or the xsp:logicsheet element.
       Do not use both methods!
  
  <?xml-logicsheet href="logicsheets/hello.xsl"?>
  -->
  
  <xsp:page language="java" xmlns:xsp="http://apache.org/xsp">
  
  <!-- Place your imports here. Note, that you shoud have imported 
      packages somewhere in classpath. -->
      <xsp:structure>
          <xsp:include>java.util.Date</xsp:include>
      </xsp:structure>
      
      <!-- Place your class level logic here -->
      <xsp:logic>
          private Date getDate() {
              return new Date();
          }
      </xsp:logic>
  
      <!-- Your content root element -->    
      <page>
          <!-- Place logicsheet declarations here. Href is relative to app context -->
          <!--
          <xsp:logicsheet location="logicsheets/hello.xsl"/>
          -->        
          <title>My App XSP Page</title>
          <content>
              <para>
                  Some dynamic content <xsp:expr>getDate()</xsp:expr>
              </para>
          </content>
      </page>
  </xsp:page>
  
  
  
  1.1                  xml-cocoon2/src/webapp/myapp/xsl/style.xsl
  
  Index: style.xsl
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!-- CVS: $Id: style.xsl,v 1.1 2002/04/30 15:32:21 kpiroumian Exp $ -->
  
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  
  <xsl:template match="page">
      <html>
          <head>
              <title><xsl:value-of select="title" /></title>
          </head>
          <body>
              <xsl:apply-templates />
          </body>
      </html>
  </xsl:template>
  
  <xsl:template match="title">
      <h1><xsl:value-of select="." /></h1>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  

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