Index: eenstone3/trunk/src/java/org/greenstone/gsdl3/core/Skin.java
===================================================================
--- /greenstone3/trunk/src/java/org/greenstone/gsdl3/core/Skin.java	(revision 18453)
+++ 	(revision )
@@ -1,463 +1,0 @@
-package org.greenstone.gsdl3.core;
-
-import java.io.*;
-
-import org.apache.xerces.parsers.DOMParser;
-import org.greenstone.gsdl3.util.*;
-import org.w3c.dom.*;
-import org.xml.sax.InputSource;
-
-import java.util.*;
-import javax.xml.transform.*;
-import javax.xml.transform.dom.*;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.*;
-
-
-
-
-public class Skin {
-	
-    public File rootDirectory ;
-    public Document config ;
-    private Receptionist receptionist ;
-	
-    protected DOMParser parser = null;
-    TransformerFactory transformerFactory=null;
-	
-    // delete this later??
-    //protected XMLConverter converter = null;
-	
-    //private HashMap<String, String> xsltPagesByAction ;  // *****
-    private HashMap xsltPagesByAction ; 
-	
-    public Skin(Page page, Receptionist receptionist) throws Exception{
-		
-	this.receptionist = receptionist ;
-	this.transformerFactory = org.apache.xalan.processor.TransformerFactoryImpl.newInstance();
-	//this.converter = new XMLConverter();
-	transformerFactory.setURIResolver(new MyUriResolver()) ;
-		
-	this.parser = new DOMParser();
-	this.parser.setFeature("http://xml.org/sax/features/validation", false);
-	// don't try and load external DTD - no need if we are not validating, and may cause connection errors if a proxy is not set up.
-	this.parser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
-	// a performance test showed that having this on lead to increased 
-	// memory use for small-medium docs, and not much gain for large 
-	// docs.
-	// http://www.sosnoski.com/opensrc/xmlbench/conclusions.html
-	this.parser.setFeature("http://apache.org/xml/features/dom/defer-node-expansion", false);
-		
-		
-		
-	String siteHome = GSFile.siteHome(GlobalProperties.getGSDL3Home(), page.getSite()) ;
-	Document collectUi = page.getCollectUi() ;
-		
-	if (collectUi != null) {
-	    //System.out.println("looking for skin defined at collect level") ;
-			
-	    String collectHome = GSFile.collectionBaseDir(siteHome, page.getCollection()) ;
-	    Element xmlSkin = (Element) GSXML.getChildByTagName(collectUi.getFirstChild(), "skin") ;
-	    if (xmlSkin != null) {
-		//System.out.println("skin defined at collect level") ;
-				
-		String inherit_att = xmlSkin.getAttribute("inherit") ;
-		Boolean inherit_ref = Boolean.valueOf(inherit_att);
-		boolean inherit = inherit_ref.booleanValue();
-				
-		if (inherit != true) {
-		    
-		    String local_att = xmlSkin.getAttribute("local") ;
-		    Boolean local_ref = Boolean.valueOf(local_att);
-		    boolean local = local_ref.booleanValue();
-
-		    if (local == true) {
-			rootDirectory = new File(collectHome + File.separatorChar + "ui") ;
-		    } else {
-			String name = xmlSkin.getAttribute("name") ;
-			rootDirectory = new File(GlobalProperties.getGSDL3Home() + File.separatorChar + "ui" + File.separatorChar + "skins" + File.separatorChar + File.separatorChar + name) ;
-		    }
-		}				
-	    }
-	}
-		
-	Document siteUi = page.getSiteUi() ;
-		
-	if (rootDirectory == null && siteUi != null) {
-	    //System.out.println("lookding for skin defined at site level") ;
-			
-	    Element xmlSkin = (Element) GSXML.getChildByTagName(siteUi.getFirstChild(), "skin") ;
-	    if (xmlSkin != null) {
-		//System.out.println("skin defined at site level") ;
-		String local_att = xmlSkin.getAttribute("local") ;
-		Boolean local_ref = Boolean.valueOf(local_att);
-		boolean local = local_ref.booleanValue();
-
-		if (local == true) {
-		    rootDirectory = new File(siteHome + File.separatorChar + "ui") ;
-		} else {
-		    String name = xmlSkin.getAttribute("name") ;
-		    rootDirectory = new File(GlobalProperties.getGSDL3Home() + File.separatorChar + "ui" + File.separatorChar + "skins" + File.separatorChar + name) ;
-		}
-	    }				
-	}
-		
-	if(rootDirectory == null) {
-	    rootDirectory = new File(GlobalProperties.getGSDL3Home() + File.separatorChar + "ui" + File.separatorChar + "skins" + File.separatorChar + "default") ;
-	}
-
-		
-	File configFile = new File(rootDirectory.getAbsolutePath() + File.separatorChar + "skin.xml") ;
-	config = receptionist.converter.getDOM(configFile, "utf-8");
-		
-		
-	// store which xslt pages are responsible for which actions
-		
-	xsltPagesByAction = new HashMap() ;
-		
-	NodeList actions = config.getElementsByTagName("action") ;
-		
-	for (int ai=0 , an=actions.getLength() ; ai<an ; ai++){
-	    Element action = (Element) actions.item(ai) ;
-	    String a = action.getAttribute("name") ;
-			
-	    String xsl = action.getAttribute("xslt") ;
-	    if (!xsl.equals("")) {
-		xsltPagesByAction.put(a, xsl) ;
-	    }
-			
-	    NodeList subactions = action.getElementsByTagName("subaction") ;
-			
-	    for (int si=0 , sn=subactions.getLength() ; si<sn ; si++){
-		Element subaction = (Element) subactions.item(si) ;
-				
-		String sa = subaction.getAttribute("name") ;
-		xsl = subaction.getAttribute("xslt") ;
-		xsltPagesByAction.put(a + "_" + sa, xsl) ;
-	    }
-	}
-    }
-	
-    private Document getXSLTDoc(String action, String subaction) throws Exception {
-	//System.out.println("getting xslt for " + action + ", " + subaction) ;
-		
-	String full_action = action + "_" + subaction;
-	String name = (String)xsltPagesByAction.get(full_action) ;
-		
-	if (name == null) {
-	    name = (String)xsltPagesByAction.get(action);
-	}
-		
-	File xslt_file = new File(rootDirectory.getAbsolutePath() + File.separatorChar + "xsl" + File.separatorChar + name) ;
-	//System.out.println("Skinning page using: " + xslt_file) ;
-		
-	//if (!xslt_file.canRead()) 
-	//	xslt_file = new File(GlobalProperties.getGSDL3Home() + File.separatorChar + "ui" + File.separatorChar + "xslt" + File.separatorChar + "error.xsl") ;
-		
-	FileReader reader = new FileReader(xslt_file);
-	InputSource xml_source = new InputSource(reader);
-	this.parser.parse(xml_source);
-	Document doc = this.parser.getDocument();
-		
-	return doc ;
-    }
-	
-    private Document getPreprocessDoc() throws Exception {
-	                                                      
-	File xslt_file = new File(GlobalProperties.getGSDL3Home() + File.separatorChar + "ui" + File.separatorChar + "xslt" + File.separatorChar + "preProcess.xsl") ;
-		
-	FileReader reader = new FileReader(xslt_file);
-	InputSource xml_source = new InputSource(reader);
-	this.parser.parse(xml_source);
-	Document doc = this.parser.getDocument();
-	    
-	return doc ;		
-    }
-	
-    private Document getLibraryDoc() throws Exception {
-        
-	File xslt_file = new File(GlobalProperties.getGSDL3Home() + File.separatorChar + "ui" + File.separatorChar + "xslt" + File.separatorChar + "library.xsl") ;
-		
-	FileReader reader = new FileReader(xslt_file);
-	InputSource xml_source = new InputSource(reader);
-	this.parser.parse(xml_source);
-	Document doc = this.parser.getDocument();
-	    
-	return doc ;		
-    }
-	
-	
-    public Node transformPage(Page page) throws Exception {
-		
-	    
-	Element p = page.getPage() ;
-	Element pr = page.getPageResponse() ;
-	Element transformedPage = null ;
-		
-	Element blah = receptionist.doc.createElement("Skin") ;
-	blah.setAttribute("skinLocation", rootDirectory.getAbsolutePath()) ;
-	pr.appendChild(blah) ;
-
-	Document sourceXml ;
-	try {
-	    sourceXml = receptionist.converter.newDOM();
-	    sourceXml.appendChild(sourceXml.importNode(p, true));
-	} catch (Exception e) {
-	    System.out.println("error loading source data") ;
-	    e.printStackTrace() ;
-	    return constructErrorPage(e) ;
-	}
-
-	Document skinXsl ;
-	try {
-	    skinXsl = getXSLTDoc(page.getAction(), page.getSubaction()) ;
-	} catch (Exception e) {
-	    System.out.println("error loading skin xslt") ;
-	    e.printStackTrace() ;
-	    return constructErrorPage(e) ;
-	}
-		
-	Document preprocessingXsl  ;
-	try {
-	    preprocessingXsl = getPreprocessDoc() ;
-	} catch (Exception e) {
-	    System.out.println("error loading preprocessing xslt") ;
-	    e.printStackTrace() ;
-	    return constructErrorPage(e) ;
-	}
-		
-	Document libraryXsl ;
-	try {
-	    libraryXsl = getLibraryDoc() ;
-	} catch (Exception e) {
-	    System.out.println("error loading preprocessing xslt") ;
-	    e.printStackTrace() ;
-	    return constructErrorPage(e) ;
-	}
-		
-	// combine skin file and library variables/templates into one document. 
-	//   we dont just use xsl:import because the preprocessing stage needs 
-	//   to know what's available in the library.
-		
-	Document skinAndLibraryXsl ;
-	Document processedXsl = receptionist.converter.newDOM();
-	try {
-			
-	    skinAndLibraryXsl = receptionist.converter.newDOM();
-	    Element root = skinAndLibraryXsl.createElement("skinAndLibraryXsl") ;
-	    skinAndLibraryXsl.appendChild(root) ;
-
-	    Element s = skinAndLibraryXsl.createElement("skinXsl") ;
-	    s.appendChild(skinAndLibraryXsl.importNode(skinXsl.getDocumentElement(), true)) ;
-	    root.appendChild(s) ;
-
-	    Element l = skinAndLibraryXsl.createElement("libraryXsl") ;
-	    l.appendChild(skinAndLibraryXsl.importNode(libraryXsl.getDocumentElement(), true)) ;
-	    root.appendChild(l) ;
-			
-			
-	    // System.out.println("Pre - processing") ;
-	    //pre-process the skin style sheet
-	    Transformer preProcessor = transformerFactory.newTransformer(new DOMSource(preprocessingXsl));
-	    DOMResult result = new DOMResult();
-	    result.setNode(processedXsl);
-	    preProcessor.transform(new DOMSource(skinAndLibraryXsl), result);
-	} catch (TransformerException e) {
-	    e.printStackTrace() ;
-	    return constructErrorPage(e) ;
-	}  catch (Exception e) {
-	    System.out.println("error preprocessing the skin xslt") ;
-	    e.printStackTrace() ;
-	    return constructErrorPage(e) ;
-	}
-		
-	//return sourceXml.getDocumentElement() ;
-		
-	// Document finalPage = receptionist.converter.newDOM(); // ****
-	Document finalPageParsed = null;
-
-	//transform source doc
-	try {
-		
-	    /*
-	    //Tranform XSL DOM to String	
-	    TransformerFactory tf = TransformerFactory.newInstance();
-	    Transformer trans = tf.newTransformer();
-	    StringWriter sw = new StringWriter();
-	    trans.transform(new DOMSource(processedXsl), new StreamResult(sw));
-	    // String theXSLAnswer = sw.toString(); // ****
-			
-			
-	    //Tranform XML DOM to String	
-	    TransformerFactory tf2 = TransformerFactory.newInstance();
-	    Transformer trans2 = tf2.newTransformer();
-	    StringWriter sw2 = new StringWriter();
-	    trans2.transform(new DOMSource(sourceXml), new StreamResult(sw2));
-	    //String theXMLAnswer = sw2.toString();
-	    */
-
-	    Transformer transformer = transformerFactory.newTransformer(new DOMSource(processedXsl));
-	    // transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd");
-	    //DOMResult result = new DOMResult();
-	    //result.setNode(finalPage);
-			
-	    //transformer.transform(new DOMSource(sourceXml), result2);
-	    StringWriter result2 = new StringWriter();
-	    transformer.transform(new DOMSource(sourceXml), new StreamResult(result2));
-
-	    XMLConverter converter = new XMLConverter();
-
-	    finalPageParsed = converter.getDOM(result2.toString());		      			
-			
-	} catch (TransformerException e) {
-	    e.printStackTrace() ;
-	    return constructErrorPage(e) ;
-	} catch (Exception e) {
-		
-	    System.out.println("error transforming page") ;
-	    e.printStackTrace() ;
-			
-	    //return processedXsl.getDocumentElement() ;
-	    return constructErrorPage(e) ;
-	}
-			
-	return finalPageParsed;
-    }
-	
-    private Element constructErrorPage(TransformerException exception) {
-	Document doc = receptionist.doc;
-	Element page = doc.createElement("page") ;
-		
-	Element header = doc.createElement("h1") ;
-
-
-	// header.setTextContent("Error");  // Java 1.5
-	header.appendChild(doc.createTextNode("Error")); // Java 1.4
-
-	page.appendChild(header) ;
-		
-	Element prompt = doc.createElement("p") ;
-	// prompt.setTextContent("The following exception occured: ") ;
-	prompt.appendChild(doc.createTextNode("The following exception occured: ")); 
-	page.appendChild((prompt)) ;
-		
-	Element errorXml = doc.createElement("code") ;
-	//errorXml.setTextContent(exception.getMessageAndLocation()) ;
-	errorXml.appendChild(doc.createTextNode(exception.getMessageAndLocation())) ;
-	page.appendChild(errorXml) ;
-		
-	return page ;
-		
-    }
-	
-    private Element constructErrorPage(Exception exception) {
-	Document doc = receptionist.doc;
-	Element page = doc.createElement("page") ;
-		
-	Element header = doc.createElement("h1") ;
-	//header.setTextContent("Error"); // Java 1.5
-	header.appendChild(doc.createTextNode("Error")); // Java 1.4
-
-	page.appendChild(header) ;
-		
-	Element prompt = doc.createElement("p") ;
-	// prompt.setTextContent("The following exception occured: ") ;
-	prompt.appendChild(doc.createTextNode("The following exception occured: ")); 
-
-	page.appendChild((prompt)) ;
-		
-	Element errorXml = doc.createElement("code") ;
-	//errorXml.setTextContent(exception.toString()) ;
-	errorXml.appendChild(doc.createTextNode(exception.toString())) ;
-	page.appendChild(errorXml) ;
-		
-	return page ;
-    }
-	
-
-    private Element constructErrorPage(Element source, Document style, Exception exception) 
-    {
-	Document doc = receptionist.doc;
-	Element page = doc.createElement("page") ;
-		
-	Element header = doc.createElement("h1") ;
-	//header.setTextContent("Error") ; // Java 1.5
-	header.appendChild(doc.createTextNode("Error")); // Java 1.4
-
-	page.appendChild(header) ;
-		
-	Element prompt = doc.createElement("p") ;
-	//prompt.setTextContent("The following exception occured: ") ;
-	prompt.appendChild(doc.createTextNode("The following exception occured: ")); 
-        page.appendChild((prompt)) ;
-		
-	Element errorXml = doc.createElement("code") ;
-	//errorXml.setTextContent(exception.getMessage()) ;
-	errorXml.appendChild(doc.createTextNode(exception.getMessage())) ;
-	page.appendChild(errorXml) ;
-		
-	/*
-	  Element stackTrace = doc.createElement("ul") ;
-		
-	  StackTraceElement[] st = exception.getStackTrace() ;
-	  for (int i=0 ; i< st.length ; i++) {
-	  Element ste = doc.createElement("li") ;
-	  ste.setTextContent(st[i].toString()) ;
-	  stackTrace.appendChild(ste) ;
-	  }
-	  errorMessage.appendChild(stackTrace) ;
-	*/
-		
-        Element sourceHeader = doc.createElement("h2") ;
-	//sourceHeader.setTextContent("Source page:") ;
-	sourceHeader.appendChild(doc.createTextNode("Source page:")) ;
-	page.appendChild(sourceHeader) ;
-		
-        Element sourceXml = doc.createElement("pre") ;
-	String source_pp = receptionist.converter.getPrettyString(source);
-	//sourceXml.setTextContent(source_pp) ;
-	sourceXml.appendChild(doc.createTextNode(source_pp)) ;
-	page.appendChild(sourceXml) ;
-		
-        Element styleHeader = doc.createElement("h2") ;
-	//styleHeader.setTextContent("Style page:") ;
-	styleHeader.appendChild(doc.createTextNode("Style page:")) ;
-        page.appendChild(styleHeader) ;
-		
-        Element styleXml = doc.createElement("pre") ;
-	String style_pp = receptionist.converter.getPrettyString(style);
-
-	//styleXml.setTextContent(style_pp);
-	styleXml.appendChild(doc.createTextNode(style_pp));
-	page.appendChild(styleXml) ;
-		
-		
-	return (Element)page ;
-    }
-	
-    private class MyUriResolver implements URIResolver {
-		
-	public Source resolve(String href, String base) {
-			
-	    System.out.println("resolving href='" + href + "', base='" + base + "'") ;
-						
-	    // check in the skin directory first
-			
-	    File file = new File(rootDirectory.getAbsolutePath() + File.separatorChar + "xslt" + File.separatorChar + href) ;
-			
-	    // then check in the xslt library directory
-	    if (!file.canRead()) 
-		file = new File(GlobalProperties.getGSDL3Home() + File.separatorChar + "ui" + File.separatorChar + "xslt" + File.separatorChar + href) ;
-			
-	    if (file.canRead()) {
-		Source source = new StreamSource(file) ;
-		return source ;
-	    } else
-		return null ;
-	}
-		
-    }
-	
-
-}	
-
Index: eenstone3/trunk/src/java/org/greenstone/gsdl3/core/SkinnedReceptionist.java
===================================================================
--- /greenstone3/trunk/src/java/org/greenstone/gsdl3/core/SkinnedReceptionist.java	(revision 18453)
+++ 	(revision )
@@ -1,416 +1,0 @@
-package org.greenstone.gsdl3.core;
-
-import java.util.*;
-import java.io.*;
-
-import org.w3c.dom.NodeList; 
-import org.w3c.dom.Document; 
-import org.w3c.dom.Element; 
-import org.w3c.dom.Node; 
-
-import org.greenstone.gsdl3.util.*;
-
-import javax.xml.xpath.*;
-
-public class SkinnedReceptionist extends DefaultReceptionist {
-	
-    /** a transformer class to transform xml using xslt */
-    protected XMLTransformer transformer=null;	
-	
-    public SkinnedReceptionist() {
-	super();
-	System.out.println("Skinned Receptionist created");
-	//this.xslt_map = new HashMap();
-	this.transformer = new XMLTransformer();
-    }
-	
-    protected Node postProcessPage(Element p) {
-	try {
-	    //Avoid the duplicate attribute in the namespaces declaration of the generated html file
-	    //String NAMESPACE_URI = "http://www.greenstone.org/greenstone3/schema/gsf";
-	    //String NAMESPACE_PREFIX = "gsf";
-	    //p.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:" + NAMESPACE_PREFIX, NAMESPACE_URI);
-			
-			
-	    Page page = new Page(p, this);
-	    Skin skin = new Skin(page, this);
-			
-	    addExtraInfo(p);
-	    addCssFiles(page, skin);
-	    addJsFiles(page, skin);
-	    addUiElements(page);
-	    addMetadataElements(page);
-			
-	    String output = page.getPageRequest().getAttribute(GSXML.OUTPUT_ATT);
-			
-	    // might need to add some data to the page
-	    //addExtraInfo(page);
-			
-			
-	    System.out.println("action = " + page.getAction());
-	    //	if we are displaying a document, specify an attribute for weither a cover image exists.
-	    if (page.getAction().equals("d")) {
-				
-		System.out.println("doing the document thing");
-				
-		Element document = (Element)p.getElementsByTagName("document").item(0);
-		Element metadataList = (Element)GSXML.getChildByTagName(document, "metadataList");
-		String archiveDir = "";
-		NodeList metadata = metadataList.getChildNodes();
-		for (int i=0; i<metadata.getLength(); i++) {
-		    Element m = (Element) metadata.item(i);
-		    if (m.getAttribute("name").equals("archivedir"))
-			archiveDir = GSXML.getNodeText(m);
-		}
-				
-		String coverImage_path = page.getCollectionHome() 
-		    + File.separatorChar + "index"  
-		    + File.separatorChar + "assoc"  
-		    + File.separatorChar + archiveDir  
-		    + File.separatorChar + "cover.jpg";		
-				
-		document.setAttribute("coverImage", coverImage_path);
-				
-		File coverImage = new File(coverImage_path);
-		document.setAttribute("hasCoverImage", String.valueOf(coverImage.canRead()));
-	    }
-			
-			
-	    Node np = null;
-	    try {
-
-		if (skin != null && !output.equals("xml")) {
-		    System.err.println("Away to to skin transformPage");
-		    np = skin.transformPage(page);
-		    System.err.println("done");
-
-					
-		} 
-		else {
-		    np = p;
-		}
-	    } catch (Exception e) {
-		e.printStackTrace();
-	    }
-			
-			
-			
-	    return np;
-	} catch (Exception e) {
-	    e.printStackTrace();
-	    return doc.createElement("page");
-	}
-    }
-	
-    /** overwrite this to add any extra info that might be needed in the page before transformation */
-    protected void addExtraInfo(Element page) {
-
-	//logger.debug("the  page before adding extra info is");
-	//logger.debug(this.converter.getPrettyString(page));
-		
-	super.addExtraInfo(page);
-		
-	// this gets the collection info
-	Element page_response = (Element)GSXML.getChildByTagName(page, GSXML.PAGE_RESPONSE_ELEM);
-	Element page_request = (Element)GSXML.getChildByTagName(page, GSXML.PAGE_REQUEST_ELEM);
-	Element collection_info = (Element)GSXML.getChildByTagName(page_response, GSXML.COLLECTION_ELEM);
-	if (collection_info== null) {
-	    return;
-	}
-		
-	String collection = collection_info.getAttribute("name"); // should we take this from the request instead??
-	// look through services and see if classifier one is present - need to
-	// get the list of classifiers
-	Element service_list = (Element)GSXML.getChildByTagName(collection_info, GSXML.SERVICE_ELEM+GSXML.LIST_MODIFIER);
-	if (service_list == null) {
-	    // something weird has gone wrong
-	    return;
-	}
-		
-	Element info_message = this.doc.createElement(GSXML.MESSAGE_ELEM);
-	String lang = page.getAttribute(GSXML.LANG_ATT);
-		
-	boolean do_classifier = false;
-	boolean do_query = false;
-	Element classifier_service = GSXML.getNamedElement(service_list, GSXML.SERVICE_ELEM, GSXML.NAME_ATT, "ClassifierBrowse");
-	Element query_service = GSXML.getNamedElement(service_list, GSXML.SERVICE_ELEM, GSXML.NAME_ATT, "TextQuery");
-	if (classifier_service != null) {
-	    do_classifier = true;
-	    // find the list of classifiers
-			
-	    String to = GSPath.appendLink(collection, "ClassifierBrowse");
-	    Element info_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, lang, ""); 
-	    info_message.appendChild(info_request);
-	}
-		
-	String action = page_request.getAttribute(GSXML.ACTION_ATT);
-	String subaction = page_request.getAttribute(GSXML.SUBACTION_ATT);
-		
-	if (query_service != null && action.equals("p") && subaction.equals("about")) {
-	    do_query = true;
-	    // get the full description
-	    String to = GSPath.appendLink(collection, "TextQuery");
-	    Element query_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, lang, "");
-	    info_message.appendChild(query_request);
-			
-	}
-		
-	Element info_resp_message = (Element) this.mr.process(info_message);
-	Element info_response = (Element) GSXML.getChildByTagName(info_resp_message, GSXML.RESPONSE_ELEM); 
-	//	String path = GSPath.appendLink(GSXML.RESPONSE_ELEM, GSXML.SERVICE_ELEM);
-	if (do_classifier) {
-	    Element classifier_service_info = (Element)GSXML.getNamedElement(info_response, GSXML.SERVICE_ELEM, GSXML.NAME_ATT, "CLassifierBrowse");
-	    if (classifier_service_info != null) {
-		service_list.replaceChild(this.doc.importNode(classifier_service_info, true), classifier_service);
-	    }
-	}
-	if (do_query) {
-	    Element query_service_info = (Element)GSXML.getNamedElement(info_response, GSXML.SERVICE_ELEM, GSXML.NAME_ATT, "TextQuery");
-	    if (query_service_info != null) {
-		service_list.replaceChild(this.doc.importNode(query_service_info, true), query_service);
-	    }
-	}
-	//logger.debug("the final page before transforming is");
-	//logger.debug(this.converter.getPrettyString(page));
-	return;
-    }
-	
-    protected void addCssFiles(Page page, Skin skin) {
-		
-	Element cssFileList = doc.createElement("cssFileList");
-		
-	// get skin level files
-	if (skin != null) {
-	    File dir = new File(skin.rootDirectory.getPath() + File.separatorChar + "css");
-	    if (dir.isDirectory()) {
-		File[] files = dir.listFiles();
-				
-		for (int fi=0, fn=files.length; fi<fn; fi++) {
-		    if (files[fi].getName().endsWith(".css")) {
-			Element cssFile = doc.createElement("cssFile");
-			String path = files[fi].getPath();
-			path = "." + path.substring(GlobalProperties.getGSDL3Home().length());
-			//changes to a correct path in case GS3 runs on Windows
-			path = path.replace( '\\', '/' );	
-			cssFile.setAttribute("path", path);
-			cssFileList.appendChild(cssFile);
-		    }
-		}
-	    }			
-	}	
-		
-	// get site level files
-	String site_home = page.getSiteHome();
-	File dir = new File(site_home + File.separatorChar + "ui" + File.separatorChar + "css");
-	if (dir.isDirectory()) {
-	    File[] files = dir.listFiles();
-	    for (int fi=0, fn=files.length; fi<fn; fi++) {
-		if (files[fi].getName().endsWith(".css")) {
-		    Element cssFile = doc.createElement("cssFile");
-		    String path = files[fi].getPath();
-		    path = "." + path.substring(GlobalProperties.getGSDL3Home().length());
-		    //changes to a correct path in case GS3 runs on Windows
-		    path = path.replace( '\\', '/' );					
-		    cssFile.setAttribute("path", path);
-		    cssFileList.appendChild(cssFile);
-		}
-	    }
-	}
-		
-	// get collect level files
-	String collect_home = page.getCollectionHome();
-	if (collect_home != "") {
-	    dir = new File(collect_home + File.separatorChar + "ui" + File.separatorChar + "css");
-	    if (dir.isDirectory()) {
-		File[] files = dir.listFiles();
-		for (int fi=0, fn=files.length; fi<fn; fi++) {
-		    if (files[fi].getName().endsWith(".css")) {
-			Element cssFile = doc.createElement("cssFile");
-			String path = files[fi].getPath();
-			path = "." + path.substring(GlobalProperties.getGSDL3Home().length());
-			//changes to a correct path in case GS3 runs on Windows
-			path = path.replace( '\\', '/' );		
-			cssFile.setAttribute("path", path);
-			cssFileList.appendChild(cssFile);
-		    }
-		}
-	    }
-	}
-		
-	page.getPageResponse().appendChild(cssFileList);
-    }
-	
-    protected void addJsFiles(Page page, Skin skin) {
-		
-	Element jsFileList = doc.createElement("jsFileList");
-		
-	// get skin level files
-	if (skin != null) {
-	    File dir = new File(skin.rootDirectory.getPath() + File.separatorChar + "js");
-	    if (dir.isDirectory()) {
-		File[] files = dir.listFiles();
-				
-		for (int fi=0, fn=files.length; fi<fn; fi++) {
-		    if (files[fi].getName().endsWith(".js")) {
-			Element jsFile = doc.createElement("jsFile");
-			String path = files[fi].getPath();
-			path = "." + path.substring(GlobalProperties.getGSDL3Home().length());
-			//changes to a correct path in case GS3 runs on Windows
-			path = path.replace( '\\', '/' );	
-			jsFile.setAttribute("path", path);
-			jsFileList.appendChild(jsFile);
-		    }
-		}
-	    }			
-	}	
-		
-	// get site level files
-	String site_home = page.getSiteHome();
-	File dir = new File(site_home + File.separatorChar + "ui" + File.separatorChar + "js");
-	if (dir.isDirectory()) {
-	    File[] files = dir.listFiles();
-	    for (int fi=0, fn=files.length; fi<fn; fi++) {
-		if (files[fi].getName().endsWith(".js")) {
-		    Element jsFile = doc.createElement("jsFile");
-		    String path = files[fi].getPath();
-		    path = "." + path.substring(GlobalProperties.getGSDL3Home().length());
-		    //changes to a correct path in case GS3 runs on Windows
-		    path = path.replace( '\\', '/' );	
-		    jsFile.setAttribute("path", path);
-		    jsFileList.appendChild(jsFile);
-		}
-	    }
-	}
-		
-	// get collect level files
-	String collect_home = page.getCollectionHome();
-	if (collect_home != "") {
-	    dir = new File(collect_home + File.separatorChar + "ui" + File.separatorChar + "js");
-	    if (dir.isDirectory()) {
-		File[] files = dir.listFiles();
-		for (int fi=0, fn=files.length; fi<fn; fi++) {
-		    if (files[fi].getName().endsWith(".js")) {
-			Element jsFile = doc.createElement("jsFile");
-			String path = files[fi].getPath();
-			path = "." + path.substring(GlobalProperties.getGSDL3Home().length());
-			//changes to a correct path in case GS3 runs on Windows
-			path = path.replace( '\\', '/' );	
-			jsFile.setAttribute("path", path);
-			jsFileList.appendChild(jsFile);
-		    }
-		}
-	    }
-	}
-		
-	page.getPageResponse().appendChild(jsFileList);
-    }
-	
-    protected void addUiElements(Page page) {
-		
-	Document siteUi = page.getSiteUi();
-	Document collectUi = page.getCollectUi();
-	String lang = page.getLanguage();
-		
-	HashMap elements = getRelevantElements("uiItem", lang, siteUi, collectUi);
-	Element xmlElements = doc.createElement("uiItemList");
-		
-	Iterator i = elements.values().iterator();
-	while (i.hasNext()) {
-	    Element element = (Element)i.next();
-			
-	    // doc.adoptNode(element); // Java 1.5 (DOM Level 3)
-	    // xmlElements.appendChild(element);
-
-	    // Java 1.4 equivalent
-	    Node doc_owned_node = doc.importNode(element,true);
-	    // Should also remove element from its original parent, as adopt does?
-	    // element.getParentNode().removeChild(element);
-
-
-	    xmlElements.appendChild(doc_owned_node);
-			
-			
-	}
-		
-	page.getPageResponse().appendChild(xmlElements);
-    }
-	
-    protected void addMetadataElements(Page page) {
-	Document siteMetadata = page.getSiteMetadata();
-	Document collectMetadata = page.getCollectMetadata();
-	String lang = page.getLanguage();
-		
-	HashMap elements = getRelevantElements("metadataItem", lang, siteMetadata, collectMetadata);
-	Element xmlElements = doc.createElement("metadataList");
-		
-	Iterator i = elements.values().iterator();
-	while (i.hasNext()) {
-	    Element element = (Element)i.next();
-	    
-	    // doc.adoptNode(element); // Java 1.5 (DOM Level 3)
-	    // xmlElements.appendChild(element);
-
-	    // Java 1.4 equivalent
-	    Node doc_owned_node = doc.importNode(element,true);
-	    // Should also remove element from its original parent, as adopt does?
-	    // element.getParentNode().removeChild(element);
-
-	    xmlElements.appendChild(doc_owned_node);
-	}
-		
-	page.getPageResponse().appendChild(xmlElements);
-    }
-	
-    protected Node transformPage(Element page) {
-	return super.transformPage(page);
-    }
-	
-    private HashMap getRelevantElements(String tagName, String lang, Document siteLevel, Document collectLevel) {
-		
-	HashMap elements = new HashMap();
-		
-	// get all relevant elements from collect level
-	if (collectLevel != null) {
-			
-	    NodeList xmlElements = collectLevel.getElementsByTagName(tagName);
-	    for (int di = 0, dn = xmlElements.getLength(); di < dn; di++) {
-				
-		Element xmlElement = (Element)xmlElements.item(di);
-				
-		// only include elements that are language independent or are the correct language, and do not specify inherit=true
-		if ((xmlElement.getAttribute("lang").equals("") || xmlElement.getAttribute("lang").equalsIgnoreCase(lang)) && !xmlElement.getAttribute("inherit").equalsIgnoreCase("true")) {
-		    String name = xmlElement.getAttribute("name");
-		    //System.out.println(name + " found and added at collect level");
-		    elements.put(name, xmlElement);
-		}	
-	    }
-	}
-		
-	// get all elements from site level
-	if (siteLevel != null) {
-			
-	    //System.out.println("getting all " + tagName + "'s (" + lang + ") from " + converter.getPrettyString(siteLevel));
-			
-	    NodeList xmlElements = siteLevel.getElementsByTagName(tagName);
-	    for (int di = 0, dn = xmlElements.getLength(); di < dn; di++) {
-				
-		Element xmlElement = (Element)xmlElements.item(di);
-				
-		// only include elements that are language independent or are the correct language, and which havent already been specified at collect level
-		if (xmlElement.getAttribute("lang").equals("") || xmlElement.getAttribute("lang").equalsIgnoreCase(lang)) {
-		    String name = xmlElement.getAttribute("name");
-		    //System.out.println(name + " found at site level");
-					
-		    if (!elements.containsKey(name)) {
-			elements.put(name, xmlElement);
-			//System.out.println(name + " added at site level");
-		    }
-		}
-	    }
-	}
-		
-	return elements;
-    }
-	
-    	
-}
