cziegeler    2002/07/01 07:43:17

  Modified:    src/java/org/apache/cocoon/serialization
                        AbstractTextSerializer.java HTMLSerializer.java
                        TextSerializer.java XMLSerializer.java
               src/java/org/apache/cocoon/transformation
                        SourceWritingTransformer.java
               src/java/org/apache/cocoon/xml XMLUtils.java
  Log:
  Fixing namespace problem with SourceWritingTransformer by using a workaround for a 
known Xalan bug
  
  Revision  Changes    Path
  1.11      +14 -2     
xml-cocoon2/src/java/org/apache/cocoon/serialization/AbstractTextSerializer.java
  
  Index: AbstractTextSerializer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/serialization/AbstractTextSerializer.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- AbstractTextSerializer.java       28 May 2002 13:08:13 -0000      1.10
  +++ AbstractTextSerializer.java       1 Jul 2002 14:43:17 -0000       1.11
  @@ -171,6 +171,18 @@
       }
   
       /**
  +     * Helper for TransformerHandler.
  +     */
  +    protected TransformerHandler getTransformerHandler()
  +    throws javax.xml.transform.TransformerException {
  +        // return this.getTransformerFactory().newTransformerHandler();
  +        // FIXME - This is a workaround for bug #5779 of Xalan
  +        return this.getTransformerFactory().newTransformerHandler(
  +                      new javax.xml.transform.stream.StreamSource(new 
java.io.StringReader(org.apache.cocoon.xml.XMLUtils.xalanBugStylesheet)));
  +        // End workaround
  +    }
  +
  +    /**
        * Set the <code>OutputStream</code> where the XML should be serialized.
        */
       public void setOutputStream(OutputStream out) {
  @@ -306,7 +318,7 @@
               String prefix = "nsp";
               String check = "xmlns:" + prefix + "='" + uri + "'";
   
  -            TransformerHandler handler = factory.newTransformerHandler();
  +            TransformerHandler handler = this.getTransformerHandler();
   
               handler.setResult(new StreamResult(writer));
               handler.getTransformer().setOutputProperties(format);
  
  
  
  1.6       +2 -2      
xml-cocoon2/src/java/org/apache/cocoon/serialization/HTMLSerializer.java
  
  Index: HTMLSerializer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/serialization/HTMLSerializer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- HTMLSerializer.java       22 Feb 2002 07:03:55 -0000      1.5
  +++ HTMLSerializer.java       1 Jul 2002 14:43:17 -0000       1.6
  @@ -70,7 +70,7 @@
       public void setOutputStream(OutputStream out) {
           try {
               super.setOutputStream(out);
  -            handler = getTransformerFactory().newTransformerHandler();
  +            handler = this.getTransformerHandler();
               format.put(OutputKeys.METHOD,"html");
               handler.setResult(new StreamResult(this.output));
               handler.getTransformer().setOutputProperties(format);
  
  
  
  1.6       +2 -2      
xml-cocoon2/src/java/org/apache/cocoon/serialization/TextSerializer.java
  
  Index: TextSerializer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/serialization/TextSerializer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TextSerializer.java       22 Feb 2002 07:03:55 -0000      1.5
  +++ TextSerializer.java       1 Jul 2002 14:43:17 -0000       1.6
  @@ -70,7 +70,7 @@
       public void setOutputStream(OutputStream out) {
           try {
               super.setOutputStream(out);
  -            handler = getTransformerFactory().newTransformerHandler();
  +            handler = this.getTransformerHandler();
               format.put(OutputKeys.METHOD,"text");
               handler.setResult(new StreamResult(this.output));
               handler.getTransformer().setOutputProperties(format);
  
  
  
  1.6       +2 -2      
xml-cocoon2/src/java/org/apache/cocoon/serialization/XMLSerializer.java
  
  Index: XMLSerializer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/serialization/XMLSerializer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XMLSerializer.java        22 Feb 2002 07:03:55 -0000      1.5
  +++ XMLSerializer.java        1 Jul 2002 14:43:17 -0000       1.6
  @@ -70,7 +70,7 @@
       public void setOutputStream(OutputStream out) {
           try {
               super.setOutputStream(out);
  -            this.handler = getTransformerFactory().newTransformerHandler();
  +            this.handler = this.getTransformerHandler();
               format.put(OutputKeys.METHOD,"xml");
               handler.setResult(new StreamResult(this.output));
               handler.getTransformer().setOutputProperties(format);
  
  
  
  1.6       +117 -117  
xml-cocoon2/src/java/org/apache/cocoon/transformation/SourceWritingTransformer.java
  
  Index: SourceWritingTransformer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/transformation/SourceWritingTransformer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SourceWritingTransformer.java     1 Jul 2002 08:53:39 -0000       1.5
  +++ SourceWritingTransformer.java     1 Jul 2002 14:43:17 -0000       1.6
  @@ -110,13 +110,13 @@
    *     &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: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>
    *
  @@ -126,7 +126,7 @@
    * &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: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;
  @@ -143,8 +143,8 @@
    * &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: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;
  @@ -178,9 +178,9 @@
    * &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: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;
  @@ -236,7 +236,7 @@
    *  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.</p>
    *
  - *  <p>[JQ] - the way I understand this, looking at the code: 
  + *  <p>[JQ] - the way I understand this, looking at the code:
    *  <pre>
    *   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.
  @@ -262,8 +262,8 @@
   
       public static final String SWT_URI = "http://apache.org/cocoon/source/1.0";;
       public static final String DEFAULT_SERIALIZER = "xml";
  -    
  -             /** incoming elements */
  +
  +        /** incoming elements */
       public static final String WRITE_ELEMENT = "write";
       public static final String INSERT_ELEMENT = "insert";
       public static final String PATH_ELEMENT = "path";
  @@ -278,11 +278,11 @@
       public static final String ACTION_ELEMENT = "action";
       public static final String MESSAGE_ELEMENT = "message";
       public static final String SERIALIZER_ELEMENT = "serializer";
  -             /** main (write or insert) tag attributes */
  +        /** main (write or insert) tag attributes */
       public static final String SERIALIZER_ATTRIBUTE = "serializer";
       public static final String CREATE_ATTRIBUTE = "create";
       public static final String OVERWRITE_ATTRIBUTE = "overwrite";
  -             /** results */
  +        /** results */
       public static final String RESULT_FAILED = "failed";
       public static final String RESULT_SUCCESS = "success";
       public static final String ACTION_NONE = "none";
  @@ -489,7 +489,7 @@
                                       name);
   
               this.state = STATE_OUTSIDE;
  -            
  +
           } else if (name.equals(WRITE_ELEMENT) == true && this.state == STATE_WRITE) 
{
   
               // get the information from the stack
  @@ -507,7 +507,7 @@
                       fileName = (String)this.stack.pop();
                   } else if (tag.equals("FRAGMENT") == true) {
                       fragment = (DocumentFragment)this.stack.pop();
  -                } 
  +                }
               } while (tag.equals("WRITE") == false);
               final String localSerializer = (String)this.stack.pop();
               final boolean overwrite = this.stack.pop().equals("true");
  @@ -522,7 +522,7 @@
                                       reinsert,
                                       localSerializer,
                                       name);
  -                                    
  +
               this.state = STATE_OUTSIDE;
   
           // Element: file
  @@ -639,7 +639,7 @@
               exists = ws.exists();
               target = source.getSystemId();
               if ( exists == true && this.state == STATE_INSERT ) {
  -                                                             message = "content 
inserted at: " + path;
  +                                message = "content inserted at: " + path;
                   resource = SourceUtil.toDOM( source, this.manager );
                   // import the fragment
                   Node importNode = resource.importNode(fragment, true);
  @@ -656,8 +656,8 @@
                           }
                           if (replaceNode != null) {
                               if (overwrite == true) {
  -                                                                             
parent.replaceChild(importNode, replaceNode);
  -                                                                                    
                                         message += ", replacing: " + replacePath;
  +                                                parent.replaceChild(importNode, 
replaceNode);
  +                                                                message += ", 
replacing: " + replacePath;
                                   if (reinsertPath != null) {
                                       Node insertAt = 
XMLUtil.getSingleNode(importNode, reinsertPath);
                                       if (insertAt != null) {
  @@ -665,13 +665,13 @@
                                               
insertAt.appendChild(replaceNode.getFirstChild());
                                           }
                                       } else { // reinsert point null
  -                                                                                    
                                                                 message = "replace 
failed, could not find your reinsert path: " + reinsertPath;
  -                                                                                    
                                                                 resource = null;
  +                                                                            message 
= "replace failed, could not find your reinsert path: " + reinsertPath;
  +                                                                            
resource = null;
                                       }
                                   }
                               } else { // overwrite was false
  -                             message = "replace failed, no overwrite allowed.";
  -                             resource = null;/**/
  +                                message = "replace failed, no overwrite allowed.";
  +                                resource = null;/**/
                               }
                           } else { // specified replaceNode was not found
                               parent.appendChild(importNode);
  @@ -683,28 +683,28 @@
                       parent.appendChild(importNode);
                   }
               } else if (create == true) {
  -                                                             Parser parser = 
(Parser)this.manager.lookup(Parser.ROLE);
  -                                                             try {
  -                                                                             
resource = parser.createDocument();
  -                                                             } finally {
  -                                                                             
this.manager.release( parser );
  -                                                             }
  -                                                             // import the fragment
  -                                                             Node importNode = 
resource.importNode(fragment, true);
  -                                                             if ( path.equals("") ) 
{  // this is allowed in write
  -                                                                     
resource.appendChild(importNode);
  -                                                                     message = 
"entire source overwritten";
  -                                                                     
  -                                                             } else {
  -                                                                     // get the node
  -                                                                     Node parent = 
XMLUtil.selectSingleNode(resource, path);
  -                                                                     // add fragment
  -                                                                     
parent.appendChild(importNode);
  -                                                                     message = 
"content appended to: " + path;
  -                                                             }
  +                                Parser parser = 
(Parser)this.manager.lookup(Parser.ROLE);
  +                                try {
  +                                        resource = parser.createDocument();
  +                                } finally {
  +                                        this.manager.release( parser );
  +                                }
  +                                // import the fragment
  +                                Node importNode = resource.importNode(fragment, 
true);
  +                                if ( path.equals("") ) {  // this is allowed in 
write
  +                                    resource.appendChild(importNode);
  +                                    message = "entire source overwritten";
  +
  +                                } else {
  +                                    // get the node
  +                                    Node parent = 
XMLUtil.selectSingleNode(resource, path);
  +                                    // add fragment
  +                                    parent.appendChild(importNode);
  +                                    message = "content appended to: " + path;
  +                                }
               } else {
  -                                                     message = "create not allowed";
  -             resource = null;/**/
  +                            message = "create not allowed";
  +                resource = null;/**/
               }
   
               // write source
  @@ -720,94 +720,94 @@
                       // use serializer
                       if (localSerializer == null) localSerializer = 
this.configuredSerializerName;
                       if (localSerializer != null) {
  -                                                                                    
 // Lookup the Serializer
  -                                                                                    
 ComponentSelector selector = null;
  -                                                                                    
 Serializer serializer = null;
  -                                                                                    
 OutputStream oStream = null;
  -                                                                                    
 try {
  -                                                                                    
         selector = (ComponentSelector)manager.lookup(Serializer.ROLE + "Selector");
  -                                                                                    
         serializer = (Serializer)selector.select(localSerializer);
  -                                                                                    
         oStream = ws.getOutputStream();
  -                                                                                    
         serializer.setOutputStream(oStream);
  -                                                                                    
         DOMStreamer streamer = new DOMStreamer(serializer);
  -                                                                                    
         streamer.stream(resource);
  -                                                                                    
 } finally {
  -                                                                                    
         if (oStream != null) {
  -                                                                                    
                 oStream.flush();
  -                                                                                    
                 try {
  -                                                                                    
                         oStream.close();
  -                                                                                    
                         failed = false;
  -                                                                                    
                 } catch (Throwable t) {
  -                                                                                    
                         if (this.getLogger().isDebugEnabled() == true) {
  -                                                                                    
                                 this.getLogger().debug("FAIL (oStream.close) 
exception"+t);
  -                                                                                    
                                 throw new ProcessingException("Could not process your 
document.", t);
  -                                                                                    
                         }
  -                                                                                    
                 } finally {
  -                                                                                    
                         if ( selector != null ) {
  -                                                                                    
                                         selector.release( serializer );
  -                                                                                    
                                         this.manager.release( selector ); 
  -                                                                                    
                         }
  -                                                                                    
                 }
  -                                                                                    
         }
  -                                                                                    
 }
  +                        // Lookup the Serializer
  +                        ComponentSelector selector = null;
  +                        Serializer serializer = null;
  +                        OutputStream oStream = null;
  +                        try {
  +                            selector = 
(ComponentSelector)manager.lookup(Serializer.ROLE + "Selector");
  +                            serializer = 
(Serializer)selector.select(localSerializer);
  +                            oStream = ws.getOutputStream();
  +                            serializer.setOutputStream(oStream);
  +                            DOMStreamer streamer = new DOMStreamer(serializer);
  +                            streamer.stream(resource);
  +                        } finally {
  +                            if (oStream != null) {
  +                                oStream.flush();
  +                                try {
  +                                    oStream.close();
  +                                    failed = false;
  +                                } catch (Throwable t) {
  +                                    if (this.getLogger().isDebugEnabled() == true) {
  +                                        this.getLogger().debug("FAIL 
(oStream.close) exception"+t);
  +                                        throw new ProcessingException("Could not 
process your document.", t);
  +                                    }
  +                                } finally {
  +                                    if ( selector != null ) {
  +                                            selector.release( serializer );
  +                                            this.manager.release( selector );
  +                                    }
  +                                }
  +                            }
  +                        }
                       } else {
  -                                                                                    
 if (this.getLogger().isDebugEnabled() == true) {
  -                                                                                    
         this.getLogger().debug("ERROR no serializer");
  -                                                                                    
 }
  -                                                                                    
 //throw new ProcessingException("No serializer specified for writing to source " + 
systemID);
  -                                                                                    
 message = "That source requires a serializer, please add the appropirate tag to your 
code.";
  +                        if (this.getLogger().isDebugEnabled() == true) {
  +                            this.getLogger().debug("ERROR no serializer");
  +                        }
  +                        //throw new ProcessingException("No serializer specified 
for writing to source " + systemID);
  +                        message = "That source requires a serializer, please add 
the appropirate tag to your code.";
                       }
                   }
  -                                             }
  +            }
           } catch (DOMException de) {
  -                                             if (this.getLogger().isDebugEnabled() 
== true) {
  -                                                             
this.getLogger().debug("FAIL exception: "+de);
  -                                             }
  +            if (this.getLogger().isDebugEnabled() == true) {
  +                    this.getLogger().debug("FAIL exception: "+de);
  +            }
               //throw new ProcessingException("Could not process your document.", de);
               message = "There was a problem manipulating your document: " + de;
           } catch (ComponentException ce) {
  -                                             if (this.getLogger().isDebugEnabled() 
== true) {
  -                                                             
this.getLogger().debug("FAIL exception: "+ce);
  -                                             }
  +            if (this.getLogger().isDebugEnabled() == true) {
  +                    this.getLogger().debug("FAIL exception: "+ce);
  +            }
               //throw new ProcessingException("Unable to lookup component.", ce);
               message = "There was a problem looking up a component: " + ce;
           } catch (SourceException se) {
  -                                             if (this.getLogger().isDebugEnabled() 
== true) {
  -                                                             
this.getLogger().debug("FAIL exception: "+se);
  -                                             }
  +            if (this.getLogger().isDebugEnabled() == true) {
  +                    this.getLogger().debug("FAIL exception: "+se);
  +            }
               //throw new ProcessingException("Error during resolving "+systemID, se);
               message = "There was a problem resolving that source: [" + systemID + 
"] : " + se;
           } finally {
               this.resolver.release( source );
           }
  -        
  -                             // Report result
  -                             String result = (failed) ? RESULT_FAILED : 
RESULT_SUCCESS;
  -                             String action = ACTION_NONE;
  -                             if (!failed) { action = (exists) ? ACTION_OVER : 
ACTION_NEW; }
  -
  -                             sendStartElementEvent(RESULT_ELEMENT);
  -                                     sendStartElementEvent(EXECUTION_ELEMENT);
  -                                             sendTextEvent(result);
  -                                     sendEndElementEvent(EXECUTION_ELEMENT);
  -                                     sendStartElementEvent(MESSAGE_ELEMENT);
  -                                             sendTextEvent(message);
  -                                     sendEndElementEvent(MESSAGE_ELEMENT);
  -                                     sendStartElementEvent(BEHAVIOUR_ELEMENT);
  -                                             sendTextEvent(tagname);
  -                                     sendEndElementEvent(BEHAVIOUR_ELEMENT);
  -                                     sendStartElementEvent(ACTION_ELEMENT);
  -                                             sendTextEvent(action);
  -                                     sendEndElementEvent(ACTION_ELEMENT);
  -                                     sendStartElementEvent(SOURCE_ELEMENT);
  -                                             sendTextEvent(target);
  -                                     sendEndElementEvent(SOURCE_ELEMENT);
  -                                     if (localSerializer != null) {
  -                                             
sendStartElementEvent(SERIALIZER_ELEMENT);
  -                                                     sendTextEvent(localSerializer);
  -                                             
sendEndElementEvent(SERIALIZER_ELEMENT);
  -                                     }
  -                             sendEndElementEvent(RESULT_ELEMENT);
  +
  +        // Report result
  +        String result = (failed) ? RESULT_FAILED : RESULT_SUCCESS;
  +        String action = ACTION_NONE;
  +        if (!failed) { action = (exists) ? ACTION_OVER : ACTION_NEW; }
  +
  +        sendStartElementEvent(RESULT_ELEMENT);
  +            sendStartElementEvent(EXECUTION_ELEMENT);
  +                sendTextEvent(result);
  +            sendEndElementEvent(EXECUTION_ELEMENT);
  +            sendStartElementEvent(MESSAGE_ELEMENT);
  +                sendTextEvent(message);
  +            sendEndElementEvent(MESSAGE_ELEMENT);
  +            sendStartElementEvent(BEHAVIOUR_ELEMENT);
  +                sendTextEvent(tagname);
  +            sendEndElementEvent(BEHAVIOUR_ELEMENT);
  +            sendStartElementEvent(ACTION_ELEMENT);
  +                sendTextEvent(action);
  +            sendEndElementEvent(ACTION_ELEMENT);
  +            sendStartElementEvent(SOURCE_ELEMENT);
  +                sendTextEvent(target);
  +            sendEndElementEvent(SOURCE_ELEMENT);
  +            if (localSerializer != null) {
  +                sendStartElementEvent(SERIALIZER_ELEMENT);
  +                    sendTextEvent(localSerializer);
  +                sendEndElementEvent(SERIALIZER_ELEMENT);
  +            }
  +        sendEndElementEvent(RESULT_ELEMENT);
   
           if (this.getLogger().isDebugEnabled() == true) {
               this.getLogger().debug("END insertFragment");
  
  
  
  1.8       +3 -3      xml-cocoon2/src/java/org/apache/cocoon/xml/XMLUtils.java
  
  Index: XMLUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/xml/XMLUtils.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- XMLUtils.java     8 May 2002 11:36:09 -0000       1.7
  +++ XMLUtils.java     1 Jul 2002 14:43:17 -0000       1.8
  @@ -215,7 +215,7 @@
       }
   
       // FIXME - for Xalan bug
  -    private static String stylesheet = "<?xml version=\"1.0\"?><xsl:stylesheet 
version=\"1.0\""+
  +    public static String xalanBugStylesheet = "<?xml 
version=\"1.0\"?><xsl:stylesheet version=\"1.0\""+
                                          " 
xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\";>"+
                                          "<xsl:template 
match=\"node()|@*\"><xsl:copy>"+
                                          "<xsl:apply-templates 
select=\"node()|@*\"/>"+
  @@ -233,7 +233,7 @@
               Transformer transformer;
               // transformer = TransformerFactory.newInstance().newTransformer();
               // FIXME - This is a workaround for bug #5779 of Xalan
  -            transformer = TransformerFactory.newInstance().newTransformer(new 
StreamSource(new java.io.StringReader(stylesheet)));
  +            transformer = TransformerFactory.newInstance().newTransformer(new 
StreamSource(new java.io.StringReader(xalanBugStylesheet)));
               // End workaround
               transformer.setOutputProperties(format);
               transformer.transform(new DOMSource(node), new StreamResult(writer));
  
  
  

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