XPathContext xctxt = getXPathContext();
  public DocumentFragment transformToRTF(                                        Stylesheet stylesheetTree,                                        ElemTemplateElement templateParent,                                        Node sourceNode, QName mode)    throws SAXException  {    XPathContext xctxt = getXPathContext();    // Document docFactory = xctxt.getDOMHelper().getDOMFactory();        if(null == m_docBuilder)    {      try      {        DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();        m_docBuilder = dfactory.newDocumentBuilder();      }      catch(ParserConfigurationException pce)      {        throw new SAXException(pce);//"createDocument() not supported in XPathContext!");        // return null;      }    }    Document docFactory = m_docBuilder.newDocument();        // Create a ResultTreeFrag object.    DocumentFragment resultFragment = docFactory.createDocumentFragment();    // Create a DOMBuilder object that will handle the SAX events     // and build the ResultTreeFrag nodes.    ContentHandler rtfHandler = new DOMBuilder(docFactory, resultFragment);    // Save the current result tree handler.    ResultTreeHandler savedRTreeHandler = this.m_resultTreeHandler;        // And make a new handler for the RTF.    this.m_resultTreeHandler = new ResultTreeHandler(this, rtfHandler);    // Do the transformation of the child elements.    executeChildTemplates(templateParent, sourceNode, mode);        // Make sure everything is flushed!    this.m_resultTreeHandler.flushPending();    // Restore the previous result tree handler.    this.m_resultTreeHandler = savedRTreeHandler;    return resultFragment;  }  