cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@cocoon.apache.org
Subject [Cocoon Wiki] Updated: WebDAVCMS
Date Thu, 08 Jul 2004 06:17:20 GMT
   Date: 2004-07-07T23:17:20
   Editor: DavidCrossley <crossley@apache.org>
   Wiki: Cocoon Wiki
   Page: WebDAVCMS
   URL: http://wiki.apache.org/cocoon/WebDAVCMS

   remove vandal attachment

Change Log:

------------------------------------------------------------------------------
@@ -9,10 +9,10 @@
 
 Alternatively you can mount your sitemaps on the WebDAV server by just changing the parent
sitemap.
 
-{{{
-<map:match pattern="*/**">
-  <map:mount check-reload="yes" src="webdav://localhost/webdav/{1}/" uri-prefix="{1}"/>
-</map:match>
+{{{
+<map:match pattern="*/**">
+  <map:mount check-reload="yes" src="webdav://localhost/webdav/{1}/" uri-prefix="{1}"/>
+</map:match>
 }}}
 
 Nothing you want to do on a production system, but it's an easy way to version your sitemap
changes on a dev system, given you have a DeltaV enabled WebDAV server.
@@ -29,76 +29,76 @@
 
 "!TraversableGenerator" just generates a XML representation of the folder's contents.
 
-{{{
-<map:generate type="traverse" src="repo"/>
+{{{
+<map:generate type="traverse" src="repo"/>
 }}}
 
 generates (simplified):
 
-{{{
-<collection:collection name="repo">
-  <collection:resource name="contentA.xml"/>
-  <collection:collection name="dir1"/>
-  <collection:collection name="dir2"/>
-</collection:collection>
+{{{
+<collection:collection name="repo">
+  <collection:resource name="contentA.xml"/>
+  <collection:collection name="dir1"/>
+  <collection:collection name="dir2"/>
+</collection:collection>
 }}}
 
 The "step2" applies a simple stylesheet that generates links out of this XML.
 The generated links point to:
 
-{{{
-<map:match pattern="repo/**/">
-  <map:generate type="traverse" src="{global:staging}repo/{1}/"/>
-  <map:transform src="{global:staging}styles/dir2html.xsl"/>
-  <map:serialize type="html"/>
-</map:match>
+{{{
+<map:match pattern="repo/**/">
+  <map:generate type="traverse" src="{global:staging}repo/{1}/"/>
+  <map:transform src="{global:staging}styles/dir2html.xsl"/>
+  <map:serialize type="html"/>
+</map:match>
 }}}
 
 for directories (with trailing slashes) and to:
 
-{{{
-<map:match pattern="repo/**">
-  <map:generate src="{global:staging}repo/{1}"/>
-  <map:transform src="{global:staging}styles/file2html.xsl">
-    <map:parameter name="file" value="repo/{1}"/>
-  </map:transform>
-  <map:serialize type="html"/>
-</map:match>
+{{{
+<map:match pattern="repo/**">
+  <map:generate src="{global:staging}repo/{1}"/>
+  <map:transform src="{global:staging}styles/file2html.xsl">
+    <map:parameter name="file" value="repo/{1}"/>
+  </map:transform>
+  <map:serialize type="html"/>
+</map:match>
 }}}
 
 for files. So that the first pipeline matches to any "repo" subdirectory and the second pipeline
matches to any file contained within repo or one of its subdirectories. The second pipeline
uses another stylesheet "file2html.xsl" that converts the XML files to HTML.
 
 The "step3" sample changes this stylesheet so that the elements of the XML files are converted
to to input fields of a HTML form. The "action" attribute of this form points to another pipeline
which is the interesting part of this sample.
 
-{{{
-<map:match pattern="write/**">
-  <map:generate type="request" label="content"/>
-  <map:transform src="styles/request2doc.xsl"/>
-  <map:transform src="styles/doc2write.xsl">
-    <map:parameter name="file" value="{1}"/>
-  </map:transform>
-  <map:transform type="write-source"/>
-  <map:serialize type="xml"/>
-</map:match>
+{{{
+<map:match pattern="write/**">
+  <map:generate type="request" label="content"/>
+  <map:transform src="styles/request2doc.xsl"/>
+  <map:transform src="styles/doc2write.xsl">
+    <map:parameter name="file" value="{1}"/>
+  </map:transform>
+  <map:transform type="write-source"/>
+  <map:serialize type="xml"/>
+</map:match>
 }}}
 
 The pipeline start with the "!RequestGenerator" which feeds an XML representation of all
request parameters into the pipeline. This XML representation already contains all parts of
the to be written XML document. The "request2doc.xsl" stylesheet simply converts the XML to
a format similar to the target document. Then the next stylesheet, "doc2write.xsl", wraps
this XML with writing instructions for the "!SourceWritingTransformer".
 
 As its name suggests, the "!SourceWritingTransformer" allows you to write to a source (as
strange as it may sound), given the particular source implementation implements the "org.apache.excalibur.source.!ModifiableSource"
interface.
 
-{{{
-<source:write>
-  <source:source>repo/contentA.xml</source:source>
-  <source:fragment>
-    <page>
-      <title>Page 1</title>
-      <content>
-        <para>Paragraph 1</para>
-        <para>Paragraph 2</para>
-      </content>
-    </page>
-  </source:fragment>
-</source:write>
+{{{
+<source:write>
+  <source:source>repo/contentA.xml</source:source>
+  <source:fragment>
+    <page>
+      <title>Page 1</title>
+      <content>
+        <para>Paragraph 1</para>
+        <para>Paragraph 2</para>
+      </content>
+    </page>
+  </source:fragment>
+</source:write>
 }}}
 
 A writing instruction for the "!SourceWritingTransformer" contains the URI of the source
to write to. Similar to other components using Cocoon's source resolving the "!SourceWritingTransformer"
does not care which pseudo protocol it writes to, as long as it implements the "org.apache.excalibur.source.!ModifiableSource"
interface.
@@ -107,191 +107,191 @@
 
 Instead of writing the meta data to a separate file you can store them in other places as
well, such as a SQL database. To store the meta data in Cocoon's embeded HSQL database add
the following lines to "<cocooncontext>/WEB-INF/db/cocoondb.script" and restart Cocoon.
 
-{{{
-CREATE TABLE DOCS(PATH VARCHAR NOT NULL PRIMARY KEY,AUTHOR VARCHAR,CATEGORY VARCHAR,STATE
VARCHAR)
-INSERT INTO DOCS VALUES('repo/contentA.xml','me','catA','edited')
-INSERT INTO DOCS VALUES('repo/dir1/contentB.xml','me','catB','edited')
-INSERT INTO DOCS VALUES('repo/dir1/contentC.xml','me','Other Category','edited')
-INSERT INTO DOCS VALUES('repo/dir2/contentA.xml','me','catA','edited')
-INSERT INTO DOCS VALUES('repo/dir2/contentB.xml','you','catB','edited')
-INSERT INTO DOCS VALUES('repo/dir2/contentC.xml','me','other','edited')
-INSERT INTO DOCS VALUES('repo/dir2/subdir1/contentA.xml','you','docs','new')
+{{{
+CREATE TABLE DOCS(PATH VARCHAR NOT NULL PRIMARY KEY,AUTHOR VARCHAR,CATEGORY VARCHAR,STATE
VARCHAR)
+INSERT INTO DOCS VALUES('repo/contentA.xml','me','catA','edited')
+INSERT INTO DOCS VALUES('repo/dir1/contentB.xml','me','catB','edited')
+INSERT INTO DOCS VALUES('repo/dir1/contentC.xml','me','Other Category','edited')
+INSERT INTO DOCS VALUES('repo/dir2/contentA.xml','me','catA','edited')
+INSERT INTO DOCS VALUES('repo/dir2/contentB.xml','you','catB','edited')
+INSERT INTO DOCS VALUES('repo/dir2/contentC.xml','me','other','edited')
+INSERT INTO DOCS VALUES('repo/dir2/subdir1/contentA.xml','you','docs','new')
 }}}
 
 Now change the "doc2write.xsl" stylesheet to look like this:
 
-{{{
-<?xml version="1.0"?>
-<xsl:stylesheet version="1.0"
-                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-                xmlns:req="http://apache.org/cocoon/request/2.0"
-                xmlns:source="http://apache.org/cocoon/source/1.0">
-<xsl:param name="file"></xsl:param>
-<xsl:template match="request/parameters">
-<page>
-  <source:write create="true">
-    <source:source><xsl:value-of select="$file"/></source:source>
-    <source:path>page</source:path>
-    <source:fragment>
-      <title><xsl:value-of select="title"/></title>
-      <content>
-        <xsl:for-each select="content/para">
-        <para>
-        <xsl:value-of select="normalize-space(.)"/>
-        </para>
-        </xsl:for-each>
-      </content>
-    </source:fragment>
-  </source:write>
-
-  <sql:execute-query xmlns:sql="http://apache.org/cocoon/SQL/2.0"> 
-    <sql:use-connection>personnel</sql:use-connection>
-    <sql:query>
-      update docs set 
-      author = '<xsl:value-of select="author"/>',
-      category = '<xsl:value-of select="category"/>',
-      state = '<xsl:value-of select="state"/>'
-      where path = '<xsl:value-of select="$file"/>'
-    </sql:query>
-  </sql:execute-query>
-</page>
-</xsl:template>
-</xsl:stylesheet>
+{{{
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:req="http://apache.org/cocoon/request/2.0"
+                xmlns:source="http://apache.org/cocoon/source/1.0">
+<xsl:param name="file"></xsl:param>
+<xsl:template match="request/parameters">
+<page>
+  <source:write create="true">
+    <source:source><xsl:value-of select="$file"/></source:source>
+    <source:path>page</source:path>
+    <source:fragment>
+      <title><xsl:value-of select="title"/></title>
+      <content>
+        <xsl:for-each select="content/para">
+        <para>
+        <xsl:value-of select="normalize-space(.)"/>
+        </para>
+        </xsl:for-each>
+      </content>
+    </source:fragment>
+  </source:write>
+
+  <sql:execute-query xmlns:sql="http://apache.org/cocoon/SQL/2.0"> 
+    <sql:use-connection>personnel</sql:use-connection>
+    <sql:query>
+      update docs set 
+      author = '<xsl:value-of select="author"/>',
+      category = '<xsl:value-of select="category"/>',
+      state = '<xsl:value-of select="state"/>'
+      where path = '<xsl:value-of select="$file"/>'
+    </sql:query>
+  </sql:execute-query>
+</page>
+</xsl:template>
+</xsl:stylesheet>
 }}}
 
 and add the SQLTransformer to the writing pipeline:
 
-{{{
-<map:match pattern="write/**">
-  <map:generate type="request" label="content"/>
-  <map:transform src="styles/request2doc.xsl"/>
-  <map:transform src="styles/doc2write.xsl">
-    <map:parameter name="file" value="{1}"/>
-  </map:transform>
-  <map:transform type="write-source"/>
-  <map:transform type="sql"/>
-  <map:serialize type="xml"/>
-</map:match>
+{{{
+<map:match pattern="write/**">
+  <map:generate type="request" label="content"/>
+  <map:transform src="styles/request2doc.xsl"/>
+  <map:transform src="styles/doc2write.xsl">
+    <map:parameter name="file" value="{1}"/>
+  </map:transform>
+  <map:transform type="write-source"/>
+  <map:transform type="sql"/>
+  <map:serialize type="xml"/>
+</map:match>
 }}}
 
 Change the "metapage" pipeline:
 
-{{{
-<map:match pattern="metapage/**">
-  <map:generate src="dummy.xml"/>
-  <map:transform src="{global:staging}styles/2selectmeta.xsl">
-    <map:parameter name="path" value="repo/{1}"/>
-  </map:transform>
-  <map:transform type="sql"/>
-  <map:transform src="{global:staging}styles/2meta.xsl"/>
-  <map:serialize type="xml"/>
-</map:match>
+{{{
+<map:match pattern="metapage/**">
+  <map:generate src="dummy.xml"/>
+  <map:transform src="{global:staging}styles/2selectmeta.xsl">
+    <map:parameter name="path" value="repo/{1}"/>
+  </map:transform>
+  <map:transform type="sql"/>
+  <map:transform src="{global:staging}styles/2meta.xsl"/>
+  <map:serialize type="xml"/>
+</map:match>
 }}}
 
 with "dummy.xml" being:
 
-{{{
-<?xml version="1.0"?>
-<page/>
+{{{
+<?xml version="1.0"?>
+<page/>
 }}}
 
 "2selectmeta.xsl":
 
-{{{
-<?xml version="1.0"?>
-<xsl:stylesheet version="1.0"
-                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-<xsl:param name="path"></xsl:param>
-<xsl:template match="/page">
-<page>
-  <sql:execute-query xmlns:sql="http://apache.org/cocoon/SQL/2.0"> 
-    <sql:use-connection>personnel</sql:use-connection>
-    <sql:query>
-      select author, category, state from docs
-      where path = '<xsl:value-of select="$path"/>'
-    </sql:query>
-  </sql:execute-query>
-</page>
-</xsl:template>
-</xsl:stylesheet>
+{{{
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:param name="path"></xsl:param>
+<xsl:template match="/page">
+<page>
+  <sql:execute-query xmlns:sql="http://apache.org/cocoon/SQL/2.0"> 
+    <sql:use-connection>personnel</sql:use-connection>
+    <sql:query>
+      select author, category, state from docs
+      where path = '<xsl:value-of select="$path"/>'
+    </sql:query>
+  </sql:execute-query>
+</page>
+</xsl:template>
+</xsl:stylesheet>
 }}}
 
 and "2meta.xsl":
 
-{{{
-<?xml version="1.0"?>
-<xsl:stylesheet version="1.0"
-                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-<xsl:template match="/page">
-  <metapage>
-    <xsl:apply-templates/>
-  </metapage>
-</xsl:template>
-
-<xsl:template match="*[name()='rowset']">
-  <xsl:apply-templates/>
-</xsl:template>
-
-<xsl:template match="*[name()='row']">
-  <author><xsl:value-of select="*[name()='author']"/></author>
-  <category><xsl:value-of select="*[name()='category']"/></category>
-  <state><xsl:value-of select="*[name()='state']"/></state>
-</xsl:template>
-
-</xsl:stylesheet>
+{{{
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:template match="/page">
+  <metapage>
+    <xsl:apply-templates/>
+  </metapage>
+</xsl:template>
+
+<xsl:template match="*[name()='rowset']">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="*[name()='row']">
+  <author><xsl:value-of select="*[name()='author']"/></author>
+  <category><xsl:value-of select="*[name()='category']"/></category>
+  <state><xsl:value-of select="*[name()='state']"/></state>
+</xsl:template>
+
+</xsl:stylesheet>
 }}}
 
 Everything works like before but now you can easily generate a list of all new documents.
 
-{{{
-<map:match pattern="getallnew">
-  <map:generate src="getallnew.xml"/>
-  <map:transform type="sql"/>
-  <map:transform src="styles/list2html.xsl"/>
-  <map:serialize type="html"/>
-</map:match>
+{{{
+<map:match pattern="getallnew">
+  <map:generate src="getallnew.xml"/>
+  <map:transform type="sql"/>
+  <map:transform src="styles/list2html.xsl"/>
+  <map:serialize type="html"/>
+</map:match>
 }}}
 
 with "getallnew.xml":
 
-{{{
-<?xml version="1.0"?>
-<page>
-  <sql:execute-query xmlns:sql="http://apache.org/cocoon/SQL/2.0"> 
-    <sql:use-connection>personnel</sql:use-connection>
-    <sql:query>
-      select path from docs where state = 'new'
-    </sql:query>
-  </sql:execute-query>
-</page>
+{{{
+<?xml version="1.0"?>
+<page>
+  <sql:execute-query xmlns:sql="http://apache.org/cocoon/SQL/2.0"> 
+    <sql:use-connection>personnel</sql:use-connection>
+    <sql:query>
+      select path from docs where state = 'new'
+    </sql:query>
+  </sql:execute-query>
+</page>
 }}}
 
 and "list2html.xsl":
 
-{{{
-<?xml version="1.0"?>
-<xsl:stylesheet version="1.0"
-                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-                xmlns:sql="http://apache.org/cocoon/SQL/2.0">
-<xsl:template match="/page">
-<html>
-  <body>
-    <ul>
-      <xsl:apply-templates/>
-    </ul>
-  </body>
-</html>
-</xsl:template>
-
-<xsl:template match="*[name()='rowset']">
-  <xsl:apply-templates/>
-</xsl:template>
-
-<xsl:template match="*[name()='row']">
-  <li><a href="{*[name()='path']}"><xsl:value-of select="*[name()='path']"/></a></li>
-</xsl:template>
-</xsl:stylesheet>
-
+{{{
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:sql="http://apache.org/cocoon/SQL/2.0">
+<xsl:template match="/page">
+<html>
+  <body>
+    <ul>
+      <xsl:apply-templates/>
+    </ul>
+  </body>
+</html>
+</xsl:template>
+
+<xsl:template match="*[name()='rowset']">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="*[name()='row']">
+  <li><a href="{*[name()='path']}"><xsl:value-of select="*[name()='path']"/></a></li>
+</xsl:template>
+</xsl:stylesheet>
+
 }}}
 
 "step5" is just another exercise that allows you to create new content.
@@ -302,6 +302,3 @@
 To see how Cocoon's flow layer helps you to "gain back control" have a look at the flowsample[[BR]]
 of the WebDAV block.
 
-[[BR]]
-[[BR]]
-'''Attachment:''' attachment:Romania_vc0000.jpg [[BR]]

Mime
View raw message