code: private void transform(final String xml, final UIContext uic, final PrintWriter writer) {
  
  		Transformer transformer = newTransformer();
  		Source inputXml;
  		try {
  			inputXml = new StreamSource(new ByteArrayInputStream(xml.getBytes("utf-8")));
  			StreamResult result = new StreamResult(writer);
  			if (debugRequested) {
  				transformer.setParameter("isDebug", 1);
  			}
  			transformer.transform(inputXml, result);
  		} catch (UnsupportedEncodingException | TransformerException ex) {
  			throw new SystemException("Could not transform xml", ex);
  		}
  	}
docs: Transform the UI XML to HTML using the correct XSLT from the classpath.
  
  @param xml The XML to transform.
  @param uic The UIContext used to determine variables such as locale.
  @param writer The result of the transformation will be written to this writer.