1. An apparatus comprising: a stylesheet compiler configured to identify expressions in a stylesheet and configured to generate one or more expression trees representing the expressions, wherein expressions having one or more common nodes are represented as children of a subtree that represents the common nodes; and a document processor coupled to receive a document and the expression tree, wherein the document processor is configured to evaluate the expressions represented in the one or more expression trees against the document.