}
  public void startElement (StylesheetHandler handler,                             String uri, String localName,                            String rawName, Attributes attributes)    throws SAXException  {    ElemTemplateElement p = handler.getElemTemplateElement();    if(null == p)    {      // Literal Result Template as stylesheet.      Stylesheet stylesheet = new StylesheetRoot();      // stylesheet.setDOMBackPointer(handler.getOriginatingNode());      stylesheet.setLocaterInfo(new org.xml.sax.helpers.LocatorImpl());      stylesheet.setPrefixes(handler.getNamespaceSupport());      handler.pushStylesheet(stylesheet);            setPropertiesFromAttributes(handler, "stylesheet", attributes, stylesheet);      handler.pushElemTemplateElement(stylesheet);            ElemTemplate template = new ElemTemplate();      appendAndPush(handler, template);            XPath rootMatch = new XPath("/", stylesheet, stylesheet, XPath.MATCH);      template.setMatch(rootMatch);       // template.setDOMBackPointer(handler.getOriginatingNode());      stylesheet.setTemplate(template);      p = handler.getElemTemplateElement();    }    XSLTElementDef def = getElemDef();    Class classObject = def.getClassObject();        boolean isExtension = false;    while(null != p)    {      // System.out.println("Checking: "+p);      if(p instanceof ElemLiteralResult)      {        ElemLiteralResult parentElem = (ElemLiteralResult)p;        isExtension = parentElem.containsExtensionElementURI(uri);      }      else if(p instanceof Stylesheet)      {        Stylesheet parentElem = (Stylesheet)p;        isExtension = parentElem.containsExtensionElementURI(uri);      }      if(isExtension)        break;      p = p.getParentElem();    }        ElemLiteralResult elem = null;    try    {      if(isExtension)      {        // System.out.println("Creating extension(1): "+uri);        elem = new ElemExtensionCall();      }      else        elem = (ElemLiteralResult)classObject.newInstance();      elem.setDOMBackPointer(handler.getOriginatingNode());      elem.setLocaterInfo(handler.getLocator());      elem.setPrefixes(handler.getNamespaceSupport());      elem.setNamespace(uri);      elem.setLocalName(localName);      elem.setRawName(rawName);    }    catch(InstantiationException ie)    {      handler.error("Failed creating ElemLiteralResult instance!", ie);    }    catch(IllegalAccessException iae)    {      handler.error("Failed creating ElemLiteralResult instance!", iae);    }        setPropertiesFromAttributes(handler, rawName, attributes, elem);        // bit of a hack here...    if(!isExtension)    {      isExtension = elem.containsExtensionElementURI(uri);      if(isExtension)      {        // System.out.println("Creating extension(2): "+uri);        elem = new ElemExtensionCall();        elem.setLocaterInfo(handler.getLocator());        elem.setPrefixes(handler.getNamespaceSupport());        elem.setNamespace(uri);        elem.setLocalName(localName);        elem.setRawName(rawName);        setPropertiesFromAttributes(handler, rawName, attributes, elem);      }    }        appendAndPush(handler, elem);  }