if (m.matches()) {
if (m.find()) {
    public StylesheetInfo[] getStylesheetLinks(org.w3c.dom.Document doc) {        List list = new ArrayList();        //get the processing-instructions (actually for XmlDocuments)        //type and href are required to be set        try {            org.w3c.dom.NodeList nl = XPathAPI.selectNodeList(doc.getDocumentElement(), "//processing-instruction('xml-stylesheet')");            for (int i = 0, len = nl.getLength(); i < len; i++) {                StylesheetInfo info = new StylesheetInfo();                info = new StylesheetInfo();                info.setOrigin(StylesheetInfo.AUTHOR);                org.w3c.dom.Node piNode = nl.item(i);                String pi = piNode.getNodeValue();                Matcher m = _alternatePattern.matcher(pi);                if (m.matches()) {                    int start = m.end();                    String alternate = pi.substring(start + 1, pi.indexOf(pi.charAt(start), start + 1));                    if (alternate.equals("yes")) continue;//DON'T get alternate stylesheets for now                }                m = _typePattern.matcher(pi);                if (m.matches()) {                    int start = m.end();                    String type = pi.substring(start + 1, pi.indexOf(pi.charAt(start), start + 1));                    info.setType(type);                }                m = _hrefPattern.matcher(pi);                if (m.matches()) {                    int start = m.end();                    String href = pi.substring(start + 1, pi.indexOf(pi.charAt(start), start + 1));                    info.setUri(href);                }                m = _titlePattern.matcher(pi);                if (m.matches()) {                    int start = m.end();                    String title = pi.substring(start + 1, pi.indexOf(pi.charAt(start), start + 1));                    info.setTitle(title);                }                m = _mediaPattern.matcher(pi);                if (m.matches()) {                    int start = m.end();                    String media = pi.substring(start + 1, pi.indexOf(pi.charAt(start), start + 1));                    info.setMedia(media);                }                list.add(info);            }        } catch (Exception ex) {            ex.printStackTrace();        }        StylesheetInfo[] refs = new StylesheetInfo[list.size()];        for (int i = 0; i < refs.length; i++) {            refs[i] = (StylesheetInfo) list.get(i);        }        return refs;    }