cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jer...@apache.org
Subject cvs commit: xml-cocoon2/src/scratchpad/webapp/mount/editor/tests/test9 inc.xsl input.xml prepareWrite.xsl
Date Mon, 01 Jul 2002 08:51:02 GMT
jeremy      2002/07/01 01:51:02

  Modified:    src/scratchpad/webapp/mount/editor README editor.xmap
                        test.xmap
               src/scratchpad/webapp/mount/editor/docs source.xml tests.xml
               src/scratchpad/webapp/mount/editor/editor/stylesheets
                        editor-components.xsl editor-page2html.xsl
                        editor2writer.xsl
               src/scratchpad/webapp/mount/editor/stylesheets
                        simple-page2html.xsl
               src/scratchpad/webapp/mount/editor/tests include-me.xml
                        make-page.xsl test1.xml test2.xml test3.xml
                        test4.xml
  Added:       src/scratchpad/webapp/mount/editor/editor/docs
                        slash-edit.css
               src/scratchpad/webapp/mount/editor/tests result7.xml
                        result8.xml test7.xml test8.xml
               src/scratchpad/webapp/mount/editor/tests/test6 inc.xsl
                        input.xml prepareWrite.xsl
               src/scratchpad/webapp/mount/editor/tests/test9 inc.xsl
                        input.xml prepareWrite.xsl
  Log:
  updated tests and sample editors to match new tag style for SourceWritingTransformer
  
  Revision  Changes    Path
  1.7       +1 -9      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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- README	22 Mar 2002 12:09:59 -0000	1.6
  +++ README	1 Jul 2002 08:51:01 -0000	1.7
  @@ -1,7 +1,7 @@
   SourceWritingTransformer - Installation Notes.
   
   
  -Once you have the latest copy of Cocoon 2 from CVS, compile it.
  +Once you have the latest copy of Cocoon 2.1 HEAD Branch from CVS, compile it.
   
   You could use the following command:
   
  @@ -10,14 +10,6 @@
   This ensures the scratchpad libraries are included in the build.
   
   Next, move cocoon.war to your webapps directory, and start TomCat.
  -
  -Once cocoon.war file has expanded, copy the directory with the samples from :
  -
  -	xml-cocoon2/src/scratchpad/webapps/mount/editor
  -	
  -to:
  -
  -	webapps/cocoon/mount/editor
   	
   In your browser go to:
   
  
  
  
  1.9       +8 -5      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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- editor.xmap	28 Jun 2002 07:14:37 -0000	1.8
  +++ editor.xmap	1 Jul 2002 08:51:01 -0000	1.9
  @@ -212,6 +212,12 @@
   				<map:read src="editor/images/{2}.gif" mime-type="image/gif"/>
   			</map:match>
   
  +			<!-- css -->
  +			<map:match pattern="**style">
  +				<map:read mime-type="text/css" src="editor/docs/slash-edit.css"/>
  +			</map:match>
  +
  +
   			<!-- 
   				
   				General purpose behaviour pipeline 
  @@ -222,6 +228,7 @@
        		new(sub-editor-name)/path/to/file						- create a new document
      			put(sub-editor-name)												- save a modified document from a form submission
      			dir(sub-editor-name)/path/to/directory/			- show a directory listing
  +   			pre(sub-editor-name)/path/to/file						- preview your changes
       		
       	 -->
   			<map:match pattern="*(*)**">
  @@ -231,18 +238,14 @@
   				</map:aggregate>
   				<map:transform src="editor/stylesheets/editor-page2html.xsl"/>
   				<map:serialize type="xhtml"/>
  -				<!--<map:serialize type="xml"/>-->
   			</map:match>
   
   			<!-- generic error handlers -->
   			<map:handle-errors>
   				<map:transform src="context://stylesheets/system/error2html.xsl"/>
   				<map:serialize status-code="500"/>
  -				<!--<map:serialize type="xml"/>-->
   			</map:handle-errors>
  -			<!--<map:handle-errors>
  -				<map:serialize status-code="500" type="xml"/>
  -			</map:handle-errors>-->
  +			
   			<map:handle-errors type="404">
   				<map:transform src="context://stylesheets/system/error2html.xsl"/>
   				<map:serialize/>
  
  
  
  1.5       +76 -15    xml-cocoon2/src/scratchpad/webapp/mount/editor/test.xmap
  
  Index: test.xmap
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/test.xmap,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- test.xmap	28 Jun 2002 07:14:37 -0000	1.4
  +++ test.xmap	1 Jul 2002 08:51:01 -0000	1.5
  @@ -21,6 +21,17 @@
       </map:serializers>
       <map:transformers default="xslt">
       
  +    	<!-- Define 'filewriter' as the name for FileWritingTransformer -->
  +    	<!-- 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.SourceWritingTransformer">
  +				<serializer>my-xml-serializer</serializer>
  +			</map:transformer>
  +			
       </map:transformers>
       <map:readers default="resource"/>
       <map:matchers default="wildcard"/>
  @@ -30,46 +41,96 @@
     <map:pipelines>
   
       <map:pipeline>
  -
       	
      <!-- the tests -->
  -			<map:match pattern="test/4">
  -				<map:generate src="tests/test4.xml"/>
  -				<map:transform type="cinclude"/>
  -				<map:transform type="write-source"/>
  -				<map:transform src="stylesheets/simple-page2html.xsl">
  -					<map:parameter name="view-source" value="tests/test4.xml"/>
  +
  +			<map:match pattern="test/9">
  +			 <map:generate type="file" src="tests/test9/input.xml"/>
  +			 <map:transform type="xslt" src="tests/test9/inc.xsl"/>
  +			 <map:transform type="xslt" src="tests/test9/prepareWrite.xsl"/>
  +				<map:transform type="log">
  +					<map:parameter name="logfile" value="tests/9-before.log"/>
  +					<map:parameter name="append" value="no"/>
  +				</map:transform> <!---->
  +			 <map:transform type="filewriter"/>
  +			<map:transform type="log">
  +					<map:parameter name="logfile" value="tests/9-after.log"/>
  +					<map:parameter name="append" value="no"/>
   				</map:transform>
  -				<map:serialize type="html"/>								
  +			 <map:transform src="stylesheets/simple-page2html.xsl">
  +				 <map:parameter name="view-source" value="tests/test9/input.xml"/>
  +			 </map:transform>
  +			 <map:serialize type="html"/>
  +			 <!--	<map:serialize type="xml"/> -->
  +			</map:match>
  +
  +			<map:match pattern="test/6">
  +			 <map:generate type="file" src="tests/test6/input.xml"/>
  +			 <map:transform type="xslt" src="tests/test6/inc.xsl"/>
  +			 <map:transform type="xslt" src="tests/test6/prepareWrite.xsl"/>
  +			 <map:transform type="filewriter">
  +				<map:parameter name="serializer" value="xml"/>
  +			 </map:transform>
  +			 <map:transform src="stylesheets/simple-page2html.xsl">
  +				 <map:parameter name="view-source" value="tests/test6/input.xml"/>
  +			 </map:transform>
  +			 <map:serialize type="html"/>
   			</map:match>
   
   			<map:match pattern="test/5">
   				<map:generate src="tests/test5.xml"/>
   				<map:transform src="tests/make-page.xsl"/>
  -				<map:transform type="write-source">
  +				<map:transform type="log">
  +					<map:parameter name="logfile" value="tests/5-before.log"/>
  +					<map:parameter name="append" value="no"/>
  +				</map:transform>
  +				<map:transform type="filewriter">
   					<map:parameter name="serializer" value="xml"/> <!-- invoke the filewriter with 'xml' serializer -->
   				</map:transform> 
  +				<map:transform type="log">
  +					<map:parameter name="logfile" value="tests/5-after.log"/>
  +					<map:parameter name="append" value="no"/>
  +				</map:transform>
   				<map:transform src="stylesheets/simple-page2html.xsl">
   					<map:parameter name="view-source" value="tests/test5.xml"/>
   				</map:transform>
   				<map:serialize type="html"/>								
   			</map:match>
   
  +			<map:match pattern="test/4">
  +				<map:generate src="tests/test4.xml"/>
  +				<map:transform type="cinclude"/>
  +				<map:transform type="log">
  +					<map:parameter name="logfile" value="tests/4-before.log"/>
  +					<map:parameter name="append" value="no"/>
  +				</map:transform>
  +				<map:transform type="filewriter"/>
  +				<map:transform type="log">
  +					<map:parameter name="logfile" value="tests/4-after.log"/>
  +					<map:parameter name="append" value="no"/>
  +				</map:transform>
  +				<map:transform src="stylesheets/simple-page2html.xsl">
  +					<map:parameter name="view-source" value="tests/test4.xml"/>
  +				</map:transform>
  +				<map:serialize type="html"/>								
  +			</map:match>
  +
   			<map:match pattern="test/*">
   				<map:generate src="tests/test{1}.xml"/>
   				<map:transform type="log">
  -					<map:parameter name="logfile" value="before.log"/>
  +					<map:parameter name="logfile" value="tests/{1}-before.log"/>
   					<map:parameter name="append" value="no"/>
  -				</map:transform>
  -				<map:transform type="write-source"/>
  +				</map:transform><!--	-->
  +				<map:transform type="filewriter"/>
   				<map:transform type="log">
  -					<map:parameter name="logfile" value="after.log"/>
  +					<map:parameter name="logfile" value="tests/{1}-after.log"/>
   					<map:parameter name="append" value="no"/>
   				</map:transform>
   				<map:transform src="stylesheets/simple-page2html.xsl">
   					<map:parameter name="view-source" value="tests/test{1}.xml"/>
   				</map:transform>
  -				<map:serialize type="html"/>								
  +				<map:serialize type="html"/>	
  +			<!--	<map:serialize type="xml"/>			-->
   			</map:match>
   
    <!-- the results -->
  @@ -94,4 +155,4 @@
     </map:pipelines>
   </map:sitemap>
   
  -<!-- end of file -->
  +<!-- end of file -->
  \ No newline at end of file
  
  
  
  1.3       +178 -87   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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- source.xml	13 Mar 2002 19:19:42 -0000	1.2
  +++ source.xml	1 Jul 2002 08:51:01 -0000	1.3
  @@ -5,116 +5,207 @@
    <content>
   
     <para>
  -	NB: SourceWritingTransformer has replaced FileWritingTransformer.
  +	NB: SourceWritingTransformer has been updated with new tags.
     </para>
   
     <para>Please try the <a href="tests">tests</a></para>
     
     <para>
  -   Uses the tag <pre>&lt;source:write src="path-to-file" [serializer="serializer-name"]/&gt;</pre> 
  +   Uses the tags: 
  +   
  +   <pre>&lt;source:write/&gt;
  +&lt;source:insert/&gt;
  +	&lt;source:path/&gt;
  +	&lt;source:source/&gt;
  +	&lt;source:replace/&gt;
  +	&lt;source:reinsert/&gt;
  +	&lt;source:fragment/&gt;</pre>
      in the namespace xmlns:source="http://apache.org/cocoon/source/1.0".
     </para>
       
     <para>
  -   The contents of this tag are written to the specified WriteableSource when the document containing it is transformed by SourceWritingTransformer.
  +   The contents of the <code>&lt;source:fragment/&gt;</code> tag are written to the specified WriteableSource when the document containing it is transformed by SourceWritingTransformer.
     </para>
   
     <para>
  -   The only Source that currently implements WritableSource is FileSource. This means you can only use this Transformer to write to files at the moment. Hopefully other WriteableSource implementations (XMLDB, CVS, Email, SQL, etc.) will be written.
  +   Thankfully, FileSource is no longer the only Source that currently implements WritableSource; there are implementations of WebDAV and Apache Slide WritableSources in the scratchpad.
  +   Hopefully further WriteableSource implementations (XMLDB, CVS, Email, SQL, etc.) will be appear in the future.
     </para>
       
  -  <para>
  -   SiteMap:
  -  </para>
  -    
  -  <para>
  -   SourceWritingTransformer is defined using XML like this:
  -  </para>
  -  
  -  <para>
  -<pre>
  - &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>
  -  </para>
  -  
  -  <para>
  -   A Serializer must be specified somewhere if you are writing to File or some other Source that requires a Serializer.
  -   You can specify the Serializer in 3 different places, 
  -   SiteMap Definition, SiteMap Invocation and in the 'serializer attribute of the '&lt;source:write/&gt;' Tag.
  -   In the examples, something surrounded by [ and ] is optional.
  -  </para>    
  -    
  -  <para>
  -   The Serializer you want to use has to be defined somewhere in the SiteMap hierarchy, 
  -   if you need a special one, set it up how you set up any other Serializer.
  -  </para>
  -  
  -  <para>
  -<pre>
  - &lt;map:serializer
  -  name="my-xml-serializer"
  -  mime-type="text/xml" logger="sitemap.serializer.myxml"
  -  src="org.apache.cocoon.serialization.XMLSerializer"
  - &gt;
  -  &lt;encoding&gt;utf-8&lt;/encoding&gt;
  -  &lt;omit-xml-declaration&gt;no&lt;/omit-xml-declaration&gt;
  - &lt;/map:serializer&gt;
  -</pre>
  -  </para>
  -  
  -  
  -  <para>
  -   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="sourcewriter"&gt;
  -  [&lt;map:parameter name="serialiser" value="my-xml-serialiser"/&gt;]
  +
  + <para>Definition:</para>
  + <pre>
  + &lt;map:transformer name="tofile" src="org.apache.cocoon.transformation.SourceWritingTransformer"&gt;
  +   &lt;map:parameter name="serializer" value="xml"/&gt;  &lt;!-- this is the default Serializer (if your Source needs one, like for instance FileSource) --&gt;
  + &lt;/map:transformer/&gt;
  + </pre>
  +
  + <para>Invocation:</para>
  + <pre>
  + &lt;map:transform type="tofile"&gt;
  +   &lt;map:parameter name="serializer" value="xml"/&gt;   &lt;!-- you can optionally override the serializer here --&gt;
    &lt;/map:transform&gt;
  -</pre>
  -  </para>
  -  
  -  <para>
  -   Document:
  -  </para>
  -    
  -  <para>
  -   Something like this XML Fragment somewhere in the Document being processed, 
  -   will result in an XML file being written at the location specified, 
  -   with the <page/> tag as the Document Root.
  -  </para>
  -    
  -  <para>
  + </pre>
  +
  + <para>The Tags:</para>
  + <pre>
  + &lt;source:write create="[true]|false"&gt; - replaces the entire content of an existing asset, if @create is 'true' (default), a new asset will be created if one does not already exist.
  +     &lt;source:source&gt;The System ID of the asset to be written to&lt;/source:source&gt; - eg: "docs/blah.xml" or "context://blah.xml" etc.
  +     &lt;source:path&gt;[Optional] XPath to specify how your content is wrapped&lt;/source:path&gt; - eg: "doc" (your content is placed inside a &lt;doc/&gt; root tag). NOTE: if this value is omitted, your content MUST have only ONE top-level node.
  +     &lt;source:fragment&gt;The XML Fragment to be written&lt;/source:fragment&gt; - eg: "&lt;foo&gt;&lt;bar id="dogcow"/&gt;&lt;/foo&gt;" or "&lt;foo/&gt;&lt;bar&gt;&lt;dogcow/&gt;&lt;bar/&gt;" etc. NOTE: the second example type, can only be used when the &lt;source:path/&gt; tag has been specified.
  + &lt;source:write&gt;
  + 
  + &lt;source:insert create="[true]|false" overwrite="[true]|false"&gt; - inserts content into an existing asset, if @create is 'true' (default), a new asset will be created if one does not already exist. If @overwrite is set to 'true' the data is only inserted if the node specified by the 'replacePath' does not exists.
  +     &lt;source:source&gt;The System ID of the asset to be written to&lt;/source:source&gt; - eg: "docs/blah.xml" or "context://blah.xml" etc.
  +     &lt;source:path&gt;XPath specifying the node into which the content is inserted&lt;/source:path&gt; - eg: "doc" (your content is appended as the last child of the &lt;doc/&gt; root tag), or "doc/section[3]". NOTE: this tag is required in &lt;source:insert/&gt; unlike &lt;source:write/&gt; where it is optional.
  +     &lt;source:replace&gt;[Optional] XPath (relative to &lt;source:path/&gt;) to the node that is replaced by your new content&lt;/source:replace&gt; - eg: "foo/bar/dogcow/@status='cut'" (is equivalent to this in XSLT: select="foo[bar/dogcow/@status='cut']").
  +     &lt;source:reinsert&gt;[Optional] The XPath (relative to &lt;source:replace/&gt;) to backup the overwritten node to&lt;/source:reinsert&gt; - eg: "foo/versions" or "/doc/versions/foo". NOTE: If specified and a node is replaced, all children of this replaced node will be reinserted at the given path.
  +     &lt;source:fragment&gt;The XML Fragment to be written&lt;/source:fragment&gt; - eg: "&lt;foo&gt;&lt;bar id="dogcow"/&gt;&lt;/foo&gt;" or "&lt;foo/&gt;&lt;bar&gt;&lt;dogcow/&gt;&lt;bar/&gt;" etc. 
  + &lt;source:insert&gt;
  + </pre>
  +
  +
  + <para>Input XML document example (write):</para>
  + <pre>
  + &lt;page&gt;
  +   ...
  +   &lt;source:write xmlns:source="http://apache.org/cocoon/source/1.0"&gt;
  +     &lt;source:source&gt;context://doc/editable/my.xml&lt;/source:source&gt;      
  +     &lt;source:fragment&gt;&lt;page&gt;
  +       &lt;title&gt;Hello World&lt;/title&gt;
  +       &lt;content&gt;
  +         &lt;p&gt;This is my first paragraph.&lt;/p&gt;
  +       &lt;/content&gt;
  +     &lt;/page&gt;&lt;/source:fragment&gt;
  +   &lt;/source:write&gt;
  +   ...
  + &lt;/page&gt;
  + </pre>
  +
  + <para>Input XML document example (insert at end):</para>
  + <pre>
  + &lt;page&gt;
  +   ...
  +   &lt;source:insert xmlns:source="http://apache.org/cocoon/source/1.0"&gt;
  +     &lt;source:source&gt;context://doc/editable/my.xml&lt;/source:source&gt;      
  +     &lt;source:path&gt;page/content&lt;/source:path&gt;      
  +     &lt;source:fragment&gt;
  +       &lt;p&gt;This paragraph gets &lt;emp&gt;inserted&lt;/emp&gt;.&lt;/p&gt;
  +       &lt;p&gt;With this one, at the end of the content.&lt;/p&gt;
  +     &lt;/source:fragment&gt;
  +   &lt;/source:insert&gt;
  +   ...
  + &lt;/page&gt;
  + </pre>
  +
  + <para>Input XML document example (insert at beginning):</para>
  + <pre>
  + &lt;page&gt;
  +   ...
  +   &lt;source:insert&gt;
  +     &lt;source:source&gt;context://doc/editable/my.xml&lt;/source:source&gt;
  +     &lt;source:path&gt;page&lt;/source:path&gt;
  +     &lt;source:replace&gt;content&lt;/source:replace&gt;
  +     &lt;source:reinsert&gt;content&lt;/source:reinsert&gt;
  +     &lt;source:fragment&gt;
  +       &lt;content&gt;
  +         &lt;p&gt;This new paragraph gets inserted &lt;emp&gt;before&lt;/emp&gt; the other ones.&lt;/p&gt;
  +       &lt;/content&gt;
  +     &lt;/source:fragment&gt;
  +    &lt;source:insert&gt;
  +   ...
  + &lt;/page&gt;
  + </pre>
  +
  + <para>Input XML document example (replace):</para>
  + <pre>
  + &lt;page&gt;
  +   ...
  +   &lt;source:insert xmlns:source="http://apache.org/cocoon/source/1.0"&gt;
  +     &lt;source:source&gt;context://doc/editable/my.xml"&lt;/source:source&gt;      
  +     &lt;source:path&gt;page/content&lt;/source:path&gt;      
  +     &lt;source:replace&gt;p[1]&lt;/source:replace&gt;      
  +     &lt;source:fragment&gt;
  +       &lt;p&gt;This paragraph &lt;emp&gt;replaces&lt;/emp&gt; the first paragraph.&lt;/p&gt;
  +     &lt;/source:fragment&gt;
  +   &lt;/source:insert&gt;
  +   ...
  + &lt;/page&gt;
  + </pre>
  +
  + <para>Output XML document example:</para>
  + <pre>
  + &lt;page&gt;
  +   ...
  +   &lt;sourceResult&gt;
  +     &lt;action&gt;new|overwritten|none&lt;/action&gt;
  +     &lt;behaviour&gt;write|insert&lt;behaviour&gt;
  +     &lt;execution&gt;success|failure&lt;/execution&gt;
  +     &lt;serializer&gt;xml&lt;/serializer&gt;
  +     &lt;source&gt;file:/source/specific/path/to/context/doc/editable/my.xml&lt;/source&gt;
  +   &lt;/sourceResult&gt;
  +   ...
  + &lt;/page&gt;
  + </pre>
  +
  +
  +<para> The XPath specification is very complicated. So here is an example for the sitemap:</para>
  + <pre>
  + &lt;page xmlns:source="http://apache.org/cocoon/source/1.0"&gt;
  +   ...
  + &lt;source:insert&gt;
  +   &lt;source:source&gt;sitemap.xmap&lt;/source:source&gt;
  +   &lt;source:path&gt;/*[namespace-uri()="http://apache.org/cocoon/sitemap/1.0" and local-name()="sitemap"]/*[namespace-uri()="http://apache.org/cocoon/sitemap/1.0" and local-name()="components"]/*[namespace-uri()="http://apache.org/cocoon/sitemap/1.0" and local-name()="generators"]&lt;/source:path&gt;
  +   &lt;source:fragment&gt;
  +	  	&lt;generator name="file" xmln="http://apache.org/cocoon/sitemap/1.0"&gt;
  +			&lt;test/&gt;
  +		&lt;/generator&gt;
  +   &lt;/source:fragment&gt;
  +   &lt;source:replace&gt;*[namespace-uri()="http://apache.org/cocoon/sitemap/1.0" and local-name()="generator" and attribute::name="file"]&lt;/source:replace&gt;
  + &lt;/source:insert&gt;
  +   ...
  + &lt;/page&gt;
  + </pre>
  +
  + <para>This insert replaces (if it exists) the file generator definition with a new one.
  + As the sitemap uses namespaces the XPath for the generator is rather complicated.
  + Due to this it is necessary that the node specified by path exists if namespaces
  + are used! Otherwise a node with the name * would be created...</para>
  +
  +<para>The create attribute of insert. If this is set
  +to true (default is true), the file is created if it does not exists.
  +If it is set to false, it is not created, making insert a real insert.
  +create is only usable for files!</para>
  +<para>In addition the overwrite attribute is used to check if replacing is allowed.
  +If overwrite is true (the default) the node is replaced. If it is false
  +the node is not inserted if the replace node is available.</para>
  +
  +<para>[JQ] - the way I understand this, looking at the code: 
   <pre>
  - &lt;source:write src="docs/result1.xml" [serializer="my-xml-serializer"]&gt;
  -  &lt;page&gt;
  -   &lt;title&gt;SourceWritingTransformer Test Result 1&lt;/title&gt;
  -   &lt;content&gt;
  -    &lt;para&gt;Congratulations!&lt;/para&gt;
  -   &lt;/content&gt;
  -  &lt;/page&gt;
  - &lt;/source:write&gt;
  -</pre>
  -  </para>
  -    
  -  <para>
  -   This XMLFragment (or your equivalent) could have got into the stream by any means available to the Cocoon2 SiteMap.
  -   Generation, Transformation, Aggregation, Inclusion etc.
  -   Again, the serializer attribute is optional.
  -  </para>
  + if 'replace' is not specified, your 'fragment' is appended as a child of 'path'.
  + if 'replace' is specified and it exists and 'overwrite' is true, your 'fragment' is inserted in 'path', before 'replace' and then 'replace' is deleted.
  + if 'replace' is specified and it exists and 'overwrite' is false, no action occurs.
  + if 'replace' is specified and it does not exist and 'overwrite' is true, your 'fragment' is appended as a child of 'path'.
  + if 'replace' is specified and it does not exist and 'overwrite' is false, your 'fragment' is appended as a child of 'path'.
  + if 'reinsert' is specified and it does not exist, no action occurs.
  +</pre></para>
  +
  +<para> The &lt;source:reinsert&gt; option can be used to
  + reinsert a replaced node at a given path in the new fragment.</para>
       
       
     <para>
      Known Problems:
     </para>
   
  -  <para>If you have an error while editing an existing file, the file will probably be truncated by the process.</para>
  +  <para>Improper namespace handling. Namespace declarations are not copied to the Source, resulting in invalid XML.</para>
  +  <para>I cannot get the 'insert before' example working, which uses the &lt;source:reinsert/&gt; tag.</para>
  +
  +  <para>
  +   Warning:
  +  </para>
   
  +  <para>It is not known how robust this transformer is under even moderate load, especially when it comes to more than one person modifying the same file at the same time.</para>
   
    </content>
   </page>
  
  
  
  1.4       +19 -7     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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- tests.xml	13 Mar 2002 19:19:42 -0000	1.3
  +++ tests.xml	1 Jul 2002 08:51:01 -0000	1.4
  @@ -1,7 +1,7 @@
   <?xml version="1.0" encoding="utf-8"?>
   
   <page>
  - <title>SourceWritingTransformer Tests</title>
  + <title>SourceWritingTransformer Test Suite</title>
    <content>
     <para>
   	NB: SourceWritingTransformer has replaced FileWritingTransformer.
  @@ -10,20 +10,32 @@
   	Tests: Please run these tests and report any problems.
     </para>
     <para>
  -	Test 1: <a href="test/1">Test 1</a>: the basic test, makes <a href="result/1">Result 1</a>.
  +	Test 1: <a href="test/1">Test 1</a>: the basic source:write test, makes <a href="result/1">Result 1</a>.
     </para>
     <para>
  -	Test 2: <a href="test/2">Test 2</a>: the namespace test, makes <a href="result/2">Result 2</a>, with the XLink namespace used inside.
  +	Test 2: <a href="test/2">Test 2</a>: the source:write namespace test, makes <a href="result/2">Result 2</a>, with the XLink namespace used inside. <span class="failure">Known to fail</span> (the written file is unparseable, because the namespace declaration is missing).
     </para>
     <para>
  -  Test 3: <a href="test/3">Test 3</a>: the new folder test, makes <a href="result/newfolder/3">Result 3</a>, in a new folder.
  +  Test 3: <a href="test/3">Test 3</a>: the source:write new folder test, makes <a href="result/newfolder/3">Result 3</a>, in a new folder.
     </para>
     <para>
  -	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.
  +	Test 4: <a href="test/4">Test 4</a>: the source:write 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 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>.
  +	Test 5: <a href="test/5">Test 5</a>: the source:write 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>
  +  <para>
  +	Test 6: <a href="test/6">Test 6</a>: the source:write read/write test, this is the great news, it was not expected to work, but it does!! This test first reads a file, modifies it then writes it back to the same place. Thanks to Olivier Rossel for contributing this.
  +  </para>
  +  <para>
  +	Test 7: <a href="test/7">Test 7</a>: the source:insert after test, inserts a paragraph after the existing one in <a href="result/7">Result 7</a>.
  +  </para>
  +  <para>
  +	Test 8: <a href="test/8">Test 8</a>: source:insert before test, this test attempts to insert a paragraph before existing ones using source:reinsert, <span class="failure">it currently fails</span>, either because I am using it wrong or the code does not work properly.
  +  </para>
  +  <para>
  +	Test 9: <a href="test/9">Test 9</a>: source:insert replace test, similar to test 6, it updates the contents of a single tag, but this time it inserts, not overwrites.
     </para>
  -  
    </content>
   </page>
  +
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/docs/slash-edit.css
  
  Index: slash-edit.css
  ===================================================================
  
      	.title
      	{
      		text-align: center;
      		font-size: 18px;
      		font-weight: bold;
      		font-family: sans-serif,Arial,Tahoma;
      		color: black;
      		background: white;
      		border-color: black;
      		border-width: 10px;
      	}
      	
      	.main
      	{
      		border: 1px solid #0086B2;
      		padding: 0px;
      		margin: 6px;
      		min-width: 630px;
      	}
      	
      	.head
      	{
      		border-bottom: #0086B2;
      		border-width: 0 0 1px 0;
      		border-style: none none solid none;
      		padding: 6px 6px 3px 6px;
      	}
      	
      	.block { padding: 6px; }
      	
      	.confirm
      	{
      		width: 40%;
      		margin-left: 50%;
      		padding: 6px;
      	}
      	
      	.content
      	{
      		border: 1px solid #0086B2; 
      		padding: 6px;
      		margin: 1px;
      	}
   
      	tr 
      	{
      		padding: 2px 6px 2px 6px;
      	}
     	    	
      
      	.col1
      	{
      		font-weight: bold;
      	}
  
       	.error .col1
      	{
      		padding: 2px 20px 2px 6px;
      	}
  
       	.error .col2
      	{
      		color:#BB0000;
      		padding: 2px 20px 2px 6px;
      	}
     	
      	.field { }
      	
      	.notify
      	{
      		font-size: 15px;
      		text-align: left;
      	}
      	
      	.tools { text-align: right; }
      	.tool { padding: 6px; }
      	
      	.notes
      	{
      		font-size: 12px;
      		font-weight: bold;
      		color: white;
      		background: #0086B2;
      		text-align: left;
      		padding: 6px 6px 3px 6px;
      	}
      	
      	.foot
      	{
      		text-align: center;
      		font-size: 12px;
      		margin-top: 50px;
      	}
      	
      	.hspace { margin: 30px; }
      	#left { float: left; }
      	#right { float: right; }
      	#center { text-align: center; }
      	#row { background: #EEFFFF; }
      	
      	.failure
      	{
      		font-weight: bold;
      		color: #BB0000;
      	}
      	
      	.warning
      	{
      		font-weight: bold;
      		color: #BB0000;
      	}
      	
      	.success
      	{
      		font-weight: bold;
      		color: green;
      	}
      	
      	.tab
      	{
      		font-size: 12px;
      		font-weight: bold;
      		color: white;
      		background: #0086B2;
      		padding: 4px 4px 2px 4px;
      		border: 0px solid #0086B2;
      		margin: 1px;
      	}
      	
      	.tab a
      	{
      		text-decoration: none;
      		color: white;
      	}
      	
      	.tab a:visited
      	{
      		text-decoration: none;
      		color: white;
      	}
      	
      	.tab a:link
      	{
      		text-decoration: none;
      		color: white;
      	}
      	
      	.tab a:hover
      	{
      		text-decoration: underline;
      		color: red;
      	}
      	
      	a { text-decoration: none; }
      	
      	a:hover
      	{
      		text-decoration: underline;
      		color: red;
      	}
      	
      	body
      	{
      		font-size: 12px;
      		font-family: sans-serif,Arial,Tahoma;
      		color: black;
      		background: white;
      	}
      	
      	form { font-size: 12px; }
      	
      	textarea
      	{
      		background-color: #EEFFFF;
      		font-size: 12px;
      		font-family: geneva,arial,sans-serif;
      		border-color: #0086B2;
      		border-width: 1px;
      		padding-left: 2px;
      	}
      	
      	textarea.hidden { display: none; }
      	
      	input
      	{
      		background-color: #EEFFFF;
      		font-size: 12px;
      		font-family: geneva,arial,sans-serif;
      		border-color: #0086B2;
      		border-width: 1px;
      		padding-left: 2px;
      	}
      	
      	input.submit
      	{
      		background-color: #0086B2;
      		font-size: 12px;
      		font-family: geneva,arial,sans-serif;
      		border-color: black;
      		border-width: 1px;
      		padding: 2px 6px;
      		font-weight: bold;
      		color: white;
      	}
      	
      	input.button
      	{
      		background-color: #BB0000;
      		font-size: 12px;
      		font-family: geneva,arial,sans-serif;
      		border-color: black;
      		border-width: 1px;
      		padding: 2px 6px;
      		font-weight: bold;
      		color: white;
      	}
  
  
  
  1.8       +18 -14    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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- editor-components.xsl	22 Mar 2002 12:10:00 -0000	1.7
  +++ editor-components.xsl	1 Jul 2002 08:51:01 -0000	1.8
  @@ -113,41 +113,45 @@
   		</div>
     </xsl:template>
    
  -<!-- outputs the response from WriteableSourceTransformer -->
  -  <xsl:template match="source:write">
  +<!-- outputs the response from SourceWritingTransformer -->
  +  <xsl:template match="sourceResult">
   		<div class="block">
   			<span class="tab">Writing to Source</span>
   			<div class="content">
   				<table>
   					<tr>
   						<td class="col1">Result</td>
  -						<td class="col2"><span class="{@result}"><xsl:value-of select="@result"/></span></td>
  +						<td class="col2"><span class="{execution}"><xsl:value-of select="execution"/></span></td>
   					</tr>
  -					<xsl:if test="@result = 'failed'">
  -						<tr class="error">
  -							<td class="col1">Error</td>
  -							<td class="col2"><span class="{@result}"><xsl:value-of select="text()"/></span></td>
  -						</tr>					
  +					<tr>
  +						<td class="col1">Behaviour</td>
  +						<td class="col2"><xsl:value-of select="behaviour"/></td>
  +					</tr>
  +					<xsl:if test="message">
  +						<tr>
  +							<td class="col1">Message</td>
  +							<td class="col2"><xsl:value-of select="message"/></td>
  +						</tr>
   					</xsl:if>
   					<tr>
   						<td class="col1">Source</td>
  -						<td class="col2"><xsl:value-of select="@src"/></td>
  +						<td class="col2"><xsl:value-of select="source"/></td>
   					</tr>
   					<tr>
   						<td class="col1">Action</td>
   						<td class="col2">
   							<xsl:choose>
  -								<xsl:when test="@action = 'none'">None taken</xsl:when>
  -								<xsl:when test="@action = 'new'">New file created</xsl:when>
  -								<xsl:when test="@action = 'overwritten'">Existing file overwritten</xsl:when>
  +								<xsl:when test="action = 'none'">None taken</xsl:when>
  +								<xsl:when test="action = 'new'">New document created</xsl:when>
  +								<xsl:when test="action = 'overwritten'">Existing document overwritten</xsl:when>
   								<xsl:otherwise>Unknown</xsl:otherwise>
   							</xsl:choose>
   						</td>
   					</tr>
  -					<xsl:if test="@serializer">
  +					<xsl:if test="serializer">
   						<tr>
   							<td class="col1">Serializer</td>
  -							<td class="col2"><xsl:value-of select="@serializer"/></td>
  +							<td class="col2"><xsl:value-of select="serializer"/></td>
   						</tr>
   					</xsl:if>
   				</table>
  
  
  
  1.9       +1 -221    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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- editor-page2html.xsl	22 Mar 2002 12:10:00 -0000	1.8
  +++ editor-page2html.xsl	1 Jul 2002 08:51:01 -0000	1.9
  @@ -44,228 +44,8 @@
   			</script>
       </xsl:if>
       
  -    
  -    <!-- this will move into a separate file, when it has settled down -->
  -    <style><![CDATA[
  +    <link type="text/css" rel="stylesheet" href="style"/>
   
  -    	.title
  -    	{
  -    		text-align: center;
  -    		font-size: 18px;
  -    		font-weight: bold;
  -    		font-family: sans-serif,Arial,Tahoma;
  -    		color: black;
  -    		background: white;
  -    		border-color: black;
  -    		border-width: 10px;
  -    	}
  -    	
  -    	.main
  -    	{
  -    		border: 1px solid #0086B2;
  -    		padding: 0px;
  -    		margin: 6px;
  -    		min-width: 630px;
  -    	}
  -    	
  -    	.head
  -    	{
  -    		border-bottom: #0086B2;
  -    		border-width: 0 0 1px 0;
  -    		border-style: none none solid none;
  -    		padding: 6px 6px 3px 6px;
  -    	}
  -    	
  -    	.block { padding: 6px; }
  -    	
  -    	.confirm
  -    	{
  -    		width: 40%;
  -    		margin-left: 50%;
  -    		padding: 6px;
  -    	}
  -    	
  -    	.content
  -    	{
  -    		border: 1px solid #0086B2; 
  -    		padding: 6px;
  -    		margin: 1px;
  -    	}
  - 
  -    	tr 
  -    	{
  -    		padding: 2px 6px 2px 6px;
  -    	}
  -   	    	
  -    
  -    	.col1
  -    	{
  -    		font-weight: bold;
  -    	}
  -
  -     	.error .col1
  -    	{
  -    		padding: 2px 20px 2px 6px;
  -    	}
  -
  -     	.error .col2
  -    	{
  -    		color:#BB0000;
  -    		padding: 2px 20px 2px 6px;
  -    	}
  -   	
  -    	.field { }
  -    	
  -    	.notify
  -    	{
  -    		font-size: 15px;
  -    		text-align: left;
  -    	}
  -    	
  -    	.tools { text-align: right; }
  -    	.tool { padding: 6px; }
  -    	
  -    	.notes
  -    	{
  -    		font-size: 12px;
  -    		font-weight: bold;
  -    		color: white;
  -    		background: #0086B2;
  -    		text-align: left;
  -    		padding: 6px 6px 3px 6px;
  -    	}
  -    	
  -    	.foot
  -    	{
  -    		text-align: center;
  -    		font-size: 12px;
  -    		margin-top: 50px;
  -    	}
  -    	
  -    	.hspace { margin: 30px; }
  -    	#left { float: left; }
  -    	#right { float: right; }
  -    	#center { text-align: center; }
  -    	#row { background: #EEFFFF; }
  -    	
  -    	.failure
  -    	{
  -    		font-weight: bold;
  -    		color: #BB0000;
  -    	}
  -    	
  -    	.warning
  -    	{
  -    		font-weight: bold;
  -    		color: #BB0000;
  -    	}
  -    	
  -    	.success
  -    	{
  -    		font-weight: bold;
  -    		color: green;
  -    	}
  -    	
  -    	.tab
  -    	{
  -    		font-size: 12px;
  -    		font-weight: bold;
  -    		color: white;
  -    		background: #0086B2;
  -    		padding: 4px 4px 2px 4px;
  -    		border: 0px solid #0086B2;
  -    		margin: 1px;
  -    	}
  -    	
  -    	.tab a
  -    	{
  -    		text-decoration: none;
  -    		color: white;
  -    	}
  -    	
  -    	.tab a:visited
  -    	{
  -    		text-decoration: none;
  -    		color: white;
  -    	}
  -    	
  -    	.tab a:link
  -    	{
  -    		text-decoration: none;
  -    		color: white;
  -    	}
  -    	
  -    	.tab a:hover
  -    	{
  -    		text-decoration: underline;
  -    		color: red;
  -    	}
  -    	
  -    	a { text-decoration: none; }
  -    	
  -    	a:hover
  -    	{
  -    		text-decoration: underline;
  -    		color: red;
  -    	}
  -    	
  -    	body
  -    	{
  -    		font-size: 12px;
  -    		font-family: sans-serif,Arial,Tahoma;
  -    		color: black;
  -    		background: white;
  -    	}
  -    	
  -    	form { font-size: 12px; }
  -    	
  -    	textarea
  -    	{
  -    		background-color: #EEFFFF;
  -    		font-size: 12px;
  -    		font-family: geneva,arial,sans-serif;
  -    		border-color: #0086B2;
  -    		border-width: 1px;
  -    		padding-left: 2px;
  -    	}
  -    	
  -    	textarea.hidden { display: none; }
  -    	
  -    	input
  -    	{
  -    		background-color: #EEFFFF;
  -    		font-size: 12px;
  -    		font-family: geneva,arial,sans-serif;
  -    		border-color: #0086B2;
  -    		border-width: 1px;
  -    		padding-left: 2px;
  -    	}
  -    	
  -    	input.submit
  -    	{
  -    		background-color: #0086B2;
  -    		font-size: 12px;
  -    		font-family: geneva,arial,sans-serif;
  -    		border-color: black;
  -    		border-width: 1px;
  -    		padding: 2px 6px;
  -    		font-weight: bold;
  -    		color: white;
  -    	}
  -    	
  -    	input.button
  -    	{
  -    		background-color: #BB0000;
  -    		font-size: 12px;
  -    		font-family: geneva,arial,sans-serif;
  -    		border-color: black;
  -    		border-width: 1px;
  -    		padding: 2px 6px;
  -    		font-weight: bold;
  -    		color: white;
  -    	}
  -   ]]>
  -    </style>
       </head>
       <body> 
   			<div class="title"><xsl:value-of select="$config/@title"/> - site editor demo</div>
  
  
  
  1.4       +9 -5      xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/editor2writer.xsl
  
  Index: editor2writer.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/editor2writer.xsl,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- editor2writer.xsl	22 Mar 2002 12:10:00 -0000	1.3
  +++ editor2writer.xsl	1 Jul 2002 08:51:01 -0000	1.4
  @@ -28,9 +28,12 @@
   		<xsl:copy-of select="@*"/>
   		<xsl:choose>
   			<xsl:when test="instance/@behaviour='put'">			
  -				<instance behaviour="{instance/@behaviour}" target="{instance/@target}"><source:write src="{concat($base,instance/@target)}" xml:space="preserve" xmlns:source="http://apache.org/cocoon/source/1.0">
  -<xsl:apply-templates select="instance/*"/>
  -				</source:write></instance>
  +				<instance behaviour="{instance/@behaviour}" target="{instance/@target}">
  +					<source:write xml:space="preserve" xmlns:source="http://apache.org/cocoon/source/1.0">
  +						<source:source><xsl:value-of select="$base"/><xsl:value-of select="instance/@target"/></source:source>
  +						<source:fragment><xsl:apply-templates select="instance/*"/></source:fragment>
  +					</source:write>
  +				</instance>
   			</xsl:when>			
   			<xsl:otherwise>
   				<instance behaviour="{instance/@behaviour}" target="{instance/@target}">
  @@ -42,8 +45,9 @@
   	</editor>
   </xsl:template>
   
  -<!-- copy content
  -	<xsl:template match="para"><para i="t"><xsl:value-of disable-output-escaping="yes" select="text()"/></para></xsl:template>
  +<!-- copy content ** this copies any tags into the source, when the source is re-parsed, they will be XML. **
  +									** this is highly dangerous because no validation takes place !!!!!                      **
  +	<xsl:template match="para"><para><xsl:value-of disable-output-escaping="yes" select="text()"/></para></xsl:template>
   	-->
   <!-- copy anything -->
     <xsl:template match="@*|node()" priority="-2"><xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy></xsl:template>
  
  
  
  1.5       +29 -21    xml-cocoon2/src/scratchpad/webapp/mount/editor/stylesheets/simple-page2html.xsl
  
  Index: simple-page2html.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/stylesheets/simple-page2html.xsl,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- simple-page2html.xsl	22 Mar 2002 12:10:00 -0000	1.4
  +++ simple-page2html.xsl	1 Jul 2002 08:51:01 -0000	1.5
  @@ -23,7 +23,8 @@
   				.notes{font-size:12px;font-weight:bold;color:white;background:#0086B2}
   				.result{font-size:12px;color:black}
   				.failure{font-size:12px;font-weight:bold;color:red}
  -				.success{font-size:12px;color:black}
  +				.counter{font-size:72px;font-weight:bold;color:gray}
  +				.success{font-size:12px;font-weight:bold;color:green}
   				.caption{font-size:12px;font-weight:bold;color:black;}
   				textarea{font-size:12px;font-family : geneva,arial,sans-serif;}
   		 //-->]]>
  @@ -56,56 +57,63 @@
      </p>
     </xsl:template>
   
  +
  +  <xsl:template match="counter">
  +   <span class="counter"><xsl:value-of select="."/></span>
  +  </xsl:template>
  +
     <xsl:template match="import">
      <blockquote style="color:green;">
       <xsl:apply-templates/>
      </blockquote>
     </xsl:template>
   
  -  <xsl:template match="source:write">
  +  <xsl:template match="sourceResult">
   		<table border="0" cellspacing="0" cellpadding="5" width="100%">
   			<tr>
  +				<td class="caption">Behaviour</td>
  +				<td class="result">
  +					<xsl:value-of select="behaviour"/>
  +				</td>
  +			</tr>					
  +			<tr>
   				<td class="caption">Result</td>
   				<td class="result">
  -					<span class="{@result}">
  -						<xsl:value-of select="@result"/>
  +					<span class="{execution}">
  +						<xsl:value-of select="execution"/>
   					</span>
   				</td>
   			</tr>
  -			<xsl:if test="@result = 'failed'">
  -				<tr>
  -					<td class="caption">Error</td>
  -					<td class="result">
  -						<span class="{@result}">
  -							<xsl:value-of select="text()"/>
  -						</span>
  -					</td>
  -				</tr>					
  -			</xsl:if>
  +			<tr>
  +				<td class="caption">Message</td>
  +				<td class="result">
  +					<xsl:value-of select="message"/>
  +				</td>
  +			</tr>
   			<tr>
   				<td class="caption">Source</td>
   				<td class="result">
  -					<xsl:value-of select="@src"/>
  +					<xsl:value-of select="source"/>
   				</td>
   			</tr>
  -			<xsl:if test="@action">
  +			<xsl:if test="action">
   				<tr>
   					<td class="caption">Action</td>
   					<td class="result">
   						<xsl:choose>
  -							<xsl:when test="@action = 'none'">None taken</xsl:when>
  -							<xsl:when test="@action = 'new'">New file created</xsl:when>
  -							<xsl:when test="@action = 'overwritten'">Existing file overwritten</xsl:when>
  +							<xsl:when test="action = 'none'">None taken</xsl:when>
  +							<xsl:when test="action = 'new'">New file created</xsl:when>
  +							<xsl:when test="action = 'overwritten'">Existing file overwritten</xsl:when>
   							<xsl:otherwise>Unknown</xsl:otherwise>
   						</xsl:choose>
   					</td>
   				</tr>
   			</xsl:if>
  -			<xsl:if test="@serializer">
  +			<xsl:if test="serializer">
   				<tr>
   					<td class="caption">Serializer</td>
   					<td class="result">
  -						<xsl:value-of select="@serializer"/>
  +						<xsl:value-of select="serializer"/>
   					</td>
   				</tr>
   			</xsl:if>
  
  
  
  1.2       +1 -2      xml-cocoon2/src/scratchpad/webapp/mount/editor/tests/include-me.xml
  
  Index: include-me.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/tests/include-me.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- include-me.xml	22 Feb 2002 22:15:35 -0000	1.1
  +++ include-me.xml	1 Jul 2002 08:51:01 -0000	1.2
  @@ -1,10 +1,9 @@
   <?xml version="1.0" encoding="utf-8"?>
   
  -<page xmlns:xl="http://www.w3.org/1999/xlink">
  +<page>
   	<title>Include me in Test Result 4</title>
   	<content>
   		<para>This is an external file that is to be XIncluded by 'test4' to make a new document.</para>
  -		<para>This is an element in the <link xl:to="nowhere">XLink Namespace</link>.</para>
   		<para>
   			Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. 
   		</para><para>
  
  
  
  1.4       +5 -5      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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- make-page.xsl	13 Mar 2002 19:19:42 -0000	1.3
  +++ make-page.xsl	1 Jul 2002 08:51:01 -0000	1.4
  @@ -12,21 +12,21 @@
     </xsl:template>
   
     <xsl:template match="make-page">
  -  	<source:write src="tests/result5.xml" xml:space="preserve">
  -<page xmlns:xl="http://www.w3.org/1999/xlink">
  +  	<source:write>
  +			<source:source>tests/result5.xml</source:source>
  +			<source:fragment><page>
   	<title>Result from - <xsl:value-of select="/page/title"/></title>
   	<content>
   		<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">
  -				<xsl:copy><xsl:apply-templates/></xsl:copy>
  +					<xsl:copy><xsl:apply-templates/></xsl:copy>
   				</xsl:for-each>
   			</import>
   		</para>
  -		<para>And <link xl:to="nowhere">here</link> is another fake XLink, for luck</para>
   	</content>
  -</page>
  +</page></source:fragment>
   		</source:write>
     </xsl:template>
   
  
  
  
  1.4       +14 -12    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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- test1.xml	13 Mar 2002 19:19:42 -0000	1.3
  +++ test1.xml	1 Jul 2002 08:51:01 -0000	1.4
  @@ -1,6 +1,6 @@
   <?xml version="1.0" encoding="utf-8"?>
   
  -<page xmlns:source="http://apache.org/cocoon/source/1.0">
  +<page>
   	<title>SourceWritingTransformer Test Page 1</title>
   	<content>
   		<para><b>Test</b>: Basic</para>
  @@ -9,24 +9,26 @@
   		<para>The XML is:</para>
   		<para>
   			<pre>
  -	&lt;source:write src="tests/result1.xml"&gt;
  -		&lt;page&gt;
  -			&lt;title&gt;SourceWritingTransformer Test Result 1&lt;/title&gt;
  -			&lt;content&gt;
  -				&lt;para&gt;Congratulations!&lt;/para&gt;
  -			&lt;/content&gt;
  -		&lt;/page&gt;
  -	&lt;/source:write&gt;
  +&lt;source:write&gt;
  +	&lt;source:source&gt;tests/result1.xml&lt;/source:source&gt;
  +	&lt;source:fragment&gt;&lt;page&gt;
  +	&lt;title&gt;SourceWritingTransformer Test Result 1&lt;/title&gt;
  +	&lt;content&gt;
  +		&lt;para&gt;Congratulations!&lt;/para&gt;
  +	&lt;/content&gt;
  +&lt;/page&gt;&lt;/source:fragment&gt;
  +&lt;/source:write&gt;
   			</pre>
   		</para>
   	
  -<source:write src="tests/result1.xml">
  -<page>
  +<source:write xmlns:source="http://apache.org/cocoon/source/1.0">
  +	<source:source>tests/result1.xml</source:source>
  +<source:fragment><page>
   	<title>SourceWritingTransformer Test Result 1</title>
   	<content>
   		<para>Congratulations!</para>
   	</content>
  -</page>
  +</page></source:fragment>
   </source:write>
   
   		<para>Have a <a href="../result/1">look!</a></para>
  
  
  
  1.4       +13 -11    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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- test2.xml	13 Mar 2002 19:19:42 -0000	1.3
  +++ test2.xml	1 Jul 2002 08:51:01 -0000	1.4
  @@ -12,28 +12,30 @@
   		<para>The XML is:</para>
   		<para>
   			<pre>
  -&lt;source:write src="tests/result2.xml"&gt;
  -	&lt;page xmlns:xl="http://www.w3.org/1999/xlink"&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;
  -		&lt;/content&gt;
  -	&lt;/page&gt;
  +&lt;source:write src=""&gt;
  +	&lt;source:source&gt;tests/result2.xml&lt;/source:source&gt;
  +	&lt;source:fragment&gt;&lt;page xmlns:xl="http://www.w3.org/1999/xlink"&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="test/2"&gt;I am in the XLink NameSpace&lt;/link&gt;&lt;/para&gt;
  +	&lt;/content&gt;
  +&lt;/page&gt;&lt;/source:fragment&gt;
   &lt;/source:write&gt;
   			</pre>
   		</para>
   	
   		<para>The namespace is: http://www.w3.org/1999/xlink</para>
   	
  -<source:write src="tests/result2.xml">
  -<page xmlns:xl="http://www.w3.org/1999/xlink">
  +<source:write src="">
  +	<source:source>tests/result2.xml</source:source>
  +	<source:fragment><page xmlns:xl="http://www.w3.org/1999/xlink">
   	<title>SourceWritingTransformer Test Result 2</title>
   	<content>
   		<para>Congratulations!</para>
   		<para><link xl:to="test/2">I am in the XLink NameSpace</link></para>
   	</content>
  -</page>
  +</page></source:fragment>
   </source:write>
   
   		<para>Have a <a href="../result/2">look!</a></para>
  
  
  
  1.4       +12 -10    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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- test3.xml	13 Mar 2002 19:19:42 -0000	1.3
  +++ test3.xml	1 Jul 2002 08:51:01 -0000	1.4
  @@ -10,24 +10,26 @@
   		<para>The XML is:</para>
   		<para>
   			<pre>
  -&lt;source:write src="tests/newfolder/result3.xml"&gt;
  -	&lt;page&gt;
  -		&lt;title&gt;SourceWritingTransformer Test Result 3&lt;/title&gt;
  -		&lt;content&gt;
  -			&lt;para&gt;Congratulations!&lt;/para&gt;
  -		&lt;/content&gt;
  -	&lt;/page&gt;
  +&lt;source:write xmlns:source="http://apache.org/cocoon/source/1.0"&gt;
  +	&lt;source:source&gt;tests/newfolder/result3.xml&lt;/source:source&gt;
  +	&lt;source:fragment&gt;&lt;page&gt;
  +	&lt;title&gt;SourceWritingTransformer Test Result 3&lt;/title&gt;
  +	&lt;content&gt;
  +		&lt;para&gt;Congratulations!&lt;/para&gt;
  +	&lt;/content&gt;
  +&lt;/page&gt;&lt;/source:fragment&gt;
   &lt;/source:write&gt;
   			</pre>
   		</para>
   		
  -<source:write src="tests/newfolder/result3.xml" xmlns:source="http://apache.org/cocoon/source/1.0">
  -<page>
  +<source:write xmlns:source="http://apache.org/cocoon/source/1.0">
  +	<source:source>tests/newfolder/result3.xml</source:source>
  +	<source:fragment><page>
   	<title>SourceWritingTransformer Test Result 3</title>
   	<content>
   		<para>Congratulations!</para>
   	</content>
  -</page>
  +</page></source:fragment>
   </source:write>
   
   		<para>Have a <a href="../result/newfolder/3">look!</a></para>
  
  
  
  1.4       +6 -4      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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- test4.xml	13 Mar 2002 19:19:42 -0000	1.3
  +++ test4.xml	1 Jul 2002 08:51:01 -0000	1.4
  @@ -12,14 +12,16 @@
   		<para>The XML is:</para>
   		<para>
   			<pre>
  -&lt;source:write src="tests/result4.xml"&gt;
  -	&lt;ci:include src="tests/include.xml"/&gt;
  +&lt;source:write&gt;
  +	&lt;source:source&gt;tests/result4.xml&lt;/source:source&gt;
  +	&lt;source:fragment&gt;&lt;ci:include src="tests/include.xml"/&gt;&lt;/source:fragment&gt;
   &lt;/source:write&gt;
   			</pre>
   		</para>
   		
  -<source:write src="tests/result4.xml">
  -<ci:include src="tests/include-me.xml"/>
  +<source:write>
  +	<source:source>tests/result4.xml</source:source>
  +	<source:fragment><ci:include src="tests/include-me.xml"/></source:fragment>
   </source:write>
   
   		<para>Have a <a href="../result/4">look!</a></para>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/editor/tests/result7.xml
  
  Index: result7.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <page>
  	<title>SourceWritingTransformer Test 7</title>
  	<content>
  		<para>This is the original paragraph</para>
  	</content>
  </page>
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/editor/tests/result8.xml
  
  Index: result8.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <page>
  	<title>SourceWritingTransformer Test 8</title>
  	<content>
  		<para>This is the original paragraph</para>
  	</content>
  </page>
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/editor/tests/test7.xml
  
  Index: test7.xml
  ===================================================================
  <?xml version="1.0" encoding="utf-8"?>
  
  <page 
  	xmlns:source="http://apache.org/cocoon/source/1.0"
  	
  >
  	<title>SourceWritingTransformer Test Page 7</title>
  	<content>
  		<para><b>Test</b>: Insert After</para>
  		<para>This test should have written a file called result7.xml, in the same directory as this.</para>
  		<para>The file's content should come from the xml below, being inserted after the original.</para>
  		<para>The XML is:</para>
  		<para>
  			<pre>
  &lt;source:insert&gt;
  	&lt;source:path&gt;page/content&lt;/source:path&gt;
  	&lt;source:source&gt;tests/result7.xml&lt;/source:source&gt;
  	&lt;source:fragment&gt;&lt;para&gt;Congratulations!&lt;/para&gt;&lt;/source:fragment&gt;
  &lt;/source:insert&gt;
  			</pre>
  		</para>
  	
  	
  <source:insert>
  	<source:path>page/content</source:path>
  	<source:source>tests/result7.xml</source:source>
  	<source:fragment>
  		<para>Congratulations!</para>
  	</source:fragment>
  </source:insert>
  
  		<para>Have a <a href="../result/7">look!</a></para>
  	</content>
  </page>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/editor/tests/test8.xml
  
  Index: test8.xml
  ===================================================================
  <?xml version="1.0" encoding="utf-8"?>
  
  <page 
  	xmlns:source="http://apache.org/cocoon/source/1.0"
  	
  >
  	<title>SourceWritingTransformer Test Page 8</title>
  	<content>
  		<para><b>Test</b>: Insert Before</para>
  		<para>This test should have written a file called result8.xml, in the same directory as this.</para>
  		<para>The file's content should come from the xml below. The paragraph should be inserted before the others.</para>
  		<para>The XML is:</para>
  		<para>
  			<pre>
    &lt;source:insert&gt;
      &lt;source:source&gt;tests/result8.xml&lt;/source:source&gt;
      &lt;source:path&gt;page&lt;/source:path&gt;
      &lt;source:replace&gt;content&lt;/source:replace&gt;
      &lt;source:reinsert&gt;content&lt;/source:reinsert&gt;
      &lt;source:fragment&gt;
        &lt;content&gt;
          &lt;p&gt;This new paragraph gets inserted &lt;emp&gt;before&lt;/emp&gt; the other ones.&lt;/p&gt;
        &lt;/content&gt;
      &lt;/source:fragment&gt;
    &lt;/source:insert&gt;
  			</pre>
  		</para>
  	
  	
    <source:insert>
      <source:source>tests/result8.xml</source:source>
      <source:path>page</source:path>
      <source:replace>content</source:replace>
      <source:reinsert>content</source:reinsert>
      <source:fragment>
  	<content>
  		<p>This new paragraph gets inserted <emp>before</emp> the other ones.</p>
  	</content>
      </source:fragment>
    </source:insert>
  
  		<para>Have a <a href="../result/8">look!</a></para>
  	</content>
  </page>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/editor/tests/test6/inc.xsl
  
  Index: inc.xsl
  ===================================================================
  <?xml version="1.0"?>
  
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  
   <!-- Default template: copy node, and apply templates for all children -->
   <xsl:template match="*">
    <xsl:copy>
     <xsl:copy-of select="@*"/>
     <xsl:apply-templates/>
    </xsl:copy>
   </xsl:template>
  
   <!-- Specific template for foobar: increment the content of the node then copy itself with the new content -->
   <xsl:template match="counter">
    <xsl:variable name="contentNumber" select="number(.)"/>
    <xsl:copy>
     <xsl:copy-of select="@*"/>
     <xsl:value-of select="1+$contentNumber"/>
    </xsl:copy>
   </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/editor/tests/test6/input.xml
  
  Index: input.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <page>
  	<title>SourceWritingTransformer Test Page 6</title>
  	<content>
  		<para><b>Test</b>: Insert Replace</para>
  		<para>This test replicates <a href="9">test 9</a>, but does a <emp>write</emp>, using xslt to update the document.</para>
  		<para>This test should have incremented a counter in this file "tests/test6/input.xml".</para>
  		<para>The counter is: <counter>0</counter></para>
  		<para>Try <a href="../test/6">again</a>!</para>
  	</content>
  </page>
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/editor/tests/test6/prepareWrite.xsl
  
  Index: prepareWrite.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">
   <!-- Copies all the input tree into the input.xml file -->
   <xsl:template match="/">
  	<xsl:copy-of select="*"/>
  	<source:write> 
  	  <source:source>tests/test6/input.xml</source:source>		
  	  <source:fragment><xsl:copy-of select="*"/></source:fragment>		
  	</source:write>
   </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/editor/tests/test9/inc.xsl
  
  Index: inc.xsl
  ===================================================================
  <?xml version="1.0"?>
  
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  
   <!-- Default template: copy node, and apply templates for all children -->
   <xsl:template match="*">
    <xsl:copy>
     <xsl:copy-of select="@*"/>
     <xsl:apply-templates/>
    </xsl:copy>
   </xsl:template>
  
   <!-- Specific template for counter: increment the content of the node then copy itself with the new content -->
   <xsl:template match="counter">
    <xsl:variable name="contentNumber" select="number(.)"/>
    <xsl:copy>
     <xsl:copy-of select="@*"/>
     <xsl:value-of select="1+$contentNumber"/>
    </xsl:copy>
   </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/editor/tests/test9/input.xml
  
  Index: input.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <page>
  	<title>SourceWritingTransformer Test Page 9</title>
  	<content>
  		<para><b>Test</b>: Insert Replace</para>
  		<para>This test replicates <a href="6">test 6</a>, but this time doing an <emp>insert</emp> instead of a <emp>write</emp>.</para>
  		<para>This test should have incremented a counter in this file "tests/test9/input.xml".</para>
  		<para>The counter is: <counter>0</counter></para>
  		<para>
  			<pre>
  &lt;source:insert&gt;
  	&lt;source:source&gt;tests/test9/input.xml&lt;/source:source&gt;
  	&lt;source:path&gt;page/content/para[4]&lt;/source:path&gt;
  	&lt;source:replace&gt;counter&lt;/source:replace&gt;
  	&lt;source:fragment&gt;&lt;counter&gt;n&lt;/counter&gt;&lt;/source:fragment&gt;
  &lt;/source:insert&gt;
  			</pre>
  		</para>
  		<para>Try <a href="../test/9">again</a>!</para>
  	</content>
  </page>
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/editor/tests/test9/prepareWrite.xsl
  
  Index: prepareWrite.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">
  
  	<xsl:template match="/">
  		<page>
  			<xsl:apply-templates select="page/*"/>
  			<source:insert>
  				<source:source>tests/test9/input.xml</source:source>
  				<source:path>page/content/para[4]</source:path>
  				<source:replace>counter</source:replace>
  				<source:fragment><xsl:apply-templates select="/page/content/para[4]/counter"/></source:fragment>
  			</source:insert>
  		</page>
  	</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>
  
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message