An apparatus comprises a stylesheet compiler and a document processor. The
stylesheet compiler is configured to identify expressions in a stylesheet
and is configured to generate one or more expression trees representing
the expressions. Expressions having one or more common nodes are
represented as children of a subtree that represents the common nodes.
Coupled to receive a document and the expression tree, the document
processor is configured to evaluate the expressions represented in the
one or more expression trees against the document.