Expression expr1 = firstOccuranceOwner.getExpression();
if(DEBUG)
assertIsLocPathIterator(expr1, firstOccuranceOwner);
boolean isGlobal = (paths == m_absPaths);
LocPathIterator lpi = (LocPathIterator)expr1;
int stepCount = countSteps(lpi);
for(int j = start; j < n; j++)
{
ExpressionOwner owner2 = (ExpressionOwner)paths.elementAt(j);
if(null != owner2)
{
Expression expr2 = owner2.getExpression();
boolean isEqual = expr2.deepEquals(lpi);
if(isEqual)
{
LocPathIterator lpi2 = (LocPathIterator)expr2;
if(null == head)
{
head = new MultistepExprHolder(firstOccuranceOwner, stepCount, null);
tail = head;
numPathsFound++;
}
tail.m_next = new MultistepExprHolder(owner2, stepCount, null);
tail = tail.m_next;
// Null out the occurance, so we don't have to test it again.
paths.setElementAt(null, j);
// foundFirst = true;
numPathsFound++;
}
}
}
// Change all globals in xsl:templates, etc, to global vars no matter what.
if((0 == numPathsFound) && isGlobal)
{
head = new MultistepExprHolder(firstOccuranceOwner, stepCount, null);
numPathsFound++;
}
if(null != head)
{
ElemTemplateElement root = isGlobal ? psuedoVarRecipient : findCommonAncestor(head);
LocPathIterator sharedIter = (LocPathIterator)head.m_exprOwner.getExpression();
ElemVariable var = createPseudoVarDecl(root, sharedIter, isGlobal);
if(DIAGNOSE_MULTISTEPLIST)
System.err.println("Created var: "+var.getName()+(isGlobal ? "(Global)" : ""));
QName uniquePseudoVarName = var.getName();
while(null != head)