stylesheet = (collection.equals("/") ? '/' + stylesheet : collection + '/' + stylesheet);
	public String getDocument(User user, String name, Hashtable parametri)		throws Exception {		long start = System.currentTimeMillis();		DBBroker broker = null;		String stylesheet = null;		String encoding = "UTF-8";		Hashtable styleparam = null;		try {			broker = brokerPool.get(user);			Configuration config = broker.getConfiguration();			String option = (String) config.getProperty("serialization.enable-xinclude");			String prettyPrint = (String) config.getProperty("serialization.indent");			DocumentImpl doc = (DocumentImpl) broker.getDocument(name);			if (doc == null) {				LOG.debug("document " + name + " not found!");				throw new EXistException("document not found");			}			Serializer serializer = broker.getSerializer();			if (parametri != null) {				for (Enumeration en = parametri.keys(); en.hasMoreElements();) {					String param = (String) en.nextElement();					String paramvalue = parametri.get(param).toString();					//LOG.debug("-------Parametri passati:"+param+": "+paramvalue); 					if (param.equals(EXistOutputKeys.EXPAND_XINCLUDES)) {						option = (paramvalue.equals("yes")) ? "true" : "false";					}					if (param.equals(OutputKeys.INDENT)) {						prettyPrint = paramvalue;					}					if (param.equals(OutputKeys.ENCODING)) {						encoding = paramvalue;					}					if (param.equals(EXistOutputKeys.STYLESHEET)) {						stylesheet = paramvalue;					}					if (param.equals(EXistOutputKeys.STYLESHEET_PARAM)) {						styleparam = (Hashtable) parametri.get(param);					}					if (param.equals(OutputKeys.DOCTYPE_SYSTEM)) {						serializer.setProperty(OutputKeys.DOCTYPE_SYSTEM, paramvalue);					}				}			}			if (option.equals("true")) {				serializer.setProperty(EXistOutputKeys.EXPAND_XINCLUDES, "yes");			} else {				serializer.setProperty(EXistOutputKeys.EXPAND_XINCLUDES, "no");			}			serializer.setProperty(OutputKeys.ENCODING, encoding);			serializer.setProperty(OutputKeys.INDENT, prettyPrint);			if (stylesheet != null) {							if (stylesheet.indexOf(":") < 0) {				if (!stylesheet.startsWith("/")) {					// make path relative to current collection					String collection;					if (doc.getCollection() != null)						collection = doc.getCollection().getName();					else {						int cp = doc.getFileName().lastIndexOf("/");						collection = (cp > 0) ? doc.getFileName().substring(0, cp) : "/";					}					stylesheet =						(collection.equals("/")							? '/' + stylesheet							: collection + '/' + stylesheet);				}							}				serializer.setStylesheet(stylesheet);				// set stylesheet param if presents				if (styleparam != null) {					for (Enumeration en1 = styleparam.keys(); en1.hasMoreElements();) {						String param1 = (String) en1.nextElement();						String paramvalue1 = styleparam.get(param1).toString();						// System.out.println("-->"+param1+"--"+paramvalue1);						serializer.setStylesheetParamameter(param1, paramvalue1);					}				}			}			String xml = serializer.serialize(doc);			return xml;		} catch (NoSuchMethodError nsme) {			nsme.printStackTrace();			return null;		} finally {			brokerPool.release(broker);		}	}