You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by do...@cocoon.apache.org on 2004/07/07 10:53:05 UTC

[Cocoon Wiki] Updated: WebDAVHTMLArea

   Date: 2004-07-07T01:53:05
   Editor: DavidCrossley <cr...@apache.org>
   Wiki: Cocoon Wiki
   Page: WebDAVHTMLArea
   URL: http://wiki.apache.org/cocoon/WebDAVHTMLArea

   removed vandal attachment

Change Log:

------------------------------------------------------------------------------
@@ -10,78 +10,78 @@
 
 Add the following entry to the sitemap:
 
-{{{
-<map:match pattern="editor/**">
-  <map:read src="{global:staging}editor/{1}"/>
-</map:match>
+{{{
+<map:match pattern="editor/**">
+  <map:read src="{global:staging}editor/{1}"/>
+</map:match>
 }}}
 
 Then open your "file2html.xsl" stylesheet and change the template matching the root element to look like this:
 
-{{{
-<xsl:template match="/page">
-  <html>
-    <head>
-      <script type="text/javascript">
-        <xsl:attribute name="src"><xsl:value-of select="substring-before($requestURI, $sitemapURI)"/>editor/htmlarea.js</xsl:attribute>
-      </script>  
-      <script type="text/javascript">
-        <xsl:attribute name="src"><xsl:value-of select="substring-before($requestURI, $sitemapURI)"/>editor/htmlarea-lang-en.js</xsl:attribute>
-      </script>  
-      <script type="text/javascript">
-        <xsl:attribute name="src"><xsl:value-of select="substring-before($requestURI, $sitemapURI)"/>editor/dialog.js</xsl:attribute>
-      </script>  
-      <style type="text/css">
-        @import url(<xsl:value-of select="substring-before($requestURI, $sitemapURI)"/>editor/htmlarea.css);
-      </style>
-      <script type="text/javascript">
-        var editor = null;
-        function initEditor() {
-          editor = new HTMLArea("para");
-          var cfg = editor.config;
-          cfg.editorURL = "<xsl:value-of select="substring-before($requestURI, $sitemapURI)"/>editor/";
-          editor.generate();
-        }
-      </script>
-    </head>
-    <body onload="initEditor()">
-      <form method="get">
-        <xsl:attribute name="action"><xsl:value-of select="substring-before($requestURI, $sitemapURI)"/>write/<xsl:value-of select="$file"/></xsl:attribute>
-        <p>Title:<br />
-        <input name="title" type="text" size="30" maxlength="30" value="{page/title}" />
-        </p>
-        <xsl:apply-templates select="metapage"/>
-        <xsl:apply-templates select="page/content/para"/>
-        <input type="submit" value="Submit" />
-        <input type="reset" value="Reset" />
-      </form>
-    </body>
-  </html>
-</xsl:template>
+{{{
+<xsl:template match="/page">
+  <html>
+    <head>
+      <script type="text/javascript">
+        <xsl:attribute name="src"><xsl:value-of select="substring-before($requestURI, $sitemapURI)"/>editor/htmlarea.js</xsl:attribute>
+      </script>  
+      <script type="text/javascript">
+        <xsl:attribute name="src"><xsl:value-of select="substring-before($requestURI, $sitemapURI)"/>editor/htmlarea-lang-en.js</xsl:attribute>
+      </script>  
+      <script type="text/javascript">
+        <xsl:attribute name="src"><xsl:value-of select="substring-before($requestURI, $sitemapURI)"/>editor/dialog.js</xsl:attribute>
+      </script>  
+      <style type="text/css">
+        @import url(<xsl:value-of select="substring-before($requestURI, $sitemapURI)"/>editor/htmlarea.css);
+      </style>
+      <script type="text/javascript">
+        var editor = null;
+        function initEditor() {
+          editor = new HTMLArea("para");
+          var cfg = editor.config;
+          cfg.editorURL = "<xsl:value-of select="substring-before($requestURI, $sitemapURI)"/>editor/";
+          editor.generate();
+        }
+      </script>
+    </head>
+    <body onload="initEditor()">
+      <form method="get">
+        <xsl:attribute name="action"><xsl:value-of select="substring-before($requestURI, $sitemapURI)"/>write/<xsl:value-of select="$file"/></xsl:attribute>
+        <p>Title:<br />
+        <input name="title" type="text" size="30" maxlength="30" value="{page/title}" />
+        </p>
+        <xsl:apply-templates select="metapage"/>
+        <xsl:apply-templates select="page/content/para"/>
+        <input type="submit" value="Submit" />
+        <input type="reset" value="Reset" />
+      </form>
+    </body>
+  </html>
+</xsl:template>
 }}}
 
 In the latest until now [:okt1,2003] beta version of HTMLArea for CVS are changes in languages support so in previews .xsl we have to modify the path to "en.js" as:
 
-{{{
-...
-      <script type="text/javascript">
-        <xsl:attribute name="src"><xsl:value-of select="substring-before($requestURI, $sitemapURI)"/>editor/lang/en.js</xsl:attribute>
-      </script>  
-...
+{{{
+...
+      <script type="text/javascript">
+        <xsl:attribute name="src"><xsl:value-of select="substring-before($requestURI, $sitemapURI)"/>editor/lang/en.js</xsl:attribute>
+      </script>  
+...
 }}}
 
 because HTMLarea is still beta we must to check if this example is up to date. (stavros)
 
 Change your textarea to have to have 100 cols and 30 rows:
 
-{{{
-<xsl:template match="page/content/para">
-  <p>para:<br />
-    <textarea name="para" cols="120" rows="30">
-      <xsl:copy-of select="node()"/>
-    </textarea>
-  </p>
-</xsl:template>
+{{{
+<xsl:template match="page/content/para">
+  <p>para:<br />
+    <textarea name="para" cols="120" rows="30">
+      <xsl:copy-of select="node()"/>
+    </textarea>
+  </p>
+</xsl:template>
 }}}
 
 Change all contents to contain only a single "para" element.
@@ -93,81 +93,79 @@
 The solution at hand is to use the HTMLTransformer.
 Declare it at the beginning of the sitemap right after the !TraversableGenerator:
 
-{{{
-  <map:transformers default="xalan">
-    <map:transformer name="html" src="org.apache.cocoon.transformation.HTMLTransformer">
-      <jtidy-config>jtidy-config.txt</jtidy-config>
-    </map:transformer>
-  </map:transformers>
+{{{
+  <map:transformers default="xalan">
+    <map:transformer name="html" src="org.apache.cocoon.transformation.HTMLTransformer">
+      <jtidy-config>jtidy-config.txt</jtidy-config>
+    </map:transformer>
+  </map:transformers>
 }}}
 
 "jtidy-config.txt" has to be created with the following content:
 
-{{{
-output-xhtml: no
-tidy-mark: no
+{{{
+output-xhtml: no
+tidy-mark: no
 }}}
 
 This is necessary since the HTMLTransformer defaults to output XHTML, but HTMLArea does not work if the loaded HTML contains the XHTML namespace declaration.
 
 Modify the writing pipeline to contain the HTMLTransformer:
 
-{{{
-<map:match pattern="write/**">
-  <map:generate type="request"/>
-  <map:transform src="{global:staging}styles/request2doc.xsl"/>
-  <map:transform type="html">
-    <map:parameter name="tags" value="para"/>
-  </map:transform>
-  <map:transform src="{global:staging}styles/doc2write.xsl">
-    <map:parameter name="file" value="{global:staging}{1}"/>
-  </map:transform>
-  <map:transform type="write-source"/>
-  <map:serialize type="xml"/>
-</map:match>
+{{{
+<map:match pattern="write/**">
+  <map:generate type="request"/>
+  <map:transform src="{global:staging}styles/request2doc.xsl"/>
+  <map:transform type="html">
+    <map:parameter name="tags" value="para"/>
+  </map:transform>
+  <map:transform src="{global:staging}styles/doc2write.xsl">
+    <map:parameter name="file" value="{global:staging}{1}"/>
+  </map:transform>
+  <map:transform type="write-source"/>
+  <map:serialize type="xml"/>
+</map:match>
 }}}
 
 As a last step you have to modify the "doc2write.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>
-          <!--the following line is the one to change-->
-          <xsl:copy-of select="html/body/*"/>
-        </para>
-        </xsl:for-each>
-      </content>
-    </source:fragment>
-  </source:write>
-  <source:write create="true">
-    <source:source><xsl:value-of select="$file"/>.meta</source:source>
-    <source:path>metapage</source:path>
-    <source:fragment>
-      <author><xsl:value-of select="author"/></author>
-      <category><xsl:value-of select="category"/></category>
-      <state><xsl:value-of select="state"/></state>
-    </source:fragment>
-  </source:write>
-</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>
+          <!--the following line is the one to change-->
+          <xsl:copy-of select="html/body/*"/>
+        </para>
+        </xsl:for-each>
+      </content>
+    </source:fragment>
+  </source:write>
+  <source:write create="true">
+    <source:source><xsl:value-of select="$file"/>.meta</source:source>
+    <source:path>metapage</source:path>
+    <source:fragment>
+      <author><xsl:value-of select="author"/></author>
+      <category><xsl:value-of select="category"/></category>
+      <state><xsl:value-of select="state"/></state>
+    </source:fragment>
+  </source:write>
+</page>
+</xsl:template>
+</xsl:stylesheet>
 }}}
 
 To see how to more closely control formatting freedom of the authors have a look at the HTMLArea documentation.
-[[BR]]
-[[BR]]
-'''Attachment:''' attachment:Big+Brother+Brasil+4.htm [[BR]]
+