jeremy      02/02/28 11:05:12

  Modified:    src/scratchpad/webapp/mount/editor README editor.xmap
                        sitemap.xmap test.xmap
               src/scratchpad/webapp/mount/editor/docs tests.xml
                        welcome.xml xfwt.xml
               src/scratchpad/webapp/mount/editor/editor/docs welcome.xml
               src/scratchpad/webapp/mount/editor/editor/stylesheets
                        editor-components.xsl editor-page2html.xsl
                        simple-page2html.xsl
               src/scratchpad/webapp/mount/editor/tests make-page.xsl
                        test1.xml test2.xml test3.xml test4.xml test5.xml
  Added:       src/scratchpad/webapp/mount/editor/docs source.xml
               src/scratchpad/webapp/mount/editor/editor/stylesheets
                        stream2source.xsl
  Log:
  updated the samples and tests to use the new WriteableSourceTransformer
  
  Revision  Changes    Path
  1.3       +29 -4     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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- README    22 Feb 2002 22:15:34 -0000      1.2
  +++ README    28 Feb 2002 19:05:11 -0000      1.3
  @@ -1,4 +1,4 @@
  -FilWritingTransformer - Installation Notes.
  +WriteableSourceTransformer - Installation Notes.
   
   
   Once you have the latest copy of Cocoon 2 from CVS, compile it.
  @@ -27,13 +27,38 @@
        
   Please report any problems.
   
  -BTW, the directory is called 'editor' because that is what I hope to turn it into, 
with a few more components.
  +There is a sample 'file' editor in here now, called <slash-edit/>. It allows you to 
edit XML files in the outer 'editor/docs/' directory. Currently the sample can only 
edit the entire file in one form field, this is because I am using the StreamGenerator 
to Parse the Request data and it can only handle a single field. An additional problem 
here is that if there is an error in your XML, your will only get part of it written 
to disk.
   
  -To use this in your project, you need to add the 'editor' folder and 'editor.xmap' 
to your project, and add the 'editor pipelines' from the file 'sitemap.xmap' to your 
sitemap.
  +I'm working on samples that break your XML into separate fields so the user is not 
editing raw XML. I can use the RequestGenerator but this does not parse fields, so it 
can only be used to edit simple XML.
  +
  +I think we will need a RequestParsingGenerator, that can selectively parse fields, 
and signal via the generated XML that there has been a Parsing error, not by throwing 
SaxExceptions, that way mal-formed XML in form fields can be handled more gracefully.
  +
  +
  +To use this in your project, you need to add the inner 'editor' folder and 
'editor.xmap' to your project, and add the 'editor pipelines' from the file 
'sitemap.xmap' to your sitemap.
   
   Then you need to develop components for your particular document markup!
        ie. StyleSheets that understand your documents, editor config for your forms 
etc.
  -     I'll go into this in more detail at a later date.
  +
  +Here is a breakdown of the StyleSheets used by the editor, and what they do:
  +
  +editor-page2html.xsl
  +     builds the page for all 'behaviours' calling different templates as 
appropriate.
  +     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.
  +editor-utils.xsl
  +     a few generic utilities used by editor-page2html.xsl
  +simple-page2html.xsl
  +     renders <slash-edit/> welcome page
  +stream2xfwt.xsl 
  +     copies the output of the StreamGenerator into a tag telling the
  +     WriteableSourceTransformer to do it's job.
  +     It xsl:include's 'editor-utils.xsl'.
  +
  +The file 'mount/editor/editor/docs/editor.xml' contains information used by 
'editor-page2html.xsl' such as the names of buttons, the tools for each behaviour, the 
available commands etc.
  +
  +
   
   Thanks
   
  
  
  
  1.2       +9 -9      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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- editor.xmap       22 Feb 2002 22:15:34 -0000      1.1
  +++ editor.xmap       28 Feb 2002 19:05:11 -0000      1.2
  @@ -5,7 +5,7 @@
       <map:generators default="file"/>
       <map:serializers default="html">
       
  -     <!-- You can define your own Serializer for FileWritingTransformer to use-->
  +     <!-- You can define your own Serializer for WriteableSourceTransformer to use 
-->
       
                        <map:serializer
                                name="my-xml-serializer"
  @@ -21,14 +21,14 @@
       </map:serializers>
       <map:transformers default="xslt">
       
  -     <!-- Define 'filewriter' as the name for FileWritingTransformer -->
  +     <!-- Define 'filewriter' as the name for WriteableSourceTransformer -->
        <!-- 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 xfwt:write tag -->
  +     <!-- 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.FileWritingTransformer" label="xfwt">
  +                             
src="org.apache.cocoon.transformation.WriteableSourceTransformer" label="source">
                                <serializer>my-xml-serializer</serializer>
                        </map:transformer>
                        
  @@ -42,7 +42,7 @@
                <map:view name="content" from-label="content">
                        <map:serialize type="xml"/>
                </map:view>     
  -             <map:view name="xfwt" from-label="xfwt">
  +             <map:view name="source" from-label="source">
                        <map:serialize type="xml"/>
                </map:view>     
        </map:views>
  @@ -229,7 +229,7 @@
                                                <map:part 
src="editor/docs/editor.xml"/>
                                                <map:part src="cocoon:/stream"/>
                                        </map:aggregate>
  -                                     <map:transform 
src="editor/stylesheets/stream2xfwt.xsl">
  +                                     <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>
  @@ -244,9 +244,9 @@
                        </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: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"/>
  
  
  
  1.3       +1 -1      xml-cocoon2/src/scratchpad/webapp/mount/editor/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/sitemap.xmap,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- sitemap.xmap      22 Feb 2002 22:15:34 -0000      1.2
  +++ sitemap.xmap      28 Feb 2002 19:05:11 -0000      1.3
  @@ -23,7 +23,7 @@
   <!-- We mount the Editor SiteMap into the same base as this SiteMap, so the Editor 
can reach this SiteMap's files -->
   
                        <!-- slash-edit pipeline -->
  -                     <!-- edit/, edit/new, edit/get/*, edit/put/* -->
  +                     <!-- edit/, edit/new/*, edit/get/*, edit/put, edit/view/* -->
                        <map:match pattern="edit**">
                                <map:mount uri-prefix="edit" src="editor.xmap" 
check-reload="yes"/>
                        </map:match>
  
  
  
  1.2       +10 -6     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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- test.xmap 22 Feb 2002 22:15:34 -0000      1.1
  +++ test.xmap 28 Feb 2002 19:05:11 -0000      1.2
  @@ -24,11 +24,11 @@
        <!-- 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 xfwt:write tag -->
  +     <!-- 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.FileWritingTransformer">
  +                             
src="org.apache.cocoon.transformation.WriteableSourceTransformer">
                                <serializer>my-xml-serializer</serializer>
                        </map:transformer>
                        
  @@ -57,10 +57,6 @@
                        <map:match pattern="test/5">
                                <map:generate src="tests/test5.xml"/>
                                <map:transform src="tests/make-page.xsl"/>
  -                             <!--<map:transform type="log">
  -                                     <map:parameter name="logfile" 
value="test1.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> 
  @@ -72,7 +68,15 @@
   
                        <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="append" value="no"/>
  +                             </map:transform>
                                <map:transform type="filewriter"/>
  +                             <map:transform type="log">
  +                                     <map:parameter name="logfile" 
value="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>
  
  
  
  1.2       +5 -1      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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- tests.xml 22 Feb 2002 22:15:35 -0000      1.1
  +++ tests.xml 28 Feb 2002 19:05:11 -0000      1.2
  @@ -1,9 +1,12 @@
   <?xml version="1.0" encoding="utf-8"?>
   
   <page>
  - <title>FileWritingTransformer Tests</title>
  + <title>WritableSourceTransformer Tests</title>
    <content>
     <para>
  +     NB: WritableSourceTransformer has replaced FileWritingTransformer.
  +  </para>
  +  <para>
        Tests: Please run these tests and report any problems.
     </para>
     <para>
  @@ -21,5 +24,6 @@
     <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>.
     </para>
  +  
    </content>
   </page>
  
  
  
  1.4       +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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- welcome.xml       22 Feb 2002 22:15:35 -0000      1.3
  +++ welcome.xml       28 Feb 2002 19:05:11 -0000      1.4
  @@ -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="xfwt">FileWritingTransformer</a>
  +  <para>This suite uses the <a href="source">WriteableSourceTransformer</a>
   </para>
     
    </content>
  
  
  
  1.2       +4 -0      xml-cocoon2/src/scratchpad/webapp/mount/editor/docs/xfwt.xml
  
  Index: xfwt.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/docs/xfwt.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- xfwt.xml  22 Feb 2002 22:15:35 -0000      1.1
  +++ xfwt.xml  28 Feb 2002 19:05:11 -0000      1.2
  @@ -4,6 +4,10 @@
    <title>FileWritingTransformer</title>
    <content>
   
  +  <para>
  +     NB: WritableSourceTransformer has replaced FileWritingTransformer.
  +  </para>
  +
     <para>Please try the <a href="tests">tests</a></para>
     
     <para>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/editor/docs/source.xml
  
  Index: source.xml
  ===================================================================
  <?xml version="1.0" encoding="utf-8"?>
  
  <page>
   <title>WritableSourceTransformer</title>
   <content>
  
    <para>
        NB: WritableSourceTransformer has replaced FileWritingTransformer.
    </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> 
     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 WritableSourceTransformer.
    </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.
    </para>
      
    <para>
     SiteMap:
    </para>
      
    <para>
     WritableSourceTransformer 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;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 WritableSourceTransformer to the 
pipeline, 
     again specifying the Serializer to use here is optional.
    </para>
    
    <para>
  <pre>
   &lt;map:transform type="filewriter"&gt;
    [&lt;map:parameter name="serialiser" value="my-xml-serialiser"/&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>
   &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;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>
      
      
    <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>
  
  
   </content>
  </page>
  
  
  
  1.2       +1 -1      
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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- welcome.xml       22 Feb 2002 22:18:10 -0000      1.1
  +++ welcome.xml       28 Feb 2002 19:05:12 -0000      1.2
  @@ -62,7 +62,7 @@
                                <td colspan="3">Components Used:</td>
                        </tr>
                        <tr valign="top">
  -                             
<td>&#160;&#160;</td><td>FileWritingTransformer</td><td>Serialises part of the SAX 
stream to disk</td>
  +                             
<td>&#160;&#160;</td><td>WriteableSourceTransformer</td><td>Serialises part of the SAX 
stream to disk</td>
                        </tr>
                        <tr valign="top">
                                <td></td><td>DirectoryGenerator</td><td>Generates a 
directory listing</td>
  
  
  
  1.2       +23 -18    
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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- editor-components.xsl     22 Feb 2002 22:15:35 -0000      1.1
  +++ editor-components.xsl     28 Feb 2002 19:05:12 -0000      1.2
  @@ -3,7 +3,7 @@
   <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:dir="http://apache.org/cocoon/directory/2.0";
  - xmlns:xfwt="http://apache.org/cocoon/xfwt/1.0";>
  + xmlns:source="http://apache.org/cocoon/source/1.0";>
   
   
   
  @@ -125,8 +125,8 @@
      </tr>
     </xsl:template>
    
  -<!-- outputs the response from FileWritingTransformer -->
  -  <xsl:template match="xfwt:write">
  +<!-- outputs the response from WriteableSourceTransformer -->
  +  <xsl:template match="source:write">
                <table border="0" cellspacing="0" cellpadding="5" width="100%">
                        <tr>
                                <td class="caption">Result</td>
  @@ -152,21 +152,26 @@
                                        <xsl:value-of select="@src"/>
                                </td>
                        </tr>
  -                     <tr>
  -                             <td class="caption">Action</td>
  -                             <td class="result">
  -                                     <xsl:choose>
  -                                             <xsl:when test="@action = 'new'">New 
file created</xsl:when>
  -                                             <xsl:otherwise>Existing file 
overwritten</xsl:otherwise>
  -                                     </xsl:choose>
  -                             </td>
  -                     </tr>
  -                     <tr>
  -                             <td class="caption">Serializer</td>
  -                             <td class="result">
  -                                     <xsl:value-of select="@serializer"/>
  -                             </td>
  -                     </tr>
  +                     <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:otherwise>Existing file 
overwritten</xsl:otherwise>
  +                                             </xsl:choose>
  +                                     </td>
  +                             </tr>
  +                     </xsl:if>
  +                     <xsl:if test="@serializer">
  +                             <tr>
  +                                     <td class="caption">Serializer</td>
  +                                     <td class="result">
  +                                             <xsl:value-of select="@serializer"/>
  +                                     </td>
  +                             </tr>
  +                     </xsl:if>
                </table>
     </xsl:template>
   
  
  
  
  1.2       +2 -2      
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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- editor-page2html.xsl      22 Feb 2002 22:15:35 -0000      1.1
  +++ editor-page2html.xsl      28 Feb 2002 19:05:12 -0000      1.2
  @@ -3,7 +3,7 @@
   <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:dir="http://apache.org/cocoon/directory/2.0";
  - xmlns:xfwt="http://apache.org/cocoon/xfwt/1.0";>
  + xmlns:source="http://apache.org/cocoon/source/1.0";>
   
        <!-- 
                This is the main Editor Stylesheet
  @@ -68,7 +68,7 @@
          <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="xfwt:write"/></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>
                                        <xsl:otherwise>Houston, we have a 
problem.</xsl:otherwise>
  
  
  
  1.2       +1 -1      
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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- simple-page2html.xsl      22 Feb 2002 22:15:35 -0000      1.1
  +++ simple-page2html.xsl      28 Feb 2002 19:05:12 -0000      1.2
  @@ -2,7 +2,7 @@
   
   <xsl:stylesheet version="1.0" 
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  -     xmlns:xfwt="http://apache.org/cocoon/xfwt/1.0";
  +     xmlns:source="http://apache.org/cocoon/source/1.0";
   >
   
   <!-- this stylesheet is currently only used to display the editor/edit/welcome page 
-->
  
  
  
  1.1                  
xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/stream2source.xsl
  
  Index: stream2source.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:include href="editor-utils.xsl"/>
  
  <!-- 
        You have to get pretty tricky with your XSL here to make sure 
        your XML indentation written to file is how you like it
  -->  
  
  
  <xsl:template match="root">  
        <xsl:copy>
                <xsl:apply-templates/>
        </xsl:copy>
  </xsl:template> 
   
  <xsl:template match="page">
  <source:write src="{$target-path}" 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>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.2       +3 -3      
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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- make-page.xsl     22 Feb 2002 22:15:35 -0000      1.1
  +++ make-page.xsl     28 Feb 2002 19:05:12 -0000      1.2
  @@ -2,7 +2,7 @@
   
   <xsl:stylesheet version="1.0" 
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  -     xmlns:xfwt="http://apache.org/cocoon/xfwt/1.0";
  +     xmlns:source="http://apache.org/cocoon/source/1.0";
   >
   
     <xsl:template match="page">
  @@ -12,7 +12,7 @@
     </xsl:template>
   
     <xsl:template match="make-page">
  -     <xfwt:write src="tests/result5.xml" xml:space="preserve">
  +     <source:write src="tests/result5.xml" xml:space="preserve">
   <page xmlns:xl="http://www.w3.org/1999/xlink";>
        <title>Result from - <xsl:value-of select="/page/title"/></title>
        <content>
  @@ -27,7 +27,7 @@
                <para>And <link xl:to="nowhere">here</link> is another fake XLink, for 
luck</para>
        </content>
   </page>
  -             </xfwt:write>
  +             </source:write>
     </xsl:template>
   
     <xsl:template match="@*|node()" priority="-2">
  
  
  
  1.2       +8 -8      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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- test1.xml 22 Feb 2002 22:15:35 -0000      1.1
  +++ test1.xml 28 Feb 2002 19:05:12 -0000      1.2
  @@ -1,7 +1,7 @@
   <?xml version="1.0" encoding="utf-8"?>
   
  -<page xmlns:xfwt="http://apache.org/cocoon/xfwt/1.0";>
  -     <title>FileWritingTransformer Test Page 1</title>
  +<page xmlns:source="http://apache.org/cocoon/source/1.0";>
  +     <title>WritableSourceTransformer 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>
  @@ -9,25 +9,25 @@
                <para>The XML is:</para>
                <para>
                        <pre>
  -     &lt;xfwt:write src="tests/result1.xml"&gt;
  +     &lt;source:write src="tests/result1.xml"&gt;
                &lt;page&gt;
  -                     &lt;title&gt;FileWritingTransformer Test Result 1&lt;/title&gt;
  +                     &lt;title&gt;WritableSourceTransformer Test Result 
1&lt;/title&gt;
                        &lt;content&gt;
                                &lt;para&gt;Congratulations!&lt;/para&gt;
                        &lt;/content&gt;
                &lt;/page&gt;
  -     &lt;/xfwt:write&gt;
  +     &lt;/source:write&gt;
                        </pre>
                </para>
        
  -<xfwt:write src="tests/result1.xml">
  +<source:write src="tests/result1.xml">
   <page>
  -     <title>FileWritingTransformer Test Result 1</title>
  +     <title>WritableSourceTransformer Test Result 1</title>
        <content>
                <para>Congratulations!</para>
        </content>
   </page>
  -</xfwt:write>
  +</source:write>
   
                <para>Have a <a href="../result/1">look!</a></para>
        </content>
  
  
  
  1.2       +8 -8      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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- test2.xml 22 Feb 2002 22:15:35 -0000      1.1
  +++ test2.xml 28 Feb 2002 19:05:12 -0000      1.2
  @@ -1,10 +1,10 @@
   <?xml version="1.0" encoding="utf-8"?>
   
   <page 
  -     xmlns:xfwt="http://apache.org/cocoon/xfwt/1.0";
  +     xmlns:source="http://apache.org/cocoon/source/1.0";
        
   >
  -     <title>FileWritingTransformer Test Page 2</title>
  +     <title>WritableSourceTransformer 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>
  @@ -12,29 +12,29 @@
                <para>The XML is:</para>
                <para>
                        <pre>
  -&lt;xfwt:write src="tests/result2.xml"&gt;
  +&lt;source:write src="tests/result2.xml"&gt;
        &lt;page xmlns:xl="http://www.w3.org/1999/xlink"&gt;
  -             &lt;title&gt;FileWritingTransformer Test Result 2&lt;/title&gt;
  +             &lt;title&gt;WritableSourceTransformer 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;/xfwt:write&gt;
  +&lt;/source:write&gt;
                        </pre>
                </para>
        
                <para>The namespace is: http://www.w3.org/1999/xlink</para>
        
  -<xfwt:write src="tests/result2.xml">
  +<source:write src="tests/result2.xml">
   <page xmlns:xl="http://www.w3.org/1999/xlink";>
  -     <title>FileWritingTransformer Test Result 2</title>
  +     <title>WritableSourceTransformer Test Result 2</title>
        <content>
                <para>Congratulations!</para>
                <para><link xl:to="test/2">I am in the XLink NameSpace</link></para>
        </content>
   </page>
  -</xfwt:write>
  +</source:write>
   
                <para>Have a <a href="../result/2">look!</a></para>
        </content>
  
  
  
  1.2       +7 -7      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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- test3.xml 22 Feb 2002 22:15:35 -0000      1.1
  +++ test3.xml 28 Feb 2002 19:05:12 -0000      1.2
  @@ -2,7 +2,7 @@
   
   <page  page="blah"
   >
  -     <title>FileWritingTransformer Test Page 3!!!!!</title>
  +     <title>WritableSourceTransformer 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>
  @@ -10,25 +10,25 @@
                <para>The XML is:</para>
                <para>
                        <pre>
  -&lt;xfwt:write src="tests/newfolder/result3.xml"&gt;
  +&lt;source:write src="tests/newfolder/result3.xml"&gt;
        &lt;page&gt;
  -             &lt;title&gt;FileWritingTransformer Test Result 3&lt;/title&gt;
  +             &lt;title&gt;WritableSourceTransformer Test Result 3&lt;/title&gt;
                &lt;content&gt;
                        &lt;para&gt;Congratulations!&lt;/para&gt;
                &lt;/content&gt;
        &lt;/page&gt;
  -&lt;/xfwt:write&gt;
  +&lt;/source:write&gt;
                        </pre>
                </para>
                
  -<xfwt:write src="tests/newfolder/result3.xml" 
xmlns:xfwt="http://apache.org/cocoon/xfwt/1.0";>
  +<source:write src="tests/newfolder/result3.xml" 
xmlns:source="http://apache.org/cocoon/source/1.0";>
   <page>
  -     <title>FileWritingTransformer Test Result 3</title>
  +     <title>WritableSourceTransformer Test Result 3</title>
        <content>
                <para>Congratulations!</para>
        </content>
   </page>
  -</xfwt:write>
  +</source:write>
   
                <para>Have a <a href="../result/newfolder/3">look!</a></para>
        </content>
  
  
  
  1.2       +7 -7      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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- test4.xml 22 Feb 2002 22:15:35 -0000      1.1
  +++ test4.xml 28 Feb 2002 19:05:12 -0000      1.2
  @@ -1,26 +1,26 @@
   <?xml version="1.0" encoding="utf-8"?>
   
   <page 
  -     xmlns:xfwt="http://apache.org/cocoon/xfwt/1.0";
  +     xmlns:source="http://apache.org/cocoon/source/1.0";
        xmlns:ci="http://apache.org/cocoon/include/1.0";
   >
  -     <title>FileWritingTransformer Test Page 4</title>
  +     <title>WritableSourceTransformer 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="xfwt">include-me.xml</a>.</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>
                <para>The file's content is setup from the xml below.</para>
                <para>The XML is:</para>
                <para>
                        <pre>
  -&lt;xfwt:write src="tests/result4.xml"&gt;
  +&lt;source:write src="tests/result4.xml"&gt;
        &lt;ci:include src="tests/include.xml"/&gt;
  -&lt;/xfwt:write&gt;
  +&lt;/source:write&gt;
                        </pre>
                </para>
                
  -<xfwt:write src="tests/result4.xml">
  +<source:write src="tests/result4.xml">
   <ci:include src="tests/include-me.xml"/>
  -</xfwt:write>
  +</source:write>
   
                <para>Have a <a href="../result/4">look!</a></para>
        </content>
  
  
  
  1.2       +1 -1      xml-cocoon2/src/scratchpad/webapp/mount/editor/tests/test5.xml
  
  Index: test5.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/tests/test5.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- test5.xml 22 Feb 2002 22:15:35 -0000      1.1
  +++ test5.xml 28 Feb 2002 19:05:12 -0000      1.2
  @@ -4,7 +4,7 @@
        <title>FileWritingTransformer Test Page 5</title>
        <content>
                <para><b>Test</b>: XSLT Test</para>
  -             <para>This test should have written a file called result5.xml, with 
the contents being generated by a <a 
href="../../../view-source?filename=mount/editor/tests/make-page.xsl" 
target="xfwt">StyleSheet</a>.</para>
  +             <para>This test should have written a file called result5.xml, with 
the contents being generated by a <a 
href="../../../view-source?filename=mount/editor/tests/make-page.xsl" 
target="source">StyleSheet</a>.</para>
                <para>This also tests setting the serializer from the invocation of 
FileWritingTransformer in the SiteMap.</para>
                <para>Anyway, the big issue here is that it is tricky to write XSL 
that gives you a clean XML indentation in your file. You can probably see how I have 
not quite got it right yet ;)</para>
                <para>The file's content is setup from the xml below.</para>
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to