Index: /trunk/gsdl3/src/java/org/greenstone/gsdl3/collection/Collection.java
===================================================================
--- /trunk/gsdl3/src/java/org/greenstone/gsdl3/collection/Collection.java	(revision 13993)
+++ /trunk/gsdl3/src/java/org/greenstone/gsdl3/collection/Collection.java	(revision 13994)
@@ -48,4 +48,6 @@
     static Logger logger = Logger.getLogger(org.greenstone.gsdl3.collection.Collection.class.getName());
 
+    /** is this collection being tidied */
+    protected boolean useBook = false;
     /** is this collection public or private */
     protected boolean is_public = true;
@@ -96,4 +98,8 @@
     }
 
+    public boolean useBook() {
+    	return useBook;
+    }
+    
     public boolean isPublic() {
 	return is_public;
@@ -161,4 +167,27 @@
 	}
 
+	//check whether the html are tidy or not
+	Element import_list = (Element)GSXML.getChildByTagName(coll_config_xml, GSXML.IMPORT_ELEM);
+	if (import_list != null) {
+		Element plugin_list = (Element)GSXML.getChildByTagName(import_list, GSXML.PLUGIN_ELEM+GSXML.LIST_MODIFIER);
+		addPlugins(plugin_list);
+		if (plugin_list != null){
+			Element plugin_elem = (Element)GSXML.getNamedElement(plugin_list, GSXML.PLUGIN_ELEM, GSXML.NAME_ATT, "HTMLPlug");
+			if (plugin_elem != null) {
+				//get the option
+				Element option_elem = (Element)GSXML.getNamedElement(plugin_elem, GSXML.PARAM_OPTION_ELEM, GSXML.NAME_ATT, "-tidy_html");
+				if (option_elem != null) {
+					useBook = true;
+				}
+			}
+		}	
+	}
+	meta_list = this.doc.createElement(GSXML.METADATA_ELEM + GSXML.LIST_MODIFIER);
+	if (useBook == true)
+		GSXML.addMetadata(this.doc, meta_list, "tidyoption", "tidy");
+	else
+		GSXML.addMetadata(this.doc, meta_list, "tidyoption", "untidy");
+	addMetadata(meta_list);
+	
 	// check whether we are public or not
 	if (meta_list != null) {
@@ -210,5 +239,5 @@
 	} 
 
-	if (subset.equals(GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER) || subset.equals(GSXML.DISPLAY_TEXT_ELEM+GSXML.LIST_MODIFIER)) {
+	if (subset.equals(GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER) || subset.equals(GSXML.DISPLAY_TEXT_ELEM+GSXML.LIST_MODIFIER) || subset.equals(GSXML.PLUGIN_ELEM+GSXML.LIST_MODIFIER)) {
 	    return findAndLoadInfo(coll_config_elem, build_config_elem);
 	    
Index: /trunk/gsdl3/src/java/org/greenstone/gsdl3/collection/ServiceCluster.java
===================================================================
--- /trunk/gsdl3/src/java/org/greenstone/gsdl3/collection/ServiceCluster.java	(revision 13993)
+++ /trunk/gsdl3/src/java/org/greenstone/gsdl3/collection/ServiceCluster.java	(revision 13994)
@@ -88,4 +88,7 @@
     protected Element description = null;
 
+    /** list of plugin */
+    protected Element plugin_item_list = null;
+    
     public void setSiteHome(String home) {
 	this.site_home = home;
@@ -120,4 +123,5 @@
 	this.display_item_list = this.doc.createElement(GSXML.DISPLAY_TEXT_ELEM+GSXML.LIST_MODIFIER);
 	this.metadata_list = this.doc.createElement(GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER);
+	this.plugin_item_list = this.doc.createElement(GSXML.PLUGIN_ELEM+GSXML.LIST_MODIFIER);
     }
 
@@ -185,5 +189,17 @@
 	}
 	
-
+	//get the plugin info
+	Element import_list = (Element) GSXML.getChildByTagName(service_cluster_info, GSXML.IMPORT_ELEM);
+	if (import_list != null)
+	{
+		Element plugin_list = (Element) GSXML.getChildByTagName(service_cluster_info, GSXML.PLUGIN_ELEM+GSXML.LIST_MODIFIER);
+		if (plugin_list !=null) {
+	   	 	if (!addPlugins(plugin_list)) {
+		
+				logger.error("couldn't configure the plugins");
+	    		}
+		}
+	}	
+	
 	// do the service racks
 	Element service_rack_list = (Element)GSXML.getChildByTagName(service_cluster_info, GSXML.SERVICE_CLASS_ELEM+GSXML.LIST_MODIFIER);
@@ -238,7 +254,18 @@
 		
 		this_item.appendChild(this.doc.importNode(d, true));
-		    
-		
-	    }
+	    }
+	}
+	
+	return true;
+    }
+    
+    protected boolean addPlugins(Element plugin_list) {
+    	if (plugin_list == null) return false;
+	NodeList pluginNodes = plugin_list.getElementsByTagName(GSXML.PLUGIN_ELEM);
+	if (pluginNodes.getLength() > 0) {
+		for (int k = 0; k < pluginNodes.getLength(); k++)
+		{
+			this.plugin_item_list.appendChild(this.doc.importNode(pluginNodes.item(k), true));
+		}
 	}
 	
@@ -448,4 +475,5 @@
 		description.appendChild(this.service_list);
 		description.appendChild(this.metadata_list);
+		description.appendChild(this.plugin_item_list);
 		return response;
 	    }
@@ -465,5 +493,6 @@
 		    } else if (info.equals(GSXML.DISPLAY_TEXT_ELEM+GSXML.LIST_MODIFIER)) {
 			addAllDisplayInfo(description, lang);
-			
+		    } else if (info.equals(GSXML.PLUGIN_ELEM+GSXML.LIST_MODIFIER)) {
+		    	description.appendChild(plugin_item_list);
 		    }
 		}
@@ -578,4 +607,14 @@
 	    Element metadata_list = (Element)GSXML.getChildByTagName(cluster_config_elem, GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER);
 	    return addMetadata(metadata_list);
+	} else if (subset.equals(GSXML.PLUGIN_ELEM+GSXML.LIST_MODIFIER)) {
+	    this.plugin_item_list = this.doc.createElement(GSXML.PLUGIN_ELEM+GSXML.LIST_MODIFIER);
+	    Element import_list = (Element)GSXML.getChildByTagName(cluster_config_elem,GSXML.IMPORT_ELEM);
+	    if (import_list != null)
+	    {
+	    	Element plugin_item_list = (Element)GSXML.getChildByTagName(cluster_config_elem,GSXML.PLUGIN_ELEM+GSXML.LIST_MODIFIER);
+	    	return addPlugins(plugin_item_list);
+            }
+	    else
+	    	return false;
 	} else {
 	    logger.error("cannot process system request, configure "+subset);
Index: /trunk/gsdl3/src/java/org/greenstone/gsdl3/collection/XMLCollection.java
===================================================================
--- /trunk/gsdl3/src/java/org/greenstone/gsdl3/collection/XMLCollection.java	(revision 13993)
+++ /trunk/gsdl3/src/java/org/greenstone/gsdl3/collection/XMLCollection.java	(revision 13994)
@@ -46,4 +46,12 @@
 	}
 
+	//plugin stuff
+	Element import_list = (Element)GSXML.getChildByTagName(coll_config_xml, GSXML.IMPORT_ELEM);
+	if (import_list != null)
+	{
+		Element plugin_list = (Element)GSXML.getChildByTagName(import_list, GSXML.PLUGIN_ELEM+GSXML.LIST_MODIFIER);
+		addPlugins(plugin_list);
+	}
+	
 	Element config_doc_list = (Element)GSXML.getChildByTagName(coll_config_xml, GSXML.DOCUMENT_ELEM+GSXML.LIST_MODIFIER);
 	if (config_doc_list != null) {
@@ -79,4 +87,5 @@
 		description.appendChild(this.service_list);
 		description.appendChild(this.metadata_list);
+		description.appendChild(this.plugin_item_list);
 		description.appendChild(this.document_list);
 		return response;
@@ -100,4 +109,6 @@
 		    } else if (info.equals(GSXML.DOCUMENT_ELEM+GSXML.LIST_MODIFIER)) {
 			description.appendChild(this.document_list);
+		    } else if (info.equals(GSXML.PLUGIN_ELEM+GSXML.LIST_MODIFIER)) {
+		    	description.appendChild(this.plugin_item_list);
 		    }
 		    
Index: /trunk/gsdl3/src/java/org/greenstone/gsdl3/util/GSXML.java
===================================================================
--- /trunk/gsdl3/src/java/org/greenstone/gsdl3/util/GSXML.java	(revision 13993)
+++ /trunk/gsdl3/src/java/org/greenstone/gsdl3/util/GSXML.java	(revision 13994)
@@ -189,5 +189,10 @@
     // some system wide param names
     public static final String SUBSET_PARAM = "subset";
-
+    
+    //for plugin
+    public static final String PLUGIN_ELEM = "plugin";
+    public static final String IMPORT_ELEM = "import";
+    
+    
     /** takes a list of elements, and returns an array of strings 
      * of the values of attribute att_name */
