String prefix = pat.substring(startSubstring, posOfNSSep);
String prefix = "";  if ((startSubstring >= 0) && (posOfNSSep >= 0)) { prefix = pat.substring(startSubstring, posOfNSSep); }
  private int mapNSTokens(String pat, int startSubstring, int posOfNSSep,                          int posOfScan)           throws javax.xml.transform.TransformerException {    String prefix = pat.substring(startSubstring, posOfNSSep);    String uName;    if ((null != m_namespaceContext) &&!prefix.equals("*")            &&!prefix.equals("xmlns"))    {      try      {        if (prefix.length() > 0)          uName = ((PrefixResolver) m_namespaceContext).getNamespaceForPrefix(            prefix);        else        {          // Assume last was wildcard. This is not legal according          // to the draft. Set the below to true to make namespace          // wildcards work.          if (false)          {            addToTokenQueue(":");            String s = pat.substring(posOfNSSep + 1, posOfScan);            if (s.length() > 0)              addToTokenQueue(s);            return -1;          }          else          {            uName =              ((PrefixResolver) m_namespaceContext).getNamespaceForPrefix(                prefix);          }        }      }      catch (ClassCastException cce)      {        uName = m_namespaceContext.getNamespaceForPrefix(prefix);      }    }    else    {      uName = prefix;    }    if ((null != uName) && (uName.length() > 0))    {      addToTokenQueue(uName);      addToTokenQueue(":");      String s = pat.substring(posOfNSSep + 1, posOfScan);      if (s.length() > 0)        addToTokenQueue(s);    }    else    {      // error("Could not locate namespace for prefix: "+prefix);      m_processor.error(XPATHErrorResources.ER_PREFIX_MUST_RESOLVE,                 new String[] {prefix});  //"Prefix must resolve to a namespace: {0}";      /***  Old code commented out 10-Jan-2001      addToTokenQueue(prefix);      addToTokenQueue(":");      String s = pat.substring(posOfNSSep + 1, posOfScan);      if (s.length() > 0)        addToTokenQueue(s);      ***/    }    return -1;  }