code: public Node appendChild(Node newChild) throws DOMException
    {
  
      if (null == newChild)
      {
        error(XSLTErrorResources.ER_NULL_CHILD, null);  //"Trying to add a null child!");
      }
  
      ElemTemplateElement elem = (ElemTemplateElement) newChild;
  
      if (null == m_firstChild)
      {
        m_firstChild = elem;
      }
      else
      {
        ElemTemplateElement last = (ElemTemplateElement) getLastChild();
  
        last.m_nextSibling = elem;
      }
  
      elem.m_parentNode = this;
  
      return newChild;
    }
docs: Add a child to the child list.
  NOTE: This presumes the child did not previously have a parent.
  Making that assumption makes this a less expensive operation -- but
  requires that if you *do* want to reparent a node, you use removeChild()
  first to remove it from its previous context. Failing to do so will
  damage the tree.
  
  @param newChild Child to be added to child list
  
  @return Child just added to the child list
  @throws DOMException