Index: /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/FormatAction.java
===================================================================
--- /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/FormatAction.java	(revision 23632)
+++ /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/FormatAction.java	(revision 23633)
@@ -97,10 +97,11 @@
 
     try {
-            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-            DocumentBuilder builder = factory.newDocumentBuilder();
+            //DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+            //DocumentBuilder builder = factory.newDocumentBuilder();
             //String input = "<html><head><title></title></head><body>" + format_string + "</body></html>";
-            String input = format_string;
-            InputSource is = new InputSource( new StringReader( input ) );
-            Document d = (Document) builder.parse( is );
+            //String input = format_string;
+            //InputSource is = new InputSource( new StringReader( input ) );
+            //Document d = (Document) builder.parse( is );
+            Document d = this.converter.getDOM(format_string); //(Document) builder.parse( is );
             //Node n1 = d.getFirstChild();            
             //Document d2 = (Document) this.doc.importNode(e, true);
@@ -111,5 +112,7 @@
             XMLTransformer transformer = new XMLTransformer();
             // HOW DO I DO THIS PROPERLY?
-            Document style_doc = this.converter.getDOM(new File("/home/sam/greenstone3/web/interfaces/oran/transform/formatString.xsl"), "UTF-8");
+            //String style = stylesheetFile(String gsdl3_home, String site_name, String collection, String interface_name, ArrayList base_interfaces, String filename);
+            //Document style_doc = this.converter.getDOM(new File(style), "UTF-8"); //"/home/sam/greenstone3/web/interfaces/oran/transform/formatString.xsl"), "UTF-8");  /*************************/
+            Document style_doc = this.converter.getDOM(new File("/home/sam/greenstone3/web/interfaces/oran/transform/formatString.xsl"), "UTF-8");  /*************************/
 
             if(style_doc == null)
@@ -117,7 +120,7 @@
 
             // not sure what to do here - some code from Transforming Receptionist
-            String transformed = transformer.transformToString(style_doc, d);
+            //String transformed = transformer.transformToString(style_doc, d);
             logger.error("About to transform");
-            //Node transformed = (Node) transformer.transform(style_doc, d);  // Failing org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted. ; SystemID: file:///home/sam/greenstone3/packages/tomcat/bin/dummy.xsl
+            Node transformed = (Node) transformer.transform(style_doc, d);  // Failing org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted. ; SystemID: file:///home/sam/greenstone3/packages/tomcat/bin/dummy.xsl
 
             logger.error("Transform successful?");
@@ -125,4 +128,8 @@
             if(transformed==null)  // not null
                 logger.error("TRANSFORMED IS NULL");
+
+            if(transformed.getNodeType() == Node.DOCUMENT_NODE)
+                transformed = ((Document)transformed).getDocumentElement(); 
+            logger.error("Node type: "+transformed.getNodeType());
 
             //logger.error("begin import"); 
@@ -134,6 +141,6 @@
  
             Element format = this.doc.createElement(GSXML.FORMAT_STRING_ELEM);
-            GSXML.setNodeText(format, transformed);
-            //format.appendChild(transformed);
+            //GSXML.setNodeText(format, transformed);
+            format.appendChild(this.doc.importNode(transformed,true));
             //format.setNodeValue(transformed);
             mr_request.appendChild(format); 
Index: /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/collection/Collection.java
===================================================================
--- /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/collection/Collection.java	(revision 23632)
+++ /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/collection/Collection.java	(revision 23633)
@@ -338,6 +338,6 @@
 
         Element format_element = (Element) GSXML.getChildByTagName(request, GSXML.FORMAT_STRING_ELEM);
-        String format_string = GSXML.getNodeText(format_element);
-        //Element format_statement = (Element) format_element.getFirstChild();
+        //String format_string = GSXML.getNodeText(format_element);
+        Element format_statement = (Element) format_element.getFirstChild();
 
         //logger.error("Format string: " + format_string);
@@ -394,5 +394,5 @@
 
                 // Write format statement
-                //String format_string = GSXML.xmlNodeToString(format_statement);
+                String format_string = this.converter.getString(format_statement); //GSXML.xmlNodeToString(format_statement);
                 writer = new BufferedWriter(new FileWriter(format_statement_filename));
                 writer.write(format_string);
@@ -416,13 +416,13 @@
 
                 // Convert format string to a document
-                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-                DocumentBuilder builder = factory.newDocumentBuilder();
+                //DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+                //DocumentBuilder builder = factory.newDocumentBuilder();
                 //String input = "<html><head><title></title></head><body>" + format_string + "</body></html>";
-                String input = format_string.substring(0,format_string.length()-1)+"</xml>";
-                logger.error(input);
-                InputSource is = new InputSource( new StringReader( input ) );
-                logger.error("About to parse format string");
-                Document format_statement = (Document) builder.parse( is );
-                logger.error("Done parsing format string");
+                //String input = format_string.substring(0,format_string.length()-1)+"</xml>";
+                //logger.error(input);
+                //InputSource is = new InputSource( new StringReader( input ) );
+                //logger.error("About to parse format string");
+                //Document format_statement = (Document) builder.parse( is );
+                //logger.error("Done parsing format string");
 
                 // open collectionConfig.xml and read in to w3 Document
@@ -488,11 +488,16 @@
 
                 // append new but we have a string!
-                GSXML.setNodeText(elem, format_string);
-
-                //current_node_list = format_statement.getChildNodes();
-                //for(k=0; k<current_node_list.getLength(); k++)
-                //{
-                //    current_node = elem.appendChild(current_node_list.item(k));
-                //}
+                //GSXML.setNodeText(elem, "THIS IS A TEST");
+                //GSXML.setNodeText(elem, format_string);
+
+                current_node_list = format_statement.getChildNodes();
+                for(k=0; k<current_node_list.getLength(); k++)
+                {
+                    //if(transformed.getNodeType() == Node.DOCUMENT_NODE)
+                //transformed = ((Document)transformed).getDocumentElement();
+                    logger.error("Node type: "+current_node_list.item(k).getNodeType());
+                    if(current_node_list.item(k).getNodeType() != Node.PROCESSING_INSTRUCTION_NODE)
+                        current_node = elem.appendChild(this.doc.importNode(current_node_list.item(k),true));
+                }
 
                 //String text = GSXML.getNodeText(elem);
@@ -503,5 +508,5 @@
 
                 // Now convert config document to string for writing to file
-                String new_config = GSXML.xmlNodeToString(config);
+                String new_config = this.converter.getString(config);
     
                 // Write to file (not original! for now)
Index: /main/trunk/greenstone3/web/interfaces/oran/transform/formatString.xsl
===================================================================
--- /main/trunk/greenstone3/web/interfaces/oran/transform/formatString.xsl	(revision 23632)
+++ /main/trunk/greenstone3/web/interfaces/oran/transform/formatString.xsl	(revision 23633)
@@ -256,7 +256,9 @@
         <h2> This should be the format string (unmodified and html version) </h2> -->
         <!-- <xsl:value-of select="/page/pageResponse" disable-output-escaping="yes"/> -->
+        <format xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat">
         <xsl:call-template name="xml">
             <xsl:with-param name="fmt" select="."/>
         </xsl:call-template><xsl:text> </xsl:text>
+        </format>
         <!-- <xsl:apply-templates select="/page/pageResponse" mode="xml"/> -->
       <!-- </body>
