Index: main/branches/64_bit_Greenstone/greenstone3/src/java/org/greenstone/gsdl3/action/FormatAction.java
===================================================================
--- main/branches/64_bit_Greenstone/greenstone3/src/java/org/greenstone/gsdl3/action/FormatAction.java	(revision 24131)
+++ main/branches/64_bit_Greenstone/greenstone3/src/java/org/greenstone/gsdl3/action/FormatAction.java	(revision 24132)
@@ -114,5 +114,5 @@
             //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");  /*************************/
+            Document style_doc = this.converter.getDOM(new File("/research/sjb48/greenstone3/web/interfaces/oran/transform/formatString.xsl"), "UTF-8");  /*************************/
 
             if(style_doc == null)
Index: main/branches/64_bit_Greenstone/greenstone3/src/java/org/greenstone/gsdl3/collection/Collection.java
===================================================================
--- main/branches/64_bit_Greenstone/greenstone3/src/java/org/greenstone/gsdl3/collection/Collection.java	(revision 24131)
+++ main/branches/64_bit_Greenstone/greenstone3/src/java/org/greenstone/gsdl3/collection/Collection.java	(revision 24132)
@@ -33,4 +33,5 @@
 import java.io.File;
 import java.util.HashMap;
+import java.util.*;
 
 import javax.xml.parsers.DocumentBuilder;
@@ -471,7 +472,11 @@
                 int index;
                 Element elem;
+                // Try importing entire tree to this.doc so we can add and remove children at ease
+                //Node current_node = this.doc.importNode(GSXML.getChildByTagName(config, "CollectionConfig"),true);
                 Node current_node = GSXML.getChildByTagName(config, "CollectionConfig");
                 NodeList current_node_list;
-    
+   
+                logger.error("Service is "+service);
+
                 if(service.equals("ClassifierBrowse"))
                 {
@@ -480,4 +485,5 @@
                     // default is <browse><format>
 
+                    logger.error("Looking for browse");
                     current_node = GSXML.getChildByTagName(current_node, "browse");
 
@@ -485,11 +491,27 @@
                     if(classifier != null)
                     {
+                        logger.error("Classifier is not null");
+                        logger.error("Classifier is "+classifier);
                         current_node_list = GSXML.getChildrenByTagName(current_node, "classifier");
                         index = Integer.parseInt(classifier.substring(2)) - 1;
+                        logger.error("classifier index is "+index);
                         // index should be given by X-1
                         current_node = current_node_list.item(index);
-                        current_node = GSXML.getChildByTagName(current_node, "format");
+                        // what if classifier does not have a format tag?
+                        if(GSXML.getChildByTagName(current_node, "format") == null)
+                        {
+                            logger.error("ERROR: classifier does not have a format child");
+                            // well then create a format tag
+                            Element format_tag = config.createElement("format");
+                            current_node = (Node) current_node.appendChild(format_tag);
+                            //current_node = (Node) format_tag;
+                        }
+                        
+                        else{
+                            current_node = GSXML.getChildByTagName(current_node, "format");
+                        }
                     }
                     else{
+                        logger.error("Classifier is null");
                         current_node = GSXML.getChildByTagName(current_node, "format");
                     }
@@ -498,4 +520,5 @@
                 {
                     // look in <format> with no attributes
+                    logger.error("I presume this is search");
             
                     current_node_list = GSXML.getChildrenByTagName(current_node, "search");
@@ -532,8 +555,8 @@
                 {
                     //if(transformed.getNodeType() == Node.DOCUMENT_NODE)
-                //transformed = ((Document)transformed).getDocumentElement();
-                    logger.error("Node type: "+current_node_list.item(k).getNodeType());
+                    //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));
+                        elem.appendChild(config.importNode(current_node_list.item(k),true));
                 }
 
@@ -546,4 +569,8 @@
                 // Now convert config document to string for writing to file
                 String new_config = this.converter.getString(config);
+
+                new_config = StringUtils.replace(new_config, "&lt;", "<");
+                new_config = StringUtils.replace(new_config, "&gt;", ">");
+                new_config = StringUtils.replace(new_config, "&quot;", "\"");
     
                 // Write to file (not original! for now)
