int handle = ((DOM2DTM)dtm).getHandleOfNode(node);
int handle;  if(node instanceof org.apache.xml.dtm.ref.dom2dtm.DOM2DTMdefaultNamespaceDeclarationNode) {    handle=dtm.getHandleOfNode(((org.w3c.dom.Attr)node).getOwnerElement()); handle=dtm.getAttributeNode(handle,node.getNamespaceURI(),node.getLocalName()); } else handle = ((DOM2DTM)dtm).getHandleOfNode(node);
  public int getDTMHandleFromNode(org.w3c.dom.Node node)  {    if(null == node)      throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_NODE_NON_NULL, null)); //"node must be non-null for getDTMHandleFromNode!");    if (node instanceof org.apache.xml.dtm.ref.DTMNodeProxy)      return ((org.apache.xml.dtm.ref.DTMNodeProxy) node).getDTMNodeNumber();    else    {      // Find the DOM2DTMs wrapped around this Document (if any)      // and check whether they contain the Node in question.      //      // NOTE that since a DOM2DTM may represent a subtree rather      // than a full document, we have to be prepared to check more      // than one -- and there is no guarantee that we will find      // one that contains ancestors or siblings of the node we're      // seeking.      //      // %REVIEW% We could search for the one which contains this      // node at the deepest level, and thus covers the widest      // subtree, but that's going to entail additional work      // checking more DTMs... and getHandleFromNode is not a      // cheap operation in most implementations.			//			// TODO: %REVIEW% If extended addressing, we may recheck a DTM			// already examined. Ouch. But with the increased number of DTMs,			// scanning back to check this is painful. 			// POSSIBLE SOLUTIONS: 			//   Generate a list of _unique_ DTM objects?			//   Have each DTM cache last DOM node search?			int max = m_dtms.length;      for(int i = 0; i < max; i++)        {          DTM thisDTM=m_dtms[i];          if((null != thisDTM) && thisDTM instanceof DOM2DTM)          {            int handle=((DOM2DTM)thisDTM).getHandleOfNode(node);            if(handle!=DTM.NULL) return handle;          }         }      // Since the real root of our tree may be a DocumentFragment, we need to      // use getParent to find the root, instead of getOwnerDocument.  Otherwise      // DOM2DTM#getHandleOfNode will be very unhappy.      Node root = node;      Node p = (root.getNodeType() == Node.ATTRIBUTE_NODE) ? ((org.w3c.dom.Attr)root).getOwnerElement() : root.getParentNode();      for (; p != null; p = p.getParentNode())      {        root = p;      }      DTM dtm = getDTM(new javax.xml.transform.dom.DOMSource(root), false,                       null, true, true);      int handle = ((DOM2DTM)dtm).getHandleOfNode(node);      if(DTM.NULL == handle)        throw new RuntimeException(XSLMessages.createMessage(XSLTErrorResources.ER_COULD_NOT_RESOLVE_NODE, null)); //"Could not resolve the node to a handle!");      return handle;    }  }