org.apache.xalan.templates
Class RedundentExprEliminator
public class RedundentExprEliminator
This class eleminates redundent XPaths from a given subtree,
and also collects all absolute paths within the subtree. First
it must be called as a visitor to the subtree, and then
eleminateRedundent must be called.
visitBinaryOperation , visitFunction , visitLocationPath , visitMatchPattern , visitNumberLiteral , visitPredicate , visitStep , visitStringLiteral , visitUnaryOperation , visitUnionPath , visitUnionPattern , visitVariableRef |
DEBUG
public static final boolean DEBUG
DIAGNOSE_MULTISTEPLIST
public static final boolean DIAGNOSE_MULTISTEPLIST
DIAGNOSE_NUM_PATHS_REDUCED
public static final boolean DIAGNOSE_NUM_PATHS_REDUCED
RedundentExprEliminator
public RedundentExprEliminator()
Construct a RedundentExprEliminator.
eleminateRedundentGlobals
public void eleminateRedundentGlobals(StylesheetRoot stylesheet)
Method to be called after the all global expressions within a stylesheet
have been collected. It eliminates redundent
expressions by creating a variable in the psuedoVarRecipient
for each redundent expression, and then rewriting the redundent
expression to be a variable reference.
eleminateRedundentLocals
public void eleminateRedundentLocals(ElemTemplateElement psuedoVarRecipient)
Method to be called after the all expressions within an
node context have been visited. It eliminates redundent
expressions by creating a variable in the psuedoVarRecipient
for each redundent expression, and then rewriting the redundent
expression to be a variable reference.
psuedoVarRecipient
- The recipient of the psuedo vars. The
variables will be inserted as first children of the element, before
any existing variables.
isAbsolute
public boolean isAbsolute(LocPathIterator path)
Tell if the given LocPathIterator is relative to an absolute path, i.e.
in not dependent on the context.
- true if the LocPathIterator is not dependent on the context node.
visitInstruction
public boolean visitInstruction(ElemTemplateElement elem)
Visit an XSLT instruction. Any element that isn't called by one
of the other visit methods, will be called by this method.
- visitInstruction in interface XSLTVisitor
elem
- The xsl instruction element object.
- true if the sub expressions should be traversed.
visitLocationPath
public boolean visitLocationPath(ExpressionOwner owner,
LocPathIterator path)
Visit a LocationPath.
- visitLocationPath in interface XPathVisitor
owner
- The owner of the expression, to which the expression can
be reset if rewriting takes place.path
- The LocationPath object.
- true if the sub expressions should be traversed.
visitPredicate
public boolean visitPredicate(ExpressionOwner owner,
Expression pred)
Visit a predicate within a location path. Note that there isn't a
proper unique component for predicates, and that the expression will
be called also for whatever type Expression is.
- visitPredicate in interface XPathVisitor
owner
- The owner of the expression, to which the expression can
be reset if rewriting takes place.pred
- The predicate object.
- true if the sub expressions should be traversed.
Copyright B) 2005 Apache XML Project. All Rights Reserved.