You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by je...@apache.org on 2002/03/13 20:19:43 UTC

cvs commit: xml-cocoon2/src/scratchpad/webapp/mount/editor/tests make-page.xsl test1.xml test2.xml test3.xml test4.xml

jeremy      02/03/13 11:19:43

  Modified:    src/scratchpad/webapp/mount/editor README editor.xmap
               src/scratchpad/webapp/mount/editor/docs source.xml tests.xml
                        welcome.xml
               src/scratchpad/webapp/mount/editor/editor/docs welcome.xml
               src/scratchpad/webapp/mount/editor/editor/stylesheets
                        editor-components.xsl editor-page2html.xsl
                        editor-utils.xsl simple-page2html.xsl
               src/scratchpad/webapp/mount/editor/tests make-page.xsl
                        test1.xml test2.xml test3.xml test4.xml
  Added:       src/scratchpad/webapp/mount/editor/editor/docs
                        alpha-config.xml bravo-config.xml
               src/scratchpad/webapp/mount/editor/editor/stylesheets
                        dir2editor.xsl editor-alpha-components.xsl
                        editor-bravo-components.xsl file2editor.xsl
                        request2editor.xsl stream2editor.xsl
  Removed:     src/scratchpad/webapp/mount/editor/docs xfwt.xml
               src/scratchpad/webapp/mount/editor/editor/docs editor.xml
               src/scratchpad/webapp/mount/editor/editor/stylesheets
                        stream2source.xsl stream2xfwt.xsl
  Log:
  modified to use SourceWritingTransformer, added ability to have multiple sub-editors, two sub-editors supplied, 'alpha' edits whole XML, 'bravo' breaks XML down into seperate fields and does linefeed to paragraph conversion
  
  Revision  Changes    Path
  1.4       +1 -1      xml-cocoon2/src/scratchpad/webapp/mount/editor/README
  
  Index: README
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/README,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- README	28 Feb 2002 19:05:11 -0000	1.3
  +++ README	13 Mar 2002 19:19:42 -0000	1.4
  @@ -46,7 +46,7 @@
   	It xsl:include's 'editor-components.xsl' and 'editor-utils.xsl'.
   editor-components.xsl
   	controls the style of the form(s), the tools, the 'editor view', 
  -	the directory listing and the report from WritableSourceTransformer.
  +	the directory listing and the report from SourceWritingTransformer.
   editor-utils.xsl
   	a few generic utilities used by editor-page2html.xsl
   simple-page2html.xsl
  
  
  
  1.3       +128 -164  xml-cocoon2/src/scratchpad/webapp/mount/editor/editor.xmap
  
  Index: editor.xmap
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/editor.xmap,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- editor.xmap	28 Feb 2002 19:05:11 -0000	1.2
  +++ editor.xmap	13 Mar 2002 19:19:42 -0000	1.3
  @@ -1,11 +1,10 @@
   <?xml version="1.0"?>
  -
   <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
     <map:components>
       <map:generators default="file"/>
       <map:serializers default="html">
       
  -    	<!-- You can define your own Serializer for WriteableSourceTransformer to use -->
  +    	<!-- You can define your own Serializer for SourceWritingTransformer to use -->
       
   			<map:serializer
   				name="my-xml-serializer"
  @@ -17,18 +16,28 @@
   				<omit-xml-declaration>no</omit-xml-declaration>
   				<indent>2</indent>
   			</map:serializer>
  +
  +			<!-- Define an xhtml Serializer, in case you need people to edit HTML and have it remain xml well-formed -->
  +
  +			<map:serializer name="xhtml" mime-type="text/html" 
  +				src="org.apache.cocoon.serialization.XMLSerializer" pool-max="128" 
  +				pool-min="32" pool-grow="8" logger="sitemap.core">
  +				<doctype-public>-//W3C//DTD XHTML 1.0 Strict//EN</doctype-public>
  +				<doctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</doctype-system>
  +				<encoding>UTF-8</encoding>
  +			</map:serializer>
   			
       </map:serializers>
       <map:transformers default="xslt">
       
  -    	<!-- Define 'filewriter' as the name for WriteableSourceTransformer -->
  +    	<!-- Define 'sourcewriter' as the name for SourceWritingTransformer -->
       	<!-- You can set up the default Serialiser here -->
       	<!-- You can also set it in the invocation tag below -->
       	<!-- or place serializer="serializer-name" in the source:write tag -->
       	<!-- if you leave it out altogether, 'xml' is used -->
       
  -    	<map:transformer name="filewriter" logger="sitemap.transformer.tofile"
  -				src="org.apache.cocoon.transformation.WriteableSourceTransformer" label="source">
  +    	<map:transformer name="sourcewriter" logger="sitemap.transformer.tofile"
  +				src="org.apache.cocoon.transformation.SourceWritingTransformer" label="source">
   				<serializer>my-xml-serializer</serializer>
   			</map:transformer>
   			
  @@ -42,211 +51,165 @@
   		<map:view name="content" from-label="content">
   			<map:serialize type="xml"/>
   		</map:view>	
  +		<map:view name="agg" from-label="agg">
  +			<map:serialize type="xml"/>
  +		</map:view>	
   		<map:view name="source" from-label="source">
   			<map:serialize type="xml"/>
   		</map:view>	
   	</map:views>
   
     <map:pipelines>
  -
   		<map:pipeline internal-only="true">
  +			<!-- internal pipelines to collect and format the appropriate content based on the requested behaviour and sub-editor -->
  +			<!-- see below, the 'put' behaviour is different for 'file' and 'page' sub-editors -->
  +			<!-- all other behaviours currently ignore the sub-editor because I don't need them to do anything differnt at the moment -->
  +			<!-- If I do have this need later on, I still have to option of selecting diferent '2editor' stylesheets based on sub-editor name before I have to start making new matchers -->
  +
  +			<!-- directory listing, limited to the contents of your project's 'docs' folder -->
  +			<map:match pattern="fetch-dir(*,**,*)">
  +				<map:generate type="directory" src="docs{2}{3}/"/>						<!-- enforce the use of 'docs'-->
  +				<map:transform src="editor/stylesheets/dir2editor.xsl">
  +					<map:parameter name="sub-editor" value="{1}"/>
  +					<map:parameter name="target-dir" value="{2}{3}"/>
  +				</map:transform>
  +				<map:serialize type="xml"/>								
  +			</map:match>
   
  -			<!-- internal pipelines, so aggregation can be used with these components -->
  +			<!-- need a special one for the default directory -->
  +			<map:match pattern="fetch-dir(*)">
  +				<map:generate type="directory" src="docs/"/>						<!-- enforce the use of 'docs'-->
  +				<map:transform src="editor/stylesheets/dir2editor.xsl">
  +					<map:parameter name="sub-editor" value="{1}"/>
  +					<map:parameter name="target-dir" value="/"/>
  +				</map:transform>
  +				<map:serialize type="xml"/>								
  +			</map:match>
   
  -    	<!-- directory listing, limited to the contents of your project's 'docs' folder -->
  -			<map:match pattern="dir/**">
  -				<map:generate type="directory" src="docs/{1}"/>						<!-- enforce the use of 'docs'-->
  +			<!-- new page -->
  +			<!-- both my sub-editor edit the same doctype, so I can do everything from one template -->
  +			<!-- to have different templates, you need new sub-editors, and more specific pipelines to handle them -->
  +			<map:match pattern="fetch-new(*,**,*)">
  +				<map:generate src="editor/docs/template.xml"/>	<!-- get a template -->
  +				<map:transform src="editor/stylesheets/file2editor.xsl">
  +					<map:parameter name="sub-editor" value="{1}"/>
  +					<map:parameter name="target-file" value="{3}"/>
  +					<map:parameter name="target-dir" value="{2}"/>
  +				</map:transform>
   				<map:serialize type="xml"/>								
   			</map:match>
   
  -    	<!-- parse form data -->
  -			<map:match pattern="stream">
  +			<!-- parse form data for the "alpha" sub-editor -->
  +			<map:match pattern="fetch-put(alpha,**,*)">
   				<map:generate type="stream">
  -					<map:parameter name="form-name" value="content"/>
  +					<map:parameter name="form-name" value="xml-field"/>
   				</map:generate>
  -				<map:serialize type="xml"/>								
  +				<map:transform src="editor/stylesheets/stream2editor.xsl">
  +					<map:parameter name="sub-editor" value="alpha"/>
  +					<map:parameter name="target-file" value="{2}"/>
  +					<map:parameter name="target-dir" value="{1}"/>
  +					<map:parameter name="base" value="docs"/>
  +					<!-- enforce saving in docs folder of main project. Do not put a slash after docs, the target-dir already has the correct ones -->
  +				</map:transform>
  +				<map:serialize type="xml"/>
   			</map:match>
   
  -		</map:pipeline>
  -
  -
  -    <map:pipeline>
  +			<!-- parse form data for the "bravo" sub-editor -->
  +			<map:match pattern="fetch-put(bravo,**,*)">
  +				<map:generate type="request"/>
  +				<map:transform src="editor/stylesheets/request2editor.xsl">
  +					<map:parameter name="sub-editor" value="bravo"/>
  +					<map:parameter name="target-file" value="{2}"/>
  +					<map:parameter name="target-dir" value="{1}"/>
  +					<map:parameter name="base" value="docs"/>
  +					<!-- enforce saving in docs folder of main project. Do not put a slash after docs, the target-dir already has the correct ones -->
  +				</map:transform>
  +				<map:serialize type="xml"/>								
  +			</map:match>
   
  -    	<!-- the default page -->
  +			<!-- get or view a page, limited to the contents of your project's 'docs' folder -->
  +			<map:match pattern="fetch-*(*,**,*)">
  +				<map:generate src="docs{3}{4}"/>						<!-- enforce the use of 'docs'-->
  +				<map:transform src="editor/stylesheets/file2editor.xsl">
  +					<map:parameter name="sub-editor" value="{2}"/>
  +					<map:parameter name="target-file" value="{4}"/>
  +					<map:parameter name="target-dir" value="{3}"/>
  +					<map:parameter name="form-name" value="xml-field"/>
  +				</map:transform>
  +				<map:serialize type="xml"/>								
  +			</map:match>
  +		</map:pipeline>	
  +		
  +		<map:pipeline>	
  +			<!-- the default page -->
   			<map:match pattern="">
   				<map:redirect-to uri="welcome"/>
   			</map:match>
  +			
   			<map:match pattern="/">
   				<map:redirect-to uri="welcome"/>
   			</map:match>
  +			
   			<map:match pattern="welcome">
   				<map:generate src="editor/docs/welcome.xml"/>
   				<map:transform src="editor/stylesheets/simple-page2html.xsl"/>
   				<map:serialize type="html"/>					
   			</map:match>
   
  -    	<!-- directory images -->
  +			<!-- directory images -->
   			<map:match pattern="**image/*.gif">
   				<map:read src="editor/images/{2}.gif" mime-type="image/gif"/>
   			</map:match>
   
  +			<!-- general purpose behaviour pipelines -->
   
  -			<!--
  -			
  -				The behaviour pipelines
  -				
  -				Beware of the slashes added to the 'target-dir' parameter.
  -				The stylesheets expect to recieve directory paths with a slash at either end,
  -				so the Sitemap (who removed then dure to matching technique) must replace them.
  -				
  -				This is not the case for the 'put' behaviour, the 'target-dir' parameter 
  -				arrived complete in a form field, it was not derived by the sitemap.
  -				
  -				Also be careful of the various places where use of the parent sitemap's 'docs' folder is enforced
  -				
  -			-->
  -
  -    	<!-- view your site's pages in the editor -->
  -			<map:match pattern="view/**/*">
  -				<map:aggregate element="root" label="content">
  -					<map:part src="editor/docs/editor.xml"/>
  -					<map:part src="docs/{1}/{2}"/>													<!-- enforce the use of 'docs'-->
  -				</map:aggregate>
  -				<map:transform src="editor/stylesheets/editor-page2html.xsl">
  -					<map:parameter name="target-file" value="{2}"/>
  -					<map:parameter name="target-dir" value="/{1}/"/>
  -					<map:parameter name="behaviour" value="view"/>
  -				</map:transform>
  -				<map:serialize type="html"/>								
  -			</map:match>
  -
  -    	<!-- view your site's pages in the editor, from root -->
  -			<map:match pattern="view/*">
  -				<map:aggregate element="root" label="content">
  -					<map:part src="editor/docs/editor.xml"/>
  -					<map:part src="docs/{1}"/>															<!-- enforce the use of 'docs'-->
  -				</map:aggregate>
  -				<map:transform src="editor/stylesheets/editor-page2html.xsl">
  -					<map:parameter name="target-file" value="{1}"/>
  -					<map:parameter name="target-dir" value="/"/>
  -					<map:parameter name="behaviour" value="view"/>
  -				</map:transform>
  -				<map:serialize type="html"/>								
  -			</map:match>
  -
  -    	<!-- the any directory -->
  -			<map:match pattern="dir/**/">
  -				<map:aggregate element="root" label="content">
  -					<map:part src="editor/docs/editor.xml"/>
  -					<map:part src="cocoon:/dir/{1}"/>
  -				</map:aggregate>
  -				<map:transform src="editor/stylesheets/editor-page2html.xsl">
  -					<map:parameter name="target-dir" value="/{1}/"/>
  -					<map:parameter name="behaviour" value="dir"/>
  -				</map:transform>
  -				<map:serialize type="html"/>								
  -			</map:match>
  -
  -    	<!-- the default directory -->
  -			<map:match pattern="dir/">
  -				<map:aggregate element="root" label="content">
  -					<map:part src="editor/docs/editor.xml"/>
  -					<map:part src="cocoon:/dir/"/>
  -				</map:aggregate>
  -				<map:transform src="editor/stylesheets/editor-page2html.xsl">
  -					<map:parameter name="target-dir" value="/"/>
  -					<map:parameter name="behaviour" value="dir"/>
  -				</map:transform>
  -				<map:serialize type="html"/>								
  -			</map:match>
  -
  -    	<!-- make a new page with a form -->
  -			<map:match pattern="new/**/*">
  -				<map:aggregate element="root" label="content">
  -					<map:part src="editor/docs/editor.xml"/>
  -					<map:part src="editor/docs/template.xml"/>
  -				</map:aggregate>
  -				<map:transform src="editor/stylesheets/editor-page2html.xsl">
  -					<map:parameter name="target-file" value="{2}"/>
  -					<map:parameter name="target-dir" value="/{1}/"/>
  -					<map:parameter name="behaviour" value="new"/>
  -					<map:parameter name="form-name" value="content"/>
  -				</map:transform>
  -				<map:serialize type="html"/>
  -			</map:match>
  -
  -    	<!-- make a new page with a form in the root -->
  -			<map:match pattern="new/*">
  -				<map:aggregate element="root" label="content">
  -					<map:part src="editor/docs/editor.xml"/>
  -					<map:part src="editor/docs/template.xml"/>
  -				</map:aggregate>
  -				<map:transform src="editor/stylesheets/editor-page2html.xsl">
  -					<map:parameter name="target-file" value="{1}"/>
  -					<map:parameter name="target-dir" value="/"/>
  -					<map:parameter name="behaviour" value="new"/>
  -					<map:parameter name="form-name" value="content"/>
  -				</map:transform>
  -				<map:serialize type="html"/>
  -			</map:match>
  -
  -    	<!-- the get a page as a form -->
  -			<map:match pattern="get/**/*">
  -				<map:aggregate element="root" label="content">
  -					<map:part src="editor/docs/editor.xml"/>
  -					<map:part src="docs/{1}/{2}"/>													<!-- enforce the use of 'docs'-->
  +    	<!-- need a special one for the default directory -->
  +			<map:match pattern="dir(*)/">
  +				<map:aggregate element="dir" label="agg">
  +					<map:part src="editor/docs/{1}-config.xml"/>
  +					<map:part src="cocoon:raw:/fetch-dir({1})"/>
   				</map:aggregate>
  -				<map:transform src="editor/stylesheets/editor-page2html.xsl">
  -					<map:parameter name="target-file" value="{2}"/>
  -					<map:parameter name="target-dir" value="/{1}/"/>
  -					<map:parameter name="behaviour" value="get"/>
  -					<map:parameter name="form-name" value="content"/>
  -				</map:transform>
  -				<map:serialize type="html"/>								
  +				<map:transform src="editor/stylesheets/editor-page2html.xsl"/>
  +				<map:serialize type="xhtml"/>								
   			</map:match>
   
  -    	<!-- the get a page as a form from the root -->
  -			<map:match pattern="get/*">
  -				<map:aggregate element="root" label="content">
  -					<map:part src="editor/docs/editor.xml"/>
  -					<map:part src="docs/{1}"/>															<!-- enforce the use of 'docs'-->
  -				</map:aggregate>
  -				<map:transform src="editor/stylesheets/editor-page2html.xsl">
  -					<map:parameter name="target-file" value="{1}"/>
  -					<map:parameter name="target-dir" value="/"/>
  -					<map:parameter name="behaviour" value="get"/>
  -					<map:parameter name="form-name" value="content"/>
  -				</map:transform>
  -				<map:serialize type="html"/>								
  -			</map:match>
  -
  -    	<!-- the post a page from a form -->
  -    	<!-- unlike the other matchers, this one receives 'complete' paths ie. requires no addition of slashes -->
  -			<map:match pattern="put">
  +    	<!-- need a special one for put -->
  +			<map:match pattern="put(*)">
   				<map:act type="request">
   					<map:parameter name="parameters" value="true"/>
  -					<map:aggregate element="root" label="content">
  -						<map:part src="editor/docs/editor.xml"/>
  -						<map:part src="cocoon:/stream"/>
  +					<map:aggregate element="put" label="agg">
  +						<map:part src="editor/docs/{../1}-config.xml"/>
  +						<map:part src="cocoon:/fetch-put({../1},{target-dir},{target-file})"/>
   					</map:aggregate>
  -					<map:transform src="editor/stylesheets/stream2source.xsl">
  -						<map:parameter name="target-file" value="{target-file}"/>
  -						<map:parameter name="target-dir" value="docs{target-dir}"/><!-- enforce saving in docs folder of main project. Do not put a slash after docs, the target-dir already has the correct ones -->
  -					</map:transform>
  -					<map:transform type="filewriter"/>
  -					<map:transform src="editor/stylesheets/editor-page2html.xsl">
  -						<map:parameter name="target-file" value="{target-file}"/>
  -						<map:parameter name="target-dir" value="{target-dir}"/>
  -						<map:parameter name="behaviour" value="put"/>
  -					</map:transform>
  -					<map:serialize type="html"/>
  +					<map:transform type="sourcewriter"/>
  +					<map:transform src="editor/stylesheets/editor-page2html.xsl"/>
  +					<map:serialize type="xhtml"/>								
   				</map:act>						
   			</map:match>
   
  +    	<!-- get|view|put|new a page as a form or a view, in the document root -->
  +			<map:match pattern="*(*)/*">
  +				<map:aggregate element="{1}" label="agg">
  +					<map:part src="editor/docs/{2}-config.xml"/>
  +					<map:part src="cocoon:raw:/fetch-{1}({2},/,{3})"/>															<!-- enforce the use of 'docs'-->
  +				</map:aggregate>
  +				<map:transform src="editor/stylesheets/editor-page2html.xsl"/>
  +				<map:serialize type="xhtml"/>								
  +			</map:match>
  +
  +    	<!-- get|view|put|new a page as a form or a view, from the document root -->
  +			<map:match pattern="*(*)/**/*">
  +				<map:aggregate element="{1}" label="agg">
  +					<map:part src="editor/docs/{2}-config.xml"/>
  +					<map:part src="cocoon:raw:/fetch-{1}({2},/{3}/,{4})"/>
  +				</map:aggregate>
  +				<map:transform src="editor/stylesheets/editor-page2html.xsl"/>
  +				<map:serialize type="xhtml"/>
  +			</map:match>
  +
   			<map:handle-errors>
   				<map:transform src="context://stylesheets/system/error2html.xsl"/>
   				<map:serialize status-code="500"/>
  -				<!--<map:serialize type="xml" status-code="500"/>-->
   			</map:handle-errors>
   			<map:handle-errors type="404">
   				<map:transform src="context://stylesheets/system/error2html.xsl"/>
  @@ -254,5 +217,6 @@
   			</map:handle-errors>
   		
   		</map:pipeline>
  +
     </map:pipelines>
   </map:sitemap>
  
  
  
  1.2       +9 -9      xml-cocoon2/src/scratchpad/webapp/mount/editor/docs/source.xml
  
  Index: source.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/docs/source.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- source.xml	28 Feb 2002 19:05:11 -0000	1.1
  +++ source.xml	13 Mar 2002 19:19:42 -0000	1.2
  @@ -1,11 +1,11 @@
   <?xml version="1.0" encoding="utf-8"?>
   
   <page>
  - <title>WritableSourceTransformer</title>
  + <title>SourceWritingTransformer</title>
    <content>
   
     <para>
  -	NB: WritableSourceTransformer has replaced FileWritingTransformer.
  +	NB: SourceWritingTransformer has replaced FileWritingTransformer.
     </para>
   
     <para>Please try the <a href="tests">tests</a></para>
  @@ -16,7 +16,7 @@
     </para>
       
     <para>
  -   The contents of this tag are written to the specified WriteableSource when the document containing it is transformed by WritableSourceTransformer.
  +   The contents of this tag are written to the specified WriteableSource when the document containing it is transformed by SourceWritingTransformer.
     </para>
   
     <para>
  @@ -28,13 +28,13 @@
     </para>
       
     <para>
  -   WritableSourceTransformer is defined using XML like this:
  +   SourceWritingTransformer is defined using XML like this:
     </para>
     
     <para>
   <pre>
  - &lt;map:transformer name="filewriter" logger="sitemap.transformer.filewriter"
  -  src="org.apache.cocoon.transformation.WritableSourceTransformer"&gt;
  + &lt;map:transformer name="sourcewriter" logger="sitemap.transformer.filewriter"
  +  src="org.apache.cocoon.transformation.SourceWritingTransformer"&gt;
     [&lt;serializer&gt;my-xml-serializer&lt;/serializer&gt;]
    &lt;/map:transformer&gt;
   </pre>
  @@ -67,13 +67,13 @@
     
     
     <para>
  -   In the SiteMap, you use XML like this to add WritableSourceTransformer to the pipeline, 
  +   In the SiteMap, you use XML like this to add SourceWritingTransformer to the pipeline, 
      again specifying the Serializer to use here is optional.
     </para>
     
     <para>
   <pre>
  - &lt;map:transform type="filewriter"&gt;
  + &lt;map:transform type="sourcewriter"&gt;
     [&lt;map:parameter name="serialiser" value="my-xml-serialiser"/&gt;]
    &lt;/map:transform&gt;
   </pre>
  @@ -93,7 +93,7 @@
   <pre>
    &lt;source:write src="docs/result1.xml" [serializer="my-xml-serializer"]&gt;
     &lt;page&gt;
  -   &lt;title&gt;WritableSourceTransformer Test Result 1&lt;/title&gt;
  +   &lt;title&gt;SourceWritingTransformer Test Result 1&lt;/title&gt;
      &lt;content&gt;
       &lt;para&gt;Congratulations!&lt;/para&gt;
      &lt;/content&gt;
  
  
  
  1.3       +3 -3      xml-cocoon2/src/scratchpad/webapp/mount/editor/docs/tests.xml
  
  Index: tests.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/docs/tests.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- tests.xml	28 Feb 2002 19:05:11 -0000	1.2
  +++ tests.xml	13 Mar 2002 19:19:42 -0000	1.3
  @@ -1,10 +1,10 @@
   <?xml version="1.0" encoding="utf-8"?>
   
   <page>
  - <title>WritableSourceTransformer Tests</title>
  + <title>SourceWritingTransformer Tests</title>
    <content>
     <para>
  -	NB: WritableSourceTransformer has replaced FileWritingTransformer.
  +	NB: SourceWritingTransformer has replaced FileWritingTransformer.
     </para>
     <para>
   	Tests: Please run these tests and report any problems.
  @@ -22,7 +22,7 @@
   	Test 4: <a href="test/4">Test 4</a>: the XInclude test, makes <a href="result/4">Result 4</a>, having XIncluded the content earlier in the pipeline.
     </para>
     <para>
  -	Test 5: <a href="test/5">Test 5</a>: the XSLT test, a <a href="../../view-source?filename=mount/editor/stylesheets/make-page.xsl">StyleSheet</a> makes <a href="result/5">Result 5</a>, from parts of <a href="test/5">Test 5</a>.
  +	Test 5: <a href="test/5">Test 5</a>: the XSLT test, a <a target="source" href="../../view-source?filename=mount/editor/tests/make-page.xsl">StyleSheet</a> makes <a href="result/5">Result 5</a>, from parts of <a href="test/5">Test 5</a>.
     </para>
     
    </content>
  
  
  
  1.5       +1 -1      xml-cocoon2/src/scratchpad/webapp/mount/editor/docs/welcome.xml
  
  Index: welcome.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/docs/welcome.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- welcome.xml	28 Feb 2002 19:05:11 -0000	1.4
  +++ welcome.xml	13 Mar 2002 19:19:42 -0000	1.5
  @@ -7,7 +7,7 @@
   </para>
     <para>Please try out the demo file editor <a href="edit/">&lt;slash-edit/&gt;</a>
   </para>
  -  <para>This suite uses the <a href="source">WriteableSourceTransformer</a>
  +  <para>This suite uses the <a href="source">SourceWritingTransformer</a>
   </para>
     
    </content>
  
  
  
  1.3       +30 -12    xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/docs/welcome.xml
  
  Index: welcome.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/docs/welcome.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- welcome.xml	28 Feb 2002 19:05:12 -0000	1.2
  +++ welcome.xml	13 Mar 2002 19:19:42 -0000	1.3
  @@ -1,12 +1,12 @@
   <?xml version="1.0" encoding="utf-8"?>
   <page>
    <title>&lt;slash-edit/&gt;</title>
  - <content>
  + <content> <!-- Yea, I know, this file is crap, I could do better but my priority is new functionality ;) -->
    
    <para>
    	How to use &lt;slash-edit/&gt;
    		<para>
  - 			Top right you see some icons, this is &lt;slash-edit/&gt;'s toolbar.
  + 			Top right you wil see some icons, this is &lt;slash-edit/&gt;'s toolbar. The icons look like this:
    		</para><para>
    			<img src="image/dir.gif"/> Gives you a Directory Listing of your current directory inside your project's 'docs' directory.
    		</para><para>
  @@ -16,11 +16,27 @@
    		</para><para>
    			<img src="image/view.gif"/> View this file in the editor, useful for proof reading etc.
    		</para><para>
  - 			There is no Delete function available, though you can overwrite files.
  + 			There is no Delete function available, though you can overwrite files (no questions asked!).
    		</para><para>
    			If you need to make a new directory, add it's name to the path field when you go to save a file.
    		</para>
    </para>
  +
  + <para>
  + 	Sample Editors
  + 		<para>
  + 			<a href="dir(alpha)/"><b>Alpha Editor</b></a> - Uses the StreamGenerator to parse the Request, allowing you to edit the entire source XML as tags. 
  + 			No XML validation is available, if your XML is not well-formed, partial XML overwites the original!
  + 		</para>
  + 		<para>
  + 			<a href="new(bravo)/"><b>Bravo Editor</b></a> - Uses the RequestGenerator and XSLT to dissassemble a very simple doctype into seperate fields that can contain <b>no XML</b>.
  + 			&lt;para/&gt; tags in the source are converted to double line breaks in the form, then converted back to &lt;para/&gt; tags again on submit.
  + 			&lt;br/&gt; tags are converted to and from single line breaks, inside the paragraphs.
  + 			<b>Because of this simplistic approach</b>, this editor is unable to properly edit most of the files already in the docs directory
  + 			because they use nested &lt;para/&gt; and other tags. Nested paragraphs would become un-nested, other tags would be converted to Entities.
  + 			<b>Please make a new file first, when you try out this editor</b>.
  + 		</para>
  + </para>
    
    <para>
   		To make use of it in your project, I envisage the following:
  @@ -33,7 +49,7 @@
   			</pre>
   			<table>
   				<tr>
  -					<td colspan="3">You copy to the root of your project (where the sitemap is) the following:</td>
  +					<td colspan="3">You copy to the root of your project (where the sitemap is) the following (from cocoon/mount/editor/) :</td>
   				</tr>
   				<tr>
   					<td>&#160;&#160;</td> <td>editor.xmap</td> <td>- the sitemap for the editor</td>
  @@ -43,13 +59,12 @@
   				</tr>
   			</table>
   		</para>
  -			
   		<para>
   		You make adjustments to the editor.xmap incase your project's files do not reside in 'docs'.
   		</para><para>
   		You make any necessary adjustments to the stylesheets in editor/stylesheets to cope with the structure of the documents you use in your project (the samples use cocoon's 'simple-page' style).
   		</para><para>
  -		You make any stylistic adjustments required to how the editor looks.
  +		You make any stylistic adjustments required to how the editors look.
   		</para><para>
   		You add an appropriate authentication mechanism to protect anything inside '/edit'.
   		</para><para>
  @@ -62,7 +77,7 @@
   				<td colspan="3">Components Used:</td>
   			</tr>
   			<tr valign="top">
  -				<td>&#160;&#160;</td><td>WriteableSourceTransformer</td><td>Serialises part of the SAX stream to disk</td>
  +				<td>&#160;&#160;</td><td>WriteableSourceTransformer</td><td>Sends part of the SAX stream to a WriteableSource</td>
   			</tr>
   			<tr valign="top">
   				<td></td><td>DirectoryGenerator</td><td>Generates a directory listing</td>
  @@ -73,6 +88,9 @@
   			<tr valign="top">
   				<td></td><td>StreamGenerator</td><td>Generates XML by parsing a named form field in the Request</td>
   			</tr>
  +			<tr valign="top">
  +				<td></td><td>RequestGenerator</td><td>Generates XMLfrom the form fields in the Request</td>
  +			</tr>
   		</table>
     </para>
   		<table>
  @@ -80,19 +98,19 @@
   				<td colspan="4">commands:</td>
   			</tr>
   			<tr>
  -				<td>&#160;&#160;</td><td>dir</td><td>your-project/edit/<b>dir</b>/path/to/directory/</td><td>gives you a directory listing</td>
  +				<td>&#160;&#160;</td><td>dir</td><td>your-project/edit/<b>dir(sub-editor)</b>/path/to/directory/</td><td>gives you a directory listing</td>
   			</tr>
   			<tr valign="top">
  -				<td></td><td>view</td><td>your-project/edit/<b>view</b>/path/to/file</td><td>views your page within the editor (it is not going to look the same, outside the context of your project)</td>
  +				<td></td><td>view</td><td>your-project/edit/<b>view(sub-editor)</b>/path/to/file</td><td>views your page within the editor (it is not going to look the same, outside the context of your project)</td>
   			</tr>
   			<tr valign="top">
  -				<td></td><td>get</td><td>your-project/edit/<b>get</b>/path/to/file</td><td>converts the file into an HTML Form for editing</td>
  +				<td></td><td>get</td><td>your-project/edit/<b>get(sub-editor)</b>/path/to/file</td><td>converts the file into an HTML Form for editing</td>
   			</tr>
   			<tr valign="top">
  -				<td></td><td>new</td><td>your-project/edit/<b>new</b>/path/to/file</td><td>gives you a Form made from a template to make a new file at that location</td>
  +				<td></td><td>new</td><td>your-project/edit/<b>new(sub-editor)</b>/path/to/file</td><td>gives you a Form made from a template to make a new file at that location</td>
   			</tr>
   			<tr valign="top">
  -				<td></td><td>put</td><td>your-project/edit/<b>put</b></td><td>receives a Form, writing the contents back to File</td>
  +				<td></td><td>put</td><td>your-project/edit/<b>put(sub-editor)</b></td><td>receives a Form, writing the contents back to File</td>
   			</tr>
   		</table>
    </content>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/docs/alpha-config.xml
  
  Index: alpha-config.xml
  ===================================================================
  <?xml version="1.0" encoding="utf-8"?>
  
  <config title="&lt;slash-edit/&gt; alpha">
  
  <!-- Use this file to modify the text the editor displays -->
  <!-- if you want to change the names of the 'behaviours' make the same changes in the editor.xmap! -->
  
  <!-- Various display strings -->
  	<title behaviour="new">Make a new Page</title>
  	<title behaviour="get">Edit a Page</title>
  	<title behaviour="put">Save Results</title>
  	<title behaviour="view">View a Page</title>
  	<title behaviour="dir">Directory Listing</title>
  	
  	<notify behaviour="new">Making a new File at</notify>
  	<notify behaviour="get">Editing the File at</notify>
  	<notify behaviour="put">Results of saving a file at</notify>
  	<notify behaviour="view">Viewing the File at</notify>
  	<notify behaviour="dir">Directory Listing of</notify>
  
  	<notes behaviour="new">Please edit the XML, then click the 'Make New File' button above</notes>
  	<notes behaviour="get">Please edit the XML, then click the 'Save My Changes' button above</notes>
  	<notes behaviour="put">Thanks for using &lt;slash-edit/&gt;</notes>
  	<notes behaviour="view">This is the editor-view of your file, internal links are not likely to work correctly.</notes>
  	<notes behaviour="dir">Please choose a file to view</notes>
  
  <!-- The commands -->
  	<command behaviour="new" tip="Make a new File" icon="new.gif">new(alpha)</command>
  	<command behaviour="get" tip="Edit this File" icon="get.gif">get(alpha)</command>
  	<command behaviour="put">put(alpha)</command>
  	<command behaviour="view" tip="View this File" icon="view.gif">view(alpha)</command>
  	<command behaviour="dir" tip="View Directory listing" icon="dir.gif">dir(alpha)</command>
  
  <!-- text for form buttons -->	
  	<button behaviour="new">Make New File</button>
  	<button behaviour="get">Save My Changes</button>
  
  <!-- the tools available to each behaviour -->
  	<tools behaviour="new">
  		<tool command="dir"/>
  		<tool command="new"/>
  	</tools>
  	<tools behaviour="get">
  		<tool command="dir"/>
  		<tool command="new"/>
  		<tool command="view"/>
  	</tools>
  	<tools behaviour="put">
  		<tool command="dir"/>
  		<tool command="new"/>
  		<tool command="get"/>
  		<tool command="view"/>
  	</tools>
  	<tools behaviour="view">
  		<tool command="dir"/>
  		<tool command="new"/>
  		<tool command="get"/>
  	</tools>
  	<tools behaviour="dir">
  		<tool command="new"/>
  	</tools>
  
  <!-- what to call the parent directory link -->
  	<parent-dir tip="View Parent Directory listing">..</parent-dir>
  <!-- what to call the field the XML goes in -->
  	<xml-field-name>xml-field</xml-field-name>
  </config>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/docs/bravo-config.xml
  
  Index: bravo-config.xml
  ===================================================================
  <?xml version="1.0" encoding="utf-8"?>
  
  <config title="&lt;slash-edit/&gt; bravo">
  
  <!-- Use this file to modify the text the editor displays -->
  <!-- if you want to change the names of the 'behaviours' make the same changes in the editor.xmap! -->
  
  <!-- Various display strings -->
  	<title behaviour="new">Make a new Page</title>
  	<title behaviour="get">Edit a Page</title>
  	<title behaviour="put">Save Results</title>
  	<title behaviour="view">View a Page</title>
  	<title behaviour="dir">Directory Listing</title>
  	
  	<notify behaviour="new">Making a new Page at</notify>
  	<notify behaviour="get">Editing the Page at</notify>
  	<notify behaviour="put">Results of saving a Page at</notify>
  	<notify behaviour="view">Viewing the Page at</notify>
  	<notify behaviour="dir">Directory Listing of</notify>
  
  	<notes behaviour="new">Please edit the XML, then click the 'Make New Page' button above</notes>
  	<notes behaviour="get">Please edit the XML, then click the 'Save My Changes' button above</notes>
  	<notes behaviour="put">Thanks for using &lt;slash-edit/&gt;</notes>
  	<notes behaviour="view">This is the editor-view of your Page, internal links are not likely to work correctly.</notes>
  	<notes behaviour="dir">Please choose a file to view</notes>
  
  <!-- The commands -->
  	<command behaviour="new" tip="Make a new File" icon="new.gif">new(bravo)</command>
  	<command behaviour="get" tip="Edit this File" icon="get.gif">get(bravo)</command>
  	<command behaviour="put">put(bravo)</command>
  	<command behaviour="view" tip="View this File" icon="view.gif">view(bravo)</command>
  	<command behaviour="dir" tip="View Directory listing" icon="dir.gif">dir(bravo)</command>
  
  <!-- text for form buttons -->	
  	<button behaviour="new">Make New Page</button>
  	<button behaviour="get">Save My Changes</button>
  
  <!-- the tools available to each behaviour -->
  	<tools behaviour="new">
  		<tool command="dir"/>
  		<tool command="new"/>
  	</tools>
  	<tools behaviour="get">
  		<tool command="dir"/>
  		<tool command="new"/>
  		<tool command="view"/>
  	</tools>
  	<tools behaviour="put">
  		<tool command="dir"/>
  		<tool command="new"/>
  		<tool command="get"/>
  		<tool command="view"/>
  	</tools>
  	<tools behaviour="view">
  		<tool command="dir"/>
  		<tool command="new"/>
  		<tool command="get"/>
  	</tools>
  	<tools behaviour="dir">
  		<tool command="new"/>
  	</tools>
  
  <!-- what to call the parent directory link -->
  	<parent-dir tip="View Parent Directory listing">..</parent-dir>
  </config>
  
  
  
  1.3       +14 -49    xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/editor-components.xsl
  
  Index: editor-components.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/editor-components.xsl,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- editor-components.xsl	28 Feb 2002 19:05:12 -0000	1.2
  +++ editor-components.xsl	13 Mar 2002 19:19:42 -0000	1.3
  @@ -6,67 +6,31 @@
    xmlns:source="http://apache.org/cocoon/source/1.0">
   
   
  +<!-- generic behaviour templates -->
   
  -<!-- your form for editing content -->
  -	<xsl:template match="page" mode="form">
  -		<form method="post">
  -			<xsl:attribute name="action"><xsl:value-of select="$command-base"/><xsl:value-of select="$config/command[@behaviour = 'put']/text()"/></xsl:attribute>
  -			<table border="0" cellspacing="0" cellpadding="5" width="100%">
  -				<tr>
  -					<td colspan="2"><textarea name="{$form-name}" rows="20" cols="80" xml:space="preserve" onchange="changed=true;"><xsl:apply-templates select="."/></textarea></td>
  -				</tr>
  -				<tr>
  -					<td valign="middle">
  -						<span class="caption">Save as:</span> <input type="text" name="target-file" value="{$newfile}" size="40" title="Note: to make a new directory, prepend the filename with a directory path"/>
  -					</td>
  -					<td align="right">
  -						<input type="hidden" name="target-dir" value="{$target-dir}"/>
  -						<input type="submit" value="{$config/button[@behaviour = $behaviour]}"/>
  -					</td>
  -				</tr>
  -			</table>						
  -		</form>	
  +	<xsl:template match="/*/editor/*" mode="sub-editor">
  +		<xsl:apply-templates select="."/>	
     </xsl:template>
   
  -<!-- supply mode="view" templates for your project's document elements, used only in view-mode -->
  -
  -	<xsl:template match="page" mode="view">
  -		<div class="page"><xsl:apply-templates mode="view"/></div>		
  +	<xsl:template match="/view/editor/page" mode="sub-editor">
  +		<xsl:apply-templates mode="editor-view"/>	
     </xsl:template>
   
  -	<xsl:template match="content" mode="view">
  -		<div class="content"><xsl:apply-templates mode="view"/></div>
  +
  +<!-- editor-view templates to display your doctype -->
  +
  +	<xsl:template match="content" mode="editor-view">
  +		<div class="content"><xsl:apply-templates mode="editor-view"/></div>
     </xsl:template>
     
  -	<xsl:template match="title" mode="view">
  +	<xsl:template match="title" mode="editor-view">
   		<h2><xsl:apply-templates/></h2>
     </xsl:template>
     
  -	<xsl:template match="para" mode="view">
  +	<xsl:template match="para" mode="editor-view">
   		<p><xsl:apply-templates/></p>
     </xsl:template>
   
  -<!-- output the tools for this page -->
  -	<xsl:template match="tools">
  -		<xsl:for-each select="tool">
  -			<xsl:variable name="com" select="@command"/>
  -			<xsl:variable name="command" select="$config/command[@behaviour = $com]"/>
  -			<td width="20">
  -				<a title="{$command/@tip}">
  -					<xsl:attribute name="href">
  -						<xsl:if test="$is-form = 'true'"><xsl:text>javascript:exit('</xsl:text></xsl:if>
  -						<xsl:choose>
  -							<xsl:when test="$com = 'dir'"><xsl:value-of select="$command-base"/><xsl:value-of select="$command/text()"/><xsl:value-of select="$target-dir"/></xsl:when>
  -							<xsl:otherwise><xsl:value-of select="$command-base"/><xsl:value-of select="$command/text()"/><xsl:value-of select="$target-path"/></xsl:otherwise>
  -						</xsl:choose>
  -						<xsl:if test="$is-form = 'true'"><xsl:text>');</xsl:text></xsl:if>
  -					</xsl:attribute>
  -					<img src="{concat('image/',$command/@icon)}" border="0"/>
  -				</a>
  -			</td>
  -		</xsl:for-each>
  -	</xsl:template>
  -
   <!-- Displays the directory listing -->
     <xsl:template match="dir:directory">
      <table border="0" cellspacing="0" cellpadding="5" width="100%" bgcolor="white">
  @@ -159,7 +123,8 @@
   						<xsl:choose>
   							<xsl:when test="@action = 'none'">None taken</xsl:when>
   							<xsl:when test="@action = 'new'">New file created</xsl:when>
  -							<xsl:otherwise>Existing file overwritten</xsl:otherwise>
  +							<xsl:when test="@action = 'overwritten'">Existing file overwritten</xsl:when>
  +							<xsl:otherwise>Unknown</xsl:otherwise>
   						</xsl:choose>
   					</td>
   				</tr>
  
  
  
  1.3       +35 -17    xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/editor-page2html.xsl
  
  Index: editor-page2html.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/editor-page2html.xsl,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- editor-page2html.xsl	28 Feb 2002 19:05:12 -0000	1.2
  +++ editor-page2html.xsl	13 Mar 2002 19:19:42 -0000	1.3
  @@ -2,25 +2,26 @@
   
   <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  - xmlns:dir="http://apache.org/cocoon/directory/2.0"
  - xmlns:source="http://apache.org/cocoon/source/1.0">
  + >
   
   	<!-- 
   		This is the main Editor Stylesheet
  -		It adapts itself to the particular command being sent in the 'behaviour' parameter.
  -		It uses information stored in 'editor/docs/editor.xml' to work out the commands, static strings etc.
  +		It adapts itself to the particular command being sent in the structure of the XML.
  +		It uses information stored in 'editor/docs/[sub-editor]-config.xml' to work out the commands, static strings etc.
   	-->
   
   	<xsl:include href="editor-utils.xsl"/>								<!-- utility templates and variables -->
  -	<xsl:include href="editor-components.xsl"/>						<!-- special display templates -->
  +	<xsl:include href="editor-components.xsl"/>						<!-- generic editor display templates -->
  +	<xsl:include href="editor-alpha-components.xsl"/>			<!-- "alpha" sub-editor display templates -->
  +	<xsl:include href="editor-bravo-components.xsl"/>			<!-- "bravo" sub-editor display templates -->
  +	<!-- add your "sub-editors" here -->
   
  -	<xsl:template match="root">
  +	<xsl:template match="get|new|view|put|dir">
      <html>
      <head>
       <title><xsl:value-of select="$config/@title"/> - <xsl:value-of select="$config/title[@behaviour = $behaviour]"/> - <xsl:value-of select="title"/></title>
       <xsl:if test="$is-form = 'true'">
   			<script lang="JavaScript"><![CDATA[
  -				<!--
   				var changed = false;
   				function exit(to){
   					if (changed == true) {
  @@ -31,7 +32,7 @@
   						document.location.href = to;
   					}
   					//return false;
  -				}//-->]]>
  +				}]]>
   			</script>
       </xsl:if>
       
  @@ -67,10 +68,9 @@
         <tr>
          <td bgcolor="white">
           <xsl:choose>
  -					<xsl:when test="$behaviour = 'new' or $behaviour = 'get'"><xsl:apply-templates select="page" mode="form"/></xsl:when>
  -					<xsl:when test="$behaviour = 'put'"><xsl:apply-templates select="source:write"/></xsl:when>
  -					<xsl:when test="$behaviour = 'view'"><xsl:apply-templates select="page" mode="view"/></xsl:when>
  -					<xsl:when test="$behaviour = 'dir'"><xsl:apply-templates select="dir:directory"/></xsl:when>
  +        	<!-- add your "sub-editors" here -->
  +					<xsl:when test="editor[@sub-editor = 'alpha']"><xsl:apply-templates select="editor/*" mode="sub-editor"/></xsl:when>
  +					<xsl:when test="editor[@sub-editor = 'bravo']"><xsl:apply-templates select="editor/*" mode="sub-editor"/></xsl:when>
   					<xsl:otherwise>Houston, we have a problem.</xsl:otherwise>
   				</xsl:choose>
          </td>
  @@ -86,8 +86,8 @@
         </tr>
        </table>
        </center>
  -		<!--	debug
  -			<table>
  +
  +		<!--	debug			<table>
   				<tr>
   					<td>target-file</td> <td><xsl:value-of select="$target-file"/></td>
   				</tr>
  @@ -97,9 +97,6 @@
   				<tr>
   					<td>behaviour</td> <td><xsl:value-of select="$behaviour"/></td>
   				</tr>
  -				<tr>
  -					<td>form-name</td> <td><xsl:value-of select="$form-name"/></td>
  -				</tr>
   			</table>  -->
   		<!-- / debug  -->
   		
  @@ -113,5 +110,26 @@
       </body>
      </html>
     </xsl:template>
  +
  +<!-- output the tools for this page -->
  +	<xsl:template match="tools">
  +		<xsl:for-each select="tool">
  +			<xsl:variable name="com" select="@command"/>
  +			<xsl:variable name="command" select="$config/command[@behaviour = $com]"/>
  +			<td width="20">
  +				<a title="{$command/@tip}">
  +					<xsl:attribute name="href">
  +						<xsl:if test="$is-form = 'true'"><xsl:text>javascript:exit('</xsl:text></xsl:if>
  +						<xsl:choose>
  +							<xsl:when test="$com = 'dir'"><xsl:value-of select="$command-base"/><xsl:value-of select="$command/text()"/><xsl:value-of select="$target-dir"/></xsl:when>
  +							<xsl:otherwise><xsl:value-of select="$command-base"/><xsl:value-of select="$command/text()"/><xsl:value-of select="$target-path"/></xsl:otherwise>
  +						</xsl:choose>
  +						<xsl:if test="$is-form = 'true'"><xsl:text>');</xsl:text></xsl:if>
  +					</xsl:attribute>
  +					<img src="{concat('image/',$command/@icon)}" border="0"/>
  +				</a>
  +			</td>
  +		</xsl:for-each>
  +	</xsl:template>
   
   </xsl:stylesheet>
  
  
  
  1.2       +6 -6      xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/editor-utils.xsl
  
  Index: editor-utils.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/editor-utils.xsl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- editor-utils.xsl	22 Feb 2002 22:15:35 -0000	1.1
  +++ editor-utils.xsl	13 Mar 2002 19:19:42 -0000	1.2
  @@ -4,14 +4,12 @@
   	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   >
   
  -<!-- standard SiteMap parameters -->
  -	<xsl:param name="target-file"/>
  -	<xsl:param name="target-dir"/>
  -	<xsl:param name="behaviour"/>
  -	<xsl:param name="form-name"/>
  +	<xsl:variable name="target-file" select="/*/editor/@target-file"/>
  +	<xsl:variable name="target-dir" select="/*/editor/@target-dir"/>
  +	<xsl:variable name="behaviour" select="local-name(/*)"/>
   
   <!-- the aggregated editor-config document -->
  -	<xsl:variable name="config" select="/root/editor"/>
  +	<xsl:variable name="config" select="/*/config"/>
   
   <!-- the relative base for commands -->
   	<xsl:variable name="command-base">
  @@ -38,7 +36,9 @@
   <!-- what to give as the default name of a new file -->
   	<xsl:variable name="newfile">
   		<xsl:choose>
  +			<!--<xsl:when test="$behaviour != 'new' and $target-file != ''"><xsl:value-of select="$target-file"/></xsl:when>-->
   			<xsl:when test="$target-file != ''"><xsl:value-of select="$target-file"/></xsl:when>
  +			<xsl:when test="$config/default-new-file"><xsl:value-of select="$config/default-new-file"/></xsl:when>
   			<xsl:otherwise>new.xml</xsl:otherwise>
   		</xsl:choose>
   	</xsl:variable>
  
  
  
  1.3       +2 -14     xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/simple-page2html.xsl
  
  Index: simple-page2html.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/simple-page2html.xsl,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- simple-page2html.xsl	28 Feb 2002 19:05:12 -0000	1.2
  +++ simple-page2html.xsl	13 Mar 2002 19:19:42 -0000	1.3
  @@ -25,21 +25,9 @@
       <body bgcolor="white">
   		 <center>
        <h1>&#160;<xsl:value-of select="title"/> - site editor demo</h1>
  -     <table border="0" cellspacing="1" cellpadding="0" bgcolor="#0086B2" width="90%">
  +     <table border="0" cellspacing="1" cellpadding="5" bgcolor="#0086B2" width="90%">
         <tr>
  -       <td>
  -				<table border="0" cellspacing="0" cellpadding="5" width="100%" bgcolor="white">
  -					<tr>
  -						<td class="notify"><b>Welcome to &lt;slash-edit/&gt;</b></td>
  -						<td width="20">
  -							<a title="View Directory listing" href="dir/"><img src="image/dir.gif" border="0"/></a>
  -						</td>
  -						<td width="20">
  -							<a title="Make a new File" href="new/"><img src="image/new.gif" border="0"/></a>
  -						</td>
  -					</tr>
  -				</table>
  -       </td>
  +       <td class="notify"><b>Welcome to &lt;slash-edit/&gt;</b></td>
         </tr>
         <tr>
          <td bgcolor="white">
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/dir2editor.xsl
  
  Index: dir2editor.xsl
  ===================================================================
  <?xml version="1.0"?>
  
  <xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:dir="http://apache.org/cocoon/directory/2.0"
   >
  
  	<xsl:param name="sub-editor"/>
  	<xsl:param name="target-file"/>
  	<xsl:param name="target-dir"/>
  	 
  	<xsl:template match="/">
  		<editor sub-editor="{$sub-editor}" target-file="{$target-file}" target-dir="{$target-dir}">
  			<xsl:copy>
  				<xsl:apply-templates select="@*|*"/>
  			</xsl:copy>
  		</editor>
  	</xsl:template>
  <!-- copy anything -->
    <xsl:template match="@*|node()" priority="-2"><xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy></xsl:template>
    <xsl:template match="text()" priority="-1"><xsl:value-of select="."/></xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/editor-alpha-components.xsl
  
  Index: editor-alpha-components.xsl
  ===================================================================
  <?xml version="1.0"?>
  
  <xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  >
  
  
  
  <!-- your form for editing 'page' doctype content, handles the 'alpha' sub-editor for 'get' and 'new' behaviours -->
  
  	<xsl:template match="/get/editor[@sub-editor = 'alpha']/page|/new/editor[@sub-editor = 'alpha']/page" mode="sub-editor">
  		<form method="post">
  			<xsl:attribute name="action"><xsl:value-of select="$command-base"/><xsl:value-of select="$config/command[@behaviour = 'put']"/></xsl:attribute>
  			<table border="0" cellspacing="0" cellpadding="5" width="100%">
  				<tr>
  					<td colspan="2"><textarea name="{$config/xml-field-name}" rows="20" cols="80" xml:space="preserve" onchange="changed=true;"><xsl:apply-templates select="."/></textarea></td>
  				</tr>
  				<tr>
  					<td valign="middle">
  						<span class="caption">Save as:</span> <input type="text" name="target-file" value="{$newfile}" size="40" title="Note: to make a new directory, prepend the filename with a directory path"/>
  					</td>
  					<td align="right">
  						<input type="hidden" name="target-dir" value="{$target-dir}"/>
  						<input type="hidden" name="xml-field-name" value="{$config/xml-field-name}"/>
  						<input type="submit" value="{$config/button[@behaviour = $behaviour]}"/>
  					</td>
  				</tr>
  			</table>						
  		</form>
    </xsl:template>
  
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/editor-bravo-components.xsl
  
  Index: editor-bravo-components.xsl
  ===================================================================
  <?xml version="1.0"?>
  
  <xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:dir="http://apache.org/cocoon/directory/2.0"
   xmlns:source="http://apache.org/cocoon/source/1.0">
  
  <!-- your form for editing 'page' doctype content, handles the 'bravo' sub-editor for 'get' and 'new' behaviours -->
  	<xsl:template match="/get/editor[@sub-editor = 'bravo']/page|/new/editor[@sub-editor = 'bravo']/page" mode="sub-editor">
  		<form method="post">
  			<xsl:attribute name="action"><xsl:value-of select="$command-base"/><xsl:value-of select="$config/command[@behaviour = 'put']"/></xsl:attribute>
  			<table border="0" cellspacing="0" cellpadding="5" width="100%">
  				<tr>
  					<td><span class="caption">Title</span> <input name="title" size="40"  onchange="changed=true;" value="{normalize-space(title)}"/></td>
  				</tr>
  				<tr>
  					<td colspan="2"><textarea name="content" rows="20" cols="80" xml:space="preserve" onchange="changed=true;"><xsl:apply-templates select="content/*" mode="bravo"/></textarea></td>
  				</tr>
  				<tr>
  					<td valign="middle">
  						<span class="caption">Save as:</span> <input type="text" name="target-file" value="{$newfile}" size="40" title="Note: to make a new directory, prepend the filename with a directory path"/>
  					</td>
  					<td align="right">
  						<input type="hidden" name="target-dir" value="{$target-dir}"/>
  						<input type="submit" value="{$config/button[@behaviour = $behaviour]}"/>
  					</td>
  				</tr>
  			</table>						
  		</form>	
    </xsl:template>
  
  	<xsl:template match="para" mode="bravo"><!-- also strips 'br' tags, so they need a CR after them to survive! -->
  		<xsl:value-of select="."/>
  		<xsl:text>
  
  </xsl:text>
  	</xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/file2editor.xsl
  
  Index: file2editor.xsl
  ===================================================================
  <?xml version="1.0"?>
  
  <xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   >
  
  	<xsl:param name="sub-editor"/>
  	<xsl:param name="target-file"/>
  	<xsl:param name="target-dir"/>
  	 
  	<xsl:template match="page">
  		<editor sub-editor="{$sub-editor}" target-file="{$target-file}" target-dir="{$target-dir}">
  			<xsl:copy>
  				<xsl:apply-templates select="@*|*" mode="copy"/>
  			</xsl:copy>
  		</editor>
  	</xsl:template>
  <!-- copy anything -->
    <xsl:template match="@*|node()" mode="copy"><xsl:copy><xsl:apply-templates select="@*|node()" mode="copy"/></xsl:copy></xsl:template>
    <xsl:template match="text()" mode="copy"><xsl:value-of select="."/></xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/request2editor.xsl
  
  Index: request2editor.xsl
  ===================================================================
  <?xml version="1.0"?>
  
  <xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:source="http://apache.org/cocoon/source/1.0"
   xmlns:request="http://xml.apache.org/cocoon/requestgenerator/2.0"
   >
  
  <!-- 
  
  	This StyleSheet converts the output of the RequestGenerator into the new 'page'
  	then wraps it with 'source:write' tags, so the SourceWritingTransformer can save it.
  	
  	It looks for double CRs in the submitted text and makes paragraphs from them using the 'para' tag.
  	It then looks inside the paragraphs for single CRs and inserts a 'br' tag if found.
  	
  	All other tags are saved as Entities.
  
  	NB. the indentation of these templates effects the output document
  		
  -->
  
  
  
  	<xsl:param name="sub-editor"/>
  	<xsl:param name="target-file"/>
  	<xsl:param name="target-dir"/>
  	<xsl:param name="base"/>
  
  
  <xsl:template match="/">
  <editor sub-editor="{$sub-editor}" target-file="{$target-file}" target-dir="{$target-dir}">
  <source:write src="{concat($base,$target-dir,$target-file)}" xml:space="preserve">
  <page>
  	<title><xsl:value-of select="request:request/request:requestParameters/request:parameter[@name = 'title']/request:value"/></title>
  	<content>
  		<xsl:call-template name="cr2para">
  			<xsl:with-param name="text"><xsl:value-of select="translate(request:request/request:requestParameters/request:parameter[@name = 'content']/request:value,'&#x9;&#xA;','')"/></xsl:with-param>
  		</xsl:call-template>
  	</content>
  </page>		
  </source:write>
  </editor>
  </xsl:template>
  
  <!-- convert double CRs to 'para' tags -->
  <xsl:template name="cr2para">
  	<xsl:param name="text"/>
  	<xsl:choose>
  		<xsl:when test="normalize-space(substring-before($text,'&#xD;&#xD;')) != ''">
  			<para><xsl:call-template name="cr2br"><xsl:with-param name="text"><xsl:value-of select="substring-before($text,'&#xD;&#xD;')"/></xsl:with-param></xsl:call-template></para>
  		<xsl:text>
  		</xsl:text>			
  			<xsl:call-template name="cr2para">
  				<xsl:with-param name="text"><xsl:value-of select="substring-after($text,'&#xD;&#xD;')"/></xsl:with-param>				
  			</xsl:call-template>
  		</xsl:when>
  		<xsl:when test="normalize-space($text) != ''">
  			<para><xsl:call-template name="cr2br"><xsl:with-param name="text"><xsl:value-of select="$text"/></xsl:with-param></xsl:call-template></para>
  		</xsl:when>
  	</xsl:choose>
  </xsl:template>
  
  <!-- convert single CRs to 'br' tags -->
  <xsl:template name="cr2br">
  	<xsl:param name="text"/>
  	<xsl:choose>
  		<xsl:when test="normalize-space(substring-before($text,'&#xD;')) != ''">
  <xsl:value-of select="normalize-space(substring-before($text,'&#xD;'))"/><br/>
  <xsl:text>
  </xsl:text>			
  			<xsl:call-template name="cr2br">
  				<xsl:with-param name="text"><xsl:value-of select="substring-after($text,'&#xD;')"/></xsl:with-param>				
  			</xsl:call-template>
  		</xsl:when>
  		<xsl:when test="normalize-space($text) != ''"><xsl:value-of select="$text"/></xsl:when>
  	</xsl:choose>
  </xsl:template>
  
  
  
  
  <!-- copy anything -->
    <xsl:template match="@*|node()" priority="-2"><xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy></xsl:template>
    <xsl:template match="text()" priority="-1"><xsl:value-of select="."/></xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/stream2editor.xsl
  
  Index: stream2editor.xsl
  ===================================================================
  <?xml version="1.0"?>
  
  <xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:source="http://apache.org/cocoon/source/1.0"
   >
  
  
  <!-- 
  
  	This StyleSheet converts the output of the StreamGenerator into the new 'page'
  	then wraps it with 'source:write' tags, so the SourceWritingTransformer can save it.
  
  	NB. the indentation of these templates effects the output document
  		
  -->
  
  	<xsl:param name="sub-editor"/>
  	<xsl:param name="target-file"/>
  	<xsl:param name="target-dir"/>
  	<xsl:param name="base"/>
  	
   
  <xsl:template match="page">
  <editor sub-editor="{$sub-editor}" target-file="{$target-file}" target-dir="{$target-dir}">
  <source:write src="{concat($base,$target-dir,$target-file)}" xml:space="preserve">
  <page><xsl:copy-of select="@*"/>
   <title><xsl:value-of select="title[1]"/></title>
   <content><xsl:copy-of select="content/@*"/>
    <xsl:for-each select="content[1]/para"><para><xsl:copy-of select="@*"/><xsl:apply-templates/></para>
    </xsl:for-each>
   </content>
  </page>
  </source:write>
  </editor>
  </xsl:template>
  
  <!-- copy anything -->
    <xsl:template match="@*|node()" priority="-2"><xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy></xsl:template>
    <xsl:template match="text()" priority="-1"><xsl:value-of select="."/></xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.3       +1 -1      xml-cocoon2/src/scratchpad/webapp/mount/editor/tests/make-page.xsl
  
  Index: make-page.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/tests/make-page.xsl,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- make-page.xsl	28 Feb 2002 19:05:12 -0000	1.2
  +++ make-page.xsl	13 Mar 2002 19:19:42 -0000	1.3
  @@ -16,7 +16,7 @@
   <page xmlns:xl="http://www.w3.org/1999/xlink">
   	<title>Result from - <xsl:value-of select="/page/title"/></title>
   	<content>
  -		<para>This file was assembled by XSLT from elements in <a href="../../view-source?filename=mount/editor/docs/test5.xml">test5</a></para>
  +		<para>This file was assembled by XSLT from elements in <a target="source" href="../../../view-source?filename=mount/editor/tests/test5.xml">test5</a></para>
   		<para>Here are some paragraphs copied from there:
   			<import>
   				<xsl:for-each select="/page/content/para">
  
  
  
  1.3       +3 -3      xml-cocoon2/src/scratchpad/webapp/mount/editor/tests/test1.xml
  
  Index: test1.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/tests/test1.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- test1.xml	28 Feb 2002 19:05:12 -0000	1.2
  +++ test1.xml	13 Mar 2002 19:19:42 -0000	1.3
  @@ -1,7 +1,7 @@
   <?xml version="1.0" encoding="utf-8"?>
   
   <page xmlns:source="http://apache.org/cocoon/source/1.0">
  -	<title>WritableSourceTransformer Test Page 1</title>
  +	<title>SourceWritingTransformer Test Page 1</title>
   	<content>
   		<para><b>Test</b>: Basic</para>
   		<para>This test should have written a file called result1.xml, in the same directory as this.</para>
  @@ -11,7 +11,7 @@
   			<pre>
   	&lt;source:write src="tests/result1.xml"&gt;
   		&lt;page&gt;
  -			&lt;title&gt;WritableSourceTransformer Test Result 1&lt;/title&gt;
  +			&lt;title&gt;SourceWritingTransformer Test Result 1&lt;/title&gt;
   			&lt;content&gt;
   				&lt;para&gt;Congratulations!&lt;/para&gt;
   			&lt;/content&gt;
  @@ -22,7 +22,7 @@
   	
   <source:write src="tests/result1.xml">
   <page>
  -	<title>WritableSourceTransformer Test Result 1</title>
  +	<title>SourceWritingTransformer Test Result 1</title>
   	<content>
   		<para>Congratulations!</para>
   	</content>
  
  
  
  1.3       +3 -3      xml-cocoon2/src/scratchpad/webapp/mount/editor/tests/test2.xml
  
  Index: test2.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/tests/test2.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- test2.xml	28 Feb 2002 19:05:12 -0000	1.2
  +++ test2.xml	13 Mar 2002 19:19:42 -0000	1.3
  @@ -4,7 +4,7 @@
   	xmlns:source="http://apache.org/cocoon/source/1.0"
   	
   >
  -	<title>WritableSourceTransformer Test Page 2</title>
  +	<title>SourceWritingTransformer Test Page 2</title>
   	<content>
   		<para><b>Test</b>: Namespace</para>
   		<para>This test should have written a file called result2.xml, in the same directory as this.</para>
  @@ -14,7 +14,7 @@
   			<pre>
   &lt;source:write src="tests/result2.xml"&gt;
   	&lt;page xmlns:xl="http://www.w3.org/1999/xlink"&gt;
  -		&lt;title&gt;WritableSourceTransformer Test Result 2&lt;/title&gt;
  +		&lt;title&gt;SourceWritingTransformer Test Result 2&lt;/title&gt;
   		&lt;content&gt;
   			&lt;para&gt;Congratulations!&lt;/para&gt;
   			&lt;para&gt;&lt;link xl:to="test2"&gt;I am in the XLink NameSpace&lt;/link&gt;&lt;/para&gt;
  @@ -28,7 +28,7 @@
   	
   <source:write src="tests/result2.xml">
   <page xmlns:xl="http://www.w3.org/1999/xlink">
  -	<title>WritableSourceTransformer Test Result 2</title>
  +	<title>SourceWritingTransformer Test Result 2</title>
   	<content>
   		<para>Congratulations!</para>
   		<para><link xl:to="test/2">I am in the XLink NameSpace</link></para>
  
  
  
  1.3       +3 -3      xml-cocoon2/src/scratchpad/webapp/mount/editor/tests/test3.xml
  
  Index: test3.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/tests/test3.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- test3.xml	28 Feb 2002 19:05:12 -0000	1.2
  +++ test3.xml	13 Mar 2002 19:19:42 -0000	1.3
  @@ -2,7 +2,7 @@
   
   <page  page="blah"
   >
  -	<title>WritableSourceTransformer Test Page 3!!!!!</title>
  +	<title>SourceWritingTransformer Test Page 3!!!!!</title>
   	<content>
   		<para><b>Test</b>: New Folder Test</para>
   		<para>This test should have written a file called result3.xml, in a directory that did not originally exist.</para>
  @@ -12,7 +12,7 @@
   			<pre>
   &lt;source:write src="tests/newfolder/result3.xml"&gt;
   	&lt;page&gt;
  -		&lt;title&gt;WritableSourceTransformer Test Result 3&lt;/title&gt;
  +		&lt;title&gt;SourceWritingTransformer Test Result 3&lt;/title&gt;
   		&lt;content&gt;
   			&lt;para&gt;Congratulations!&lt;/para&gt;
   		&lt;/content&gt;
  @@ -23,7 +23,7 @@
   		
   <source:write src="tests/newfolder/result3.xml" xmlns:source="http://apache.org/cocoon/source/1.0">
   <page>
  -	<title>WritableSourceTransformer Test Result 3</title>
  +	<title>SourceWritingTransformer Test Result 3</title>
   	<content>
   		<para>Congratulations!</para>
   	</content>
  
  
  
  1.3       +1 -1      xml-cocoon2/src/scratchpad/webapp/mount/editor/tests/test4.xml
  
  Index: test4.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/tests/test4.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- test4.xml	28 Feb 2002 19:05:12 -0000	1.2
  +++ test4.xml	13 Mar 2002 19:19:42 -0000	1.3
  @@ -4,7 +4,7 @@
   	xmlns:source="http://apache.org/cocoon/source/1.0"
   	xmlns:ci="http://apache.org/cocoon/include/1.0"
   >
  -	<title>WritableSourceTransformer Test Page 4</title>
  +	<title>SourceWritingTransformer Test Page 4</title>
   	<content>
   		<para><b>Test</b>: XInclude Test</para>
   		<para>This test should have written a file called result4.xml, with the contents coming from the file  <a href="../../../view-source?filename=mount/editor/tests/include-me.xml" target="source">include-me.xml</a>.</para>
  
  
  

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