You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mm...@locus.apache.org on 2000/09/27 23:48:05 UTC

cvs commit: xml-xalan/java/src/org/apache/xalan/templates TemplateList.java

mmidy       00/09/27 14:48:04

  Modified:    java/src/org/apache/xalan/templates TemplateList.java
  Log:
  Make sure we math nodes on wildcard pattern
  
  Revision  Changes    Path
  1.6       +20 -5     xml-xalan/java/src/org/apache/xalan/templates/TemplateList.java
  
  Index: TemplateList.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/TemplateList.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TemplateList.java	2000/08/30 14:20:53	1.5
  +++ TemplateList.java	2000/09/27 21:48:02	1.6
  @@ -103,6 +103,12 @@
             template.m_nextSibling = null; // just to play it safe.
             break;
           }
  +        else if (template.equals(next.m_nextSibling))
  +        {
  +          pos++;
  +          break;
  +        }  
  +                 
           pos++;
           next = next.m_nextSibling;
         }
  @@ -232,11 +238,11 @@
   
       case Node.CDATA_SECTION_NODE:
       case Node.TEXT_NODE:
  -      matchPat = locateMatchPatternList2(PsuedoNames.PSEUDONAME_TEXT, false);
  +      matchPat = locateMatchPatternList2(PsuedoNames.PSEUDONAME_TEXT, true);
         break;
   
       case Node.COMMENT_NODE:
  -      matchPat = locateMatchPatternList2(PsuedoNames.PSEUDONAME_COMMENT, false);
  +      matchPat = locateMatchPatternList2(PsuedoNames.PSEUDONAME_COMMENT, true);
         break;
   
       case Node.DOCUMENT_NODE:
  @@ -249,7 +255,7 @@
   
       default:
         {
  -        matchPat = locateMatchPatternList2(targetNode.getNodeName(), false);
  +        matchPat = locateMatchPatternList2(targetNode.getNodeName(), true);
         }
       }
   
  @@ -341,12 +347,21 @@
         MatchPattern2 nextMatchPat = matchPat.getNext();
   
         // We also have to consider wildcard matches.
  -      if((null == nextMatchPat) && !matchPat.m_targetString.equals("*") &&
  +      if((null == nextMatchPat) && 
  +         !matchPat.m_targetString.equals("*")
  +         /*&&
            ((Node.ELEMENT_NODE == targetNodeType) ||
  +          (Node.TEXT_NODE == targetNodeType) ||
             (Node.ATTRIBUTE_NODE == targetNodeType) ||
  -          (Node.PROCESSING_INSTRUCTION_NODE == targetNodeType)))
  +          (Node.PROCESSING_INSTRUCTION_NODE == targetNodeType))*/
  +         )
         {
           nextMatchPat = (MatchPattern2)m_patternTable.get("*");
  +        // TODO: something like this to avoid going thgough executing 
  +        // the match pattern if we can know that it will have lower score 
  +        //double d = ((Nodetest)(nextMatchPat.getExpression().getExpression())).getDefaultScore();
  +        // if (d < bestMatchScore)
  +        //   nextMatchPat = null;  // don't even bother to execute 
         }
         matchPat = nextMatchPat;
       }