Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.xalan.templates
Class RedundentExprEliminator

    java.lang.Object
      |
      +--org.apache.xpath.XPathVisitor
            |
            +--org.apache.xalan.templates.XSLTVisitor
                  |
                  +--org.apache.xalan.templates.RedundentExprEliminator

public class RedundentExprEliminator
extends XSLTVisitor

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.

Field Summary
`static boolean` | `DEBUG`
`static boolean` | `DIAGNOSE_MULTISTEPLIST`
`static boolean` | `DIAGNOSE_NUM_PATHS_REDUCED`

Constructor Summary
`RedundentExprEliminator()` Construct a RedundentExprEliminator.

Method Summary
`void` | `eleminateRedundentGlobals(StylesheetRoot stylesheet)` Method to be called after the all global expressions within a stylesheet have been collected.
`void` | `eleminateRedundentLocals(ElemTemplateElement psuedoVarRecipient)` Method to be called after the all expressions within an node context have been visited.
`boolean` | `isAbsolute(LocPathIterator path)` Tell if the given LocPathIterator is relative to an absolute path, i.e.
`boolean` | `visitInstruction(ElemTemplateElement elem)` Visit an XSLT instruction.
`boolean` | `visitLocationPath(ExpressionOwner owner, LocPathIterator path)` Visit a LocationPath.
`boolean` | `visitPredicate(ExpressionOwner owner, Expression pred)` Visit a predicate within a location path.
`boolean` | `visitTopLevelInstruction(ElemTemplateElement elem)` Visit an XSLT top-level instruction.

Methods inherited from class org.apache.xalan.templates.XSLTVisitor
`visitAVT, visitExtensionElement, visitLiteralResultElement, visitStylesheet, visitTopLevelVariableOrParamDecl, visitVariableOrParamDecl`

Methods inherited from class org.apache.xpath.XPathVisitor
`visitBinaryOperation, visitFunction, visitMatchPattern, visitNumberLiteral, visitStep, visitStringLiteral, visitUnaryOperation, visitUnionPath, visitUnionPattern, visitVariableRef`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEBUG

    public static final boolean DEBUG

### DIAGNOSE_NUM_PATHS_REDUCED

    public static final boolean DIAGNOSE_NUM_PATHS_REDUCED

### DIAGNOSE_MULTISTEPLIST

    public static final boolean DIAGNOSE_MULTISTEPLIST

Constructor Detail

### RedundentExprEliminator

    public RedundentExprEliminator()

  Construct a RedundentExprEliminator.

Method Detail

### 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.
  Parameters:
    `psuedoVarRecipient` - The recipient of the psuedo vars. The variables will be inserted as first children of the element, before any existing variables.

### 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.

### 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.
  Returns:
    true if the LocPathIterator is not dependent on the context node.

### visitLocationPath

    public boolean visitLocationPath(ExpressionOwner owner,
                                     LocPathIterator path)

  Visit a LocationPath.
  Parameters:
    `owner` - The owner of the expression, to which the expression can be reset if rewriting takes place.
    `path` - The LocationPath object.
  Returns:
    true if the sub expressions should be traversed.
  Overrides:
    visitLocationPath in class XPathVisitor

### 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.
  Parameters:
    `owner` - The owner of the expression, to which the expression can be reset if rewriting takes place.
    `pred` - The predicate object.
  Returns:
    true if the sub expressions should be traversed.
  Overrides:
    visitPredicate in class XPathVisitor

### visitTopLevelInstruction

    public boolean visitTopLevelInstruction(ElemTemplateElement elem)

  Visit an XSLT top-level instruction.
  Parameters:
    `elem` - The xsl instruction element object.
  Returns:
    true if the sub expressions should be traversed.
  Overrides:
    visitTopLevelInstruction in class XSLTVisitor

### 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.
  Parameters:
    `elem` - The xsl instruction element object.
  Returns:
    true if the sub expressions should be traversed.
  Overrides:
    visitInstruction in class XSLTVisitor

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006 Apache XML Project. All Rights Reserved.