code: public XNodeSet getNodeSetDTMByKey(QName name, XMLString ref)
  
    {
      XNodeSet refNodes = (XNodeSet) getRefsTable().get(ref);
      // clone wiht reset the node set
     try
      {
        if (refNodes != null)
        {
           refNodes = (XNodeSet) refNodes.cloneWithReset();
         }
      }
      catch (CloneNotSupportedException e)
      {
        refNodes = null;
      }
  
      if (refNodes == null) {
       //  create an empty XNodeSet
        KeyIterator ki = (KeyIterator) (m_keyNodes).getContainedIter();
        XPathContext xctxt = ki.getXPathContext();
        refNodes = new XNodeSet(xctxt.getDTMManager()) {
          public void setRoot(int nodeHandle, Object environment) {
            // Root cannot be set on non-iterated node sets. Ignore it.
          }
        };
        refNodes.reset();
      }
  
      return refNodes;
    }
docs: Given a valid element key, return the corresponding node list.
  
  @param name The name of the key, which must match the 'name' attribute on xsl:key.
  @param ref The value that must match the value found by the 'match' attribute on xsl:key.
  @return a set of nodes referenced by the key named <CODE>name</CODE> and the reference <CODE>ref</CODE>. If no node is referenced by this key, an empty node set is returned.