Evaluating a source document for compliance with a rule set that
represents contextual guidelines to which the source document must
conform. The rule set comprises a rule node that includes a context that
is compared to the source document to identify candidate nodes for
further evaluation. Each rule node also includes a descendant pattern
node that includes a pattern matching expression representing at least
one aspect of the contextual guidelines to which the source document must
conform. Preferably a match between a candidate node and the pattern
matching expression indicates a nonconformance to the contextual
guideline(s), and a predefined action is initiated. Predefined actions
include reporting the nonconformance, and automatically repairing the
nonconformance through script code.