// $Id: InheritPattern.java,v 1.1 2002/04/25 18:07:58 bill Exp $

package com.jclark.xsl.expr;

import com.jclark.xsl.om.*;

class InheritPattern implements Pattern {
    private Pattern p;

    InheritPattern(Pattern p) {
        this.p = p;
    }

    public boolean matches(Node node, ExprContext context) throws XSLException {
        do {
            if (p.matches(node, context))
                return true;
            node = node.getParent();
        } while (node != null);
        return false;
    }
}
