You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by sb...@apache.org on 2001/04/10 20:45:48 UTC

cvs commit: xml-xalan/java/src/org/w3c/dom/traversal NodeIterator.java

sboag       01/04/10 11:45:48

  Modified:    java/src/org/apache/xalan/extensions Tag: DTM_EXP
                        ExtensionHandler.java ExtensionHandlerGeneral.java
                        ExtensionHandlerJavaClass.java
                        ExtensionHandlerJavaPackage.java
                        ExtensionsTable.java MethodResolver.java
                        XSLProcessorContext.java
               java/src/org/apache/xalan/lib Tag: DTM_EXP Extensions.java
                        Redirect.java
               java/src/org/apache/xalan/processor Tag: DTM_EXP
                        CompilingStylesheetHandler.java
               java/src/org/apache/xalan/stree Tag: DTM_EXP Parent.java
                        SourceTreeHandler.java StreeDOMBuilder.java
               java/src/org/apache/xalan/templates Tag: DTM_EXP AVT.java
                        AVTPart.java AVTPartSimple.java AVTPartXPath.java
                        ElemApplyImport.java ElemApplyTemplates.java
                        ElemAttribute.java ElemAttributeSet.java
                        ElemCallTemplate.java ElemChoose.java
                        ElemComment.java ElemCopy.java ElemCopyOf.java
                        ElemElement.java ElemExtensionCall.java
                        ElemFallback.java ElemForEach.java ElemIf.java
                        ElemLiteralResult.java ElemMessage.java
                        ElemNumber.java ElemPI.java ElemParam.java
                        ElemTemplate.java ElemTemplateElement.java
                        ElemText.java ElemTextLiteral.java ElemUnknown.java
                        ElemUse.java ElemValueOf.java ElemVariable.java
                        FuncDocument.java FuncKey.java Stylesheet.java
                        StylesheetRoot.java TemplateList.java
                        TemplateSubPatternAssociation.java
                        XUnresolvedVariable.java
               java/src/org/apache/xalan/trace Tag: DTM_EXP
                        PrintTraceListener.java TraceManager.java
               java/src/org/apache/xalan/transformer Tag: DTM_EXP
                        ClonerToResultTree.java Counter.java
                        CountersTable.java KeyIterator.java KeyManager.java
                        KeyRefIterator.java KeyTable.java KeyWalker.java
                        NodeSorter.java QueuedStartElement.java
                        ResultTreeHandler.java StackGuard.java
                        TransformerImpl.java TreeWalker2Result.java
               java/src/org/apache/xml/utils Tag: DTM_EXP DOMBuilder.java
                        NodeVector.java
               java/src/org/apache/xpath Tag: DTM_EXP Expression.java
                        NodeSet.java SourceTree.java SourceTreeManager.java
                        XPath.java XPathAPI.java XPathContext.java
               java/src/org/apache/xpath/axes Tag: DTM_EXP
                        AncestorOrSelfWalker.java AncestorWalker.java
                        AttributeIterator.java AttributeWalker.java
                        AttributeWalkerOneStep.java AxesWalker.java
                        ChildIterator.java ChildTestIterator.java
                        ChildWalker.java ChildWalkerMultiStep.java
                        ChildWalkerOneStep.java DescendantIterator.java
                        DescendantOrSelfWalker.java DescendantWalker.java
                        FilterExprWalker.java FollowingSiblingWalker.java
                        FollowingWalker.java LocPathIterator.java
                        NamespaceWalker.java ParentWalker.java
                        PrecedingSiblingWalker.java PrecedingWalker.java
                        PredicatedNodeTest.java ReverseAxesWalker.java
                        RootWalker.java RootWalkerMultiStep.java
                        SelfWalker.java SelfWalkerOneStep.java
                        SubContextList.java UnionPathIterator.java
               java/src/org/apache/xpath/functions Tag: DTM_EXP
                        FuncBoolean.java FuncCeiling.java FuncConcat.java
                        FuncContains.java FuncCount.java FuncCurrent.java
                        FuncDoclocation.java FuncExtElementAvailable.java
                        FuncExtFunction.java FuncExtFunctionAvailable.java
                        FuncFalse.java FuncFloor.java FuncGenerateId.java
                        FuncId.java FuncLang.java FuncLast.java
                        FuncLocalPart.java FuncNamespace.java
                        FuncNormalizeSpace.java FuncNot.java
                        FuncNumber.java FuncPosition.java FuncQname.java
                        FuncRound.java FuncStartsWith.java FuncString.java
                        FuncStringLength.java FuncSubstring.java
                        FuncSubstringAfter.java FuncSubstringBefore.java
                        FuncSum.java FuncSystemProperty.java
                        FuncTranslate.java FuncTrue.java
                        FuncUnparsedEntityURI.java Function.java
                        FunctionDef1Arg.java
               java/src/org/apache/xpath/objects Tag: DTM_EXP XNodeSet.java
                        XNull.java XNumber.java XObject.java
                        XRTreeFrag.java XString.java
               java/src/org/apache/xpath/patterns Tag: DTM_EXP
                        AncestorStepPattern.java FunctionPattern.java
                        NodeTest.java StepPattern.java
               java/src/org/w3c/dom/traversal Tag: DTM_EXP
                        NodeIterator.java
  Added:       java/src/org/apache/xml/dtm Tag: DTM_EXP DTM.java
                        DTMFilter.java DTMIterator.java DTMManager.java
                        DTMTreeWalker.java
  Log:
  Branch now compiles clean.  Unfinished code is marked by %TBD%,
  %OPT%, or %REVIEW%.  DTM stuff moved to org.apache.xml.dtm.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.12.2.1  +3 -3      xml-xalan/java/src/org/apache/xalan/extensions/ExtensionHandler.java
  
  Index: ExtensionHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/extensions/ExtensionHandler.java,v
  retrieving revision 1.12
  retrieving revision 1.12.2.1
  diff -u -r1.12 -r1.12.2.1
  --- ExtensionHandler.java	2001/01/02 03:36:33	1.12
  +++ ExtensionHandler.java	2001/04/10 18:44:36	1.12.2.1
  @@ -67,6 +67,7 @@
   import org.w3c.dom.Node;
   
   import org.apache.xalan.templates.Stylesheet;
  +import org.apache.xalan.templates.ElemTemplateElement;
   import org.apache.xml.utils.QName;
   
   // Temp??
  @@ -216,7 +217,6 @@
      * @throws TransformerException          if parsing trouble
      */
     public abstract void processElement(
  -    String localPart, Element element, TransformerImpl transformer,
  -      Stylesheet stylesheetTree, Node sourceTree, Node sourceNode,
  -        QName mode, Object methodKey) throws TransformerException, IOException;
  +    String localPart, ElemTemplateElement element, TransformerImpl transformer,
  +      Stylesheet stylesheetTree, Object methodKey) throws TransformerException, IOException;
   }
  
  
  
  1.10.2.1  +20 -15    xml-xalan/java/src/org/apache/xalan/extensions/ExtensionHandlerGeneral.java
  
  Index: ExtensionHandlerGeneral.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/extensions/ExtensionHandlerGeneral.java,v
  retrieving revision 1.10
  retrieving revision 1.10.2.1
  diff -u -r1.10 -r1.10.2.1
  --- ExtensionHandlerGeneral.java	2001/01/02 03:36:33	1.10
  +++ ExtensionHandlerGeneral.java	2001/04/10 18:44:37	1.10.2.1
  @@ -61,11 +61,13 @@
   
   import java.io.IOException;
   
  -import org.w3c.dom.Element;
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Element;
  +//import org.w3c.dom.Node;
  +import org.apache.xml.dtm.DTM;
   
   import org.apache.xalan.transformer.TransformerImpl;
   import org.apache.xalan.templates.Stylesheet;
  +import org.apache.xalan.templates.ElemTemplateElement;
   import org.apache.xml.utils.QName;
   
   import javax.xml.transform.TransformerException;
  @@ -345,30 +347,33 @@
      * @throws TransformerException          if parsing trouble
      */
     public void processElement(
  -          String localPart, Element element, TransformerImpl transformer, Stylesheet stylesheetTree, Node sourceTree, Node sourceNode, QName mode, Object methodKey)
  +          String localPart, ElemTemplateElement element, TransformerImpl transformer, 
  +          Stylesheet stylesheetTree, Object methodKey)
               throws TransformerException, IOException
     {
   
       Object result = null;
  -    XSLProcessorContext xpc = new XSLProcessorContext(transformer,
  -                                stylesheetTree, sourceTree, sourceNode, mode);
  +    XSLProcessorContext xpc = new XSLProcessorContext(transformer, stylesheetTree);
   
  -    try
  +    // %TBD%
  +//    try
       {
         Vector argv = new Vector(2);
   
         argv.addElement(xpc);
         argv.addElement(element);
   
  -      result = callFunction(localPart, argv, methodKey,
  -                            transformer.getXPathContext());
  -    }
  -    catch (XPathProcessorException e)
  -    {
  -
  -      // e.printStackTrace ();
  -      throw new TransformerException(e.getMessage(), e);
  -    }
  +      // %TBD% This wants an ExpressionContext.
  +//      result = callFunction(localPart, argv, methodKey,
  +//                            transformer.getXPathContext());
  +    }
  +    // %TBD%
  +//    catch (XPathProcessorException e)
  +//    {
  +//
  +//      // e.printStackTrace ();
  +//      throw new TransformerException(e.getMessage(), e);
  +//    }
   
       if (result != null)
       {
  
  
  
  1.9.2.1   +5 -10     xml-xalan/java/src/org/apache/xalan/extensions/ExtensionHandlerJavaClass.java
  
  Index: ExtensionHandlerJavaClass.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/extensions/ExtensionHandlerJavaClass.java,v
  retrieving revision 1.9
  retrieving revision 1.9.2.1
  diff -u -r1.9 -r1.9.2.1
  --- ExtensionHandlerJavaClass.java	2001/01/02 03:36:34	1.9
  +++ ExtensionHandlerJavaClass.java	2001/04/10 18:44:37	1.9.2.1
  @@ -64,10 +64,11 @@
   import java.lang.reflect.InvocationTargetException;
   import java.io.IOException;
   
  -import org.w3c.dom.Element;
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Element;
  +//import org.w3c.dom.Node;
   import org.apache.xalan.transformer.TransformerImpl;
   import org.apache.xalan.templates.Stylesheet;
  +import org.apache.xalan.templates.ElemTemplateElement;
   import org.apache.xml.utils.QName;
   
   import org.apache.xpath.objects.XObject;
  @@ -379,12 +380,9 @@
      */
   
     public void processElement(String localPart,
  -                             Element element,
  +                             ElemTemplateElement element,
                                TransformerImpl transformer,
                                Stylesheet stylesheetTree,
  -                             Node sourceTree,
  -                             Node sourceNode,
  -                             QName mode,
                                Object methodKey)
       throws TransformerException, IOException
     {
  @@ -408,10 +406,7 @@
       }
   
       XSLProcessorContext xpc = new XSLProcessorContext(transformer, 
  -                                                      stylesheetTree,
  -                                                      sourceTree, 
  -                                                      sourceNode, 
  -                                                      mode);
  +                                                      stylesheetTree);
   
       try
       {
  
  
  
  1.9.2.1   +8 -10     xml-xalan/java/src/org/apache/xalan/extensions/ExtensionHandlerJavaPackage.java
  
  Index: ExtensionHandlerJavaPackage.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/extensions/ExtensionHandlerJavaPackage.java,v
  retrieving revision 1.9
  retrieving revision 1.9.2.1
  diff -u -r1.9 -r1.9.2.1
  --- ExtensionHandlerJavaPackage.java	2001/01/02 03:36:34	1.9
  +++ ExtensionHandlerJavaPackage.java	2001/04/10 18:44:37	1.9.2.1
  @@ -64,10 +64,14 @@
   import java.lang.reflect.InvocationTargetException;
   import java.io.IOException;
   
  -import org.w3c.dom.Element;
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Element;
  +//import org.w3c.dom.Node;
  +
  +import org.apache.xml.dtm.DTM;
  +
   import org.apache.xalan.transformer.TransformerImpl;
   import org.apache.xalan.templates.Stylesheet;
  +import org.apache.xalan.templates.ElemTemplateElement;
   import org.apache.xml.utils.QName;
   
   import org.apache.xpath.objects.XObject;
  @@ -411,12 +415,9 @@
      */
   
     public void processElement (String localPart,
  -                              Element element,
  +                              ElemTemplateElement element,
                                 TransformerImpl transformer,
                                 Stylesheet stylesheetTree,
  -                              Node sourceTree,
  -                              Node sourceNode,
  -                              QName mode,
                                 Object methodKey)
       throws TransformerException, IOException
     {
  @@ -454,10 +455,7 @@
       }
   
       XSLProcessorContext xpc = new XSLProcessorContext(transformer, 
  -                                                      stylesheetTree,
  -                                                      sourceTree, 
  -                                                      sourceNode, 
  -                                                      mode);
  +                                                      stylesheetTree);
   
       try
       {
  
  
  
  1.15.2.1  +2 -1      xml-xalan/java/src/org/apache/xalan/extensions/ExtensionsTable.java
  
  Index: ExtensionsTable.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/extensions/ExtensionsTable.java,v
  retrieving revision 1.15
  retrieving revision 1.15.2.1
  diff -u -r1.15 -r1.15.2.1
  --- ExtensionsTable.java	2001/01/12 07:29:11	1.15
  +++ ExtensionsTable.java	2001/04/10 18:44:37	1.15.2.1
  @@ -226,7 +226,8 @@
      * @throws javax.xml.transform.TransformerException
      */
     public Object extFunction(
  -          String ns, String funcName, Vector argVec, Object methodKey, ExpressionContext exprContext)
  +          String ns, String funcName, Vector argVec, Object methodKey, 
  +          ExpressionContext exprContext)
               throws javax.xml.transform.TransformerException
     {
   
  
  
  
  1.19.2.1  +31 -26    xml-xalan/java/src/org/apache/xalan/extensions/MethodResolver.java
  
  Index: MethodResolver.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/extensions/MethodResolver.java,v
  retrieving revision 1.19
  retrieving revision 1.19.2.1
  diff -u -r1.19 -r1.19.2.1
  --- MethodResolver.java	2001/02/19 19:40:31	1.19
  +++ MethodResolver.java	2001/04/10 18:44:37	1.19.2.1
  @@ -732,16 +732,18 @@
             {
               return ((XRTreeFrag) xobj).asNodeIterator();
             }
  -          else if (javaClass == NodeList.class)
  -          {
  -            return ((XRTreeFrag) xobj).convertToNodeset();
  -          }
  +          // %TBD%
  +//          else if (javaClass == NodeList.class)
  +//          {
  +//            return ((XRTreeFrag) xobj).convertToNodeset();
  +//          }
             // Same comment as above
             // else if(Node.class.isAssignableFrom(javaClass))
  -          else if(javaClass == Node.class)
  -          {
  -            return xobj.rtree().getFirstChild();
  -          }
  +          // %TBD%
  +//          else if(javaClass == Node.class)
  +//          {
  +//            return xobj.rtree().getFirstChild();
  +//          }
             else if(javaClass == java.lang.String.class)
             {
               return xobj.str();
  @@ -754,14 +756,15 @@
             {
               return convertDoubleToNumber(xobj.num(), javaClass);
             }
  -          else
  -          {
  -            Node child = xobj.rtree().getFirstChild();
  -            if(javaClass.isAssignableFrom(child.getClass()))
  -              return child;
  -            else
  -              return null;
  -          }
  +          // %TBD%
  +//          else
  +//          {
  +//            Node child = xobj.rtree().getFirstChild();
  +//            if(javaClass.isAssignableFrom(child.getClass()))
  +//              return child;
  +//            else
  +//              return null;
  +//          }
           }
           // break; Unreachable
           
  @@ -790,8 +793,9 @@
             {
               // Xalan ensures that nodeset() always returns an
               // iterator positioned at the beginning.
  -            NodeIterator ni = xobj.nodeset();
  -            return ni.nextNode(); // may be null.
  +            // %TBD%
  +//            NodeIterator ni = xobj.nodeset();
  +//            return ni.nextNode(); // may be null.
             }
             else if(javaClass == java.lang.String.class)
             {
  @@ -804,15 +808,16 @@
             else if(javaClass.isPrimitive())
             {
               return convertDoubleToNumber(xobj.num(), javaClass);
  -          }
  -          else
  -          {
  -            Node child = xobj.nodeset().nextNode();
  -            if(javaClass.isAssignableFrom(child.getClass()))
  -              return child;
  -            else
  -              return null;
             }
  +          // %TBD%
  +//          else
  +//          {
  +//            Node child = xobj.nodeset().nextNode();
  +//            if(javaClass.isAssignableFrom(child.getClass()))
  +//              return child;
  +//            else
  +//              return null;
  +//          }
           }
           // break; Unreachable
           
  
  
  
  1.8.2.1   +95 -89    xml-xalan/java/src/org/apache/xalan/extensions/XSLProcessorContext.java
  
  Index: XSLProcessorContext.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/extensions/XSLProcessorContext.java,v
  retrieving revision 1.8
  retrieving revision 1.8.2.1
  diff -u -r1.8 -r1.8.2.1
  --- XSLProcessorContext.java	2000/12/14 16:57:27	1.8
  +++ XSLProcessorContext.java	2001/04/10 18:44:38	1.8.2.1
  @@ -56,9 +56,11 @@
    */
   package org.apache.xalan.extensions;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.DocumentFragment;
  -import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.DocumentFragment;
  +//import org.w3c.dom.traversal.NodeIterator;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
   
   import org.apache.xalan.transformer.TransformerImpl;
   import org.apache.xalan.transformer.ResultTreeHandler;
  @@ -97,15 +99,15 @@
      * @param mode the current mode being executed.
      */
     public XSLProcessorContext(TransformerImpl transformer,
  -                             Stylesheet stylesheetTree, Node sourceTree,
  -                             Node sourceNode, QName mode)
  +                             Stylesheet stylesheetTree)
     {
   
       this.transformer = transformer;
       this.stylesheetTree = stylesheetTree;
  -    this.mode = mode;
  -    this.sourceTree = sourceTree;
  -    this.sourceNode = sourceNode;
  +    // %TBD%
  +//    this.mode = mode;
  +//    this.sourceTree = sourceTree;
  +//    this.sourceNode = sourceNode;
     }
   
     /** An instance of a transformer          */
  @@ -135,30 +137,32 @@
     }
   
     /**  The root of the source tree being executed.        */
  -  private Node sourceTree;
  +  private int sourceTree;
   
  -  /**
  -   * Get the root of the source tree being executed.
  -   *
  -   * @return the root of the source tree being executed.
  -   */
  -  public Node getSourceTree()
  -  {
  -    return sourceTree;
  -  }
  +  // %TBD%
  +//  /**
  +//   * Get the root of the source tree being executed.
  +//   *
  +//   * @return the root of the source tree being executed.
  +//   */
  +//  public Node getSourceTree()
  +//  {
  +//    return sourceTree;
  +//  }
   
     /** the current context node.          */
  -  private Node sourceNode;
  +  private int sourceNode;
   
  -  /**
  -   * Get the current context node.
  -   *
  -   * @return the current context node.
  -   */
  -  public Node getContextNode()
  -  {
  -    return sourceNode;
  -  }
  +  // %TBD%
  +//  /**
  +//   * Get the current context node.
  +//   *
  +//   * @return the current context node.
  +//   */
  +//  public Node getContextNode()
  +//  {
  +//    return sourceNode;
  +//  }
   
     /** the current mode being executed.         */
     private QName mode;
  @@ -216,19 +220,20 @@
         else if (obj instanceof Double)
         {
           value = new XNumber(((Double) obj).doubleValue());
  -      }
  -      else if (obj instanceof DocumentFragment)
  -      {
  -        value = new XRTreeFrag((DocumentFragment) obj);
  -      }
  -      else if (obj instanceof Node)
  -      {
  -        value = new XNodeSet((Node) obj);
  -      }
  -      else if (obj instanceof NodeIterator)
  -      {
  -        value = new XNodeSet((NodeIterator) obj);
         }
  +      // %TDM%
  +//      else if (obj instanceof DocumentFragment)
  +//      {
  +//        value = new XRTreeFrag((DocumentFragment) obj);
  +//      }
  +//      else if (obj instanceof Node)
  +//      {
  +//        value = new XNodeSet((Node) obj);
  +//      }
  +//      else if (obj instanceof NodeIterator)
  +//      {
  +//        value = new XNodeSet((NodeIterator) obj);
  +//      }
         else
         {
           value = new XString(obj.toString());
  @@ -245,56 +250,57 @@
           s = value.str();
   
           rtreeHandler.characters(s.toCharArray(), 0, s.length());
  -        break;
  -      case XObject.CLASS_NODESET :  // System.out.println(value);
  -        NodeIterator nl = value.nodeset();
  -        Node pos;
  -
  -        while (null != (pos = nl.nextNode()))
  -        {
  -          Node top = pos;
  -
  -          while (null != pos)
  -          {
  -            rtreeHandler.flushPending();
  -            rtreeHandler.cloneToResultTree(pos, true);
  -
  -            Node nextNode = pos.getFirstChild();
  -
  -            while (null == nextNode)
  -            {
  -              if (Node.ELEMENT_NODE == pos.getNodeType())
  -              {
  -                rtreeHandler.endElement("", "", pos.getNodeName());
  -              }
  -
  -              if (top == pos)
  -                break;
  -
  -              nextNode = pos.getNextSibling();
  -
  -              if (null == nextNode)
  -              {
  -                pos = pos.getParentNode();
  -
  -                if (top == pos)
  -                {
  -                  if (Node.ELEMENT_NODE == pos.getNodeType())
  -                  {
  -                    rtreeHandler.endElement("", "", pos.getNodeName());
  -                  }
  -
  -                  nextNode = null;
  -
  -                  break;
  -                }
  -              }
  -            }
  -
  -            pos = nextNode;
  -          }
  -        }
           break;
  +        // %TBD%
  +//      case XObject.CLASS_NODESET :  // System.out.println(value);
  +//        DTMIterator nl = value.nodeset();
  +//        int pos;
  +//
  +//        while (DTM.NULL != (pos = nl.nextNode()))
  +//        {
  +//          int top = pos;
  +//
  +//          while (null != pos)
  +//          {
  +//            rtreeHandler.flushPending();
  +//            rtreeHandler.cloneToResultTree(pos, true);
  +//
  +//            Node nextNode = pos.getFirstChild();
  +//
  +//            while (null == nextNode)
  +//            {
  +//              if (Node.ELEMENT_NODE == pos.getNodeType())
  +//              {
  +//                rtreeHandler.endElement("", "", pos.getNodeName());
  +//              }
  +//
  +//              if (top == pos)
  +//                break;
  +//
  +//              nextNode = pos.getNextSibling();
  +//
  +//              if (null == nextNode)
  +//              {
  +//                pos = pos.getParentNode();
  +//
  +//                if (top == pos)
  +//                {
  +//                  if (Node.ELEMENT_NODE == pos.getNodeType())
  +//                  {
  +//                    rtreeHandler.endElement("", "", pos.getNodeName());
  +//                  }
  +//
  +//                  nextNode = null;
  +//
  +//                  break;
  +//                }
  +//              }
  +//            }
  +//
  +//            pos = nextNode;
  +//          }
  +//        }
  +//        break;
         case XObject.CLASS_RTREEFRAG :
           rtreeHandler.outputResultTreeFragment(value,
                                                 transformer.getXPathContext());
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.9.2.1   +229 -229  xml-xalan/java/src/org/apache/xalan/lib/Extensions.java
  
  Index: Extensions.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/lib/Extensions.java,v
  retrieving revision 1.9
  retrieving revision 1.9.2.1
  diff -u -r1.9 -r1.9.2.1
  --- Extensions.java	2001/02/21 08:23:14	1.9
  +++ Extensions.java	2001/04/10 18:44:40	1.9.2.1
  @@ -89,234 +89,234 @@
   
     private Extensions() {}	// Make sure class cannot be instantiated
   
  -  /**
  -   * This method is an extension that implements as a Xalan extension
  -   * the node-set function also found in xt and saxon.
  -   * If the argument is a Result Tree Fragment, then <code>nodeset</code>
  -   * returns a node-set consisting of a single root node as described in
  -   * section 11.1 of the XSLT 1.0 Recommendation.  If the argument is a 
  -   * node-set, <code>nodeset</code> returns a node-set.  If the argument
  -   * is a string, number, or boolean, then <code>nodeset</code> returns
  -   * a node-set consisting of a single root node with a single text node
  -   * child that is the result of calling the XPath string() function on the 
  -   * passed parameter.  If the argument is anything else, then a node-set
  -   * is returned consisting of a single root node with a single text node
  -   * child that is the result of calling the java <code>toString()</code>
  -   * method on the passed argument.
  -   * Most of the
  -   * actual work here is done in <code>MethodResolver</code> and
  -   * <code>XRTreeFrag</code>.
  -   * @param myProcessor Context passed by the extension processor
  -   * @param rtf Argument in the stylesheet to the nodeset extension function
  -   */
  -
  -  public static NodeSet nodeset(ExpressionContext myProcessor, Object rtf) {
  -
  -    String textNodeValue;
  -
  -    if (rtf instanceof NodeIterator)
  -    {
  -      return new NodeSet((NodeIterator) rtf);
  -    }
  -    else
  -    {
  -      if (rtf instanceof String)
  -      {
  -        textNodeValue = (String) rtf;
  -      }
  -      else if (rtf instanceof Boolean)
  -      {
  -        textNodeValue = new XBoolean(((Boolean) rtf).booleanValue()).str();
  -      }
  -      else if (rtf instanceof Double)
  -      {
  -        textNodeValue = new XNumber(((Double) rtf).doubleValue()).str();
  -      }
  -      else
  -      {
  -        textNodeValue = rtf.toString();
  -      }
  -      Document myDoc = myProcessor.getContextNode().getOwnerDocument();
  -      Text textNode = myDoc.createTextNode(textNodeValue);
  -      DocumentFragment docFrag = myDoc.createDocumentFragment();
  -      docFrag.appendChild(textNode);
  -      return new NodeSet(docFrag);
  -    }
  -  }
  -  
  -	/**
  -	 * Returns the intersection of two node-sets.
  -	 * @param n1 NodeIterator for first node-set
  -	 * @param ni2 NodeIterator for second node-set
  -	 * @return a NodeSet containing the nodes in ni1 that are also
  -	 * in ni2
  -	 */	
  -	public static NodeSet intersection(NodeIterator ni1, NodeIterator ni2)
  -			throws javax.xml.transform.TransformerException
  -	{
  -		NodeSet ns1 = new NodeSet(ni1);
  -		NodeSet ns2 = new NodeSet(ni2);
  -		NodeSet inter= new NodeSet();
  -		inter.setShouldCacheNodes(true);
  -		for (int i=0; i < ns1.getLength(); i++)
  -		{
  -			Node n = ns1.elementAt(i);
  -			if(ns2.contains(n))
  -				inter.addElement(n);
  -		}
  -		return inter;
  -	}
  -	
  -	/**
  -	 * Returns the difference between two node-sets.
  -	 * @param n1 NodeIterator for first node-set
  -	 * @param ni2 NodeIterator for second node-set
  -	 * @return a NodeSet containing the nodes in ni1 that are not
  -	 * in ni2
  -	 */	
  -	public static NodeSet difference(NodeIterator ni1, NodeIterator ni2)
  -			throws javax.xml.transform.TransformerException	
  -	{
  -		NodeSet ns1 = new NodeSet(ni1);
  -		NodeSet ns2 = new NodeSet(ni2);
  -		// NodeSet inter= new NodeSet();
  -		NodeSet diff = new NodeSet();
  -		diff.setShouldCacheNodes(true);		
  -		for (int i = 0; i < ns1.getLength(); i++)
  -		{
  -			Node n = ns1.elementAt(i);
  -			if(!ns2.contains(n))
  -				diff.addElement(n);
  -		}
  -		return diff;
  -	}
  -
  -	/**
  -	 * Returns node-set containing distinct string values.
  -	 * @param ni NodeIterator for node-set
  -	 * @return a NodeSet with nodes from ni containing distinct string values. 
  -	 * In other words, if more than one node in ni contains the same string value, 
  -	 * only include the first such node found.
  -	 */	
  -	public static NodeSet distinct(NodeIterator ni)
  -			throws javax.xml.transform.TransformerException	
  -	{
  -		NodeSet ns = new NodeSet(ni);
  -		NodeSet dist = new NodeSet();
  -		dist.setShouldCacheNodes(true);		
  -		Hashtable stringTable = new Hashtable();
  -		for (int i = 0; i < ns.getLength(); i++)
  -		{
  -			Node n = ns.elementAt(i);
  -      String key = DOMHelper.getNodeData(n);
  -      if (!stringTable.containsKey(key))
  -			{
  -        stringTable.put(key, n);
  -        dist.addElement(n);
  -			}
  -		}
  -		return dist;
  -	}
  -
  -	/**
  -	 * Returns true of both node-sets contain the same set of nodes.
  -	 * @param n1 NodeIterator for first node-set
  -	 * @param ni2 NodeIterator for second node-set
  -	 * @return true if ni1 and ni2 contain exactly the same set of nodes.
  -	 */	
  -	public static boolean hasSameNodes(NodeIterator ni1, NodeIterator ni2)
  -	{
  -		NodeSet ns1 = new NodeSet(ni1);
  -		NodeSet ns2 = new NodeSet(ni2);		
  -		if (ns1.getLength() != ns2.getLength())
  -			return false;
  -		for (int i = 0; i < ns1.getLength(); i++)
  -		{
  -			Node n = ns1.elementAt(i);
  -			if(!ns2.contains(n))
  -				return false;
  -		}
  -		return true;
  -	}  
  -
  -	/**
  -	 * Returns the result of evaluating the argument as a string containing
  -   * an XPath expression.  Used where the XPath expression is not known until
  -   * run-time.  The expression is evaluated as if the run-time value of the
  -   * argument appeared in place of the evaluate function call at compile time.
  -	 * @param myContext an <code>ExpressionContext</code> passed in by the
  -   *                  extension mechanism.  This must be an XPathContext.
  -	 * @param xpathExtr The XPath expression to be evaluated.
  -	 * @return the XObject resulting from evaluating the XPath
  -	 */	
  -	public static XObject evaluate(ExpressionContext myContext, String xpathExpr)
  -                  throws SAXNotSupportedException, Exception
  -	{
  -    if (myContext instanceof XPathContext)
  -    {
  -      try
  -      {
  -        XPathContext xctxt = (XPathContext) myContext;
  -        XPath dynamicXPath = new XPath(xpathExpr,
  -                                  xctxt.getSAXLocator(),
  -                                  xctxt.getNamespaceContext(),
  -                                  XPath.SELECT);
  -        return dynamicXPath.execute(xctxt,
  -                                    myContext.getContextNode(),
  -                                    xctxt.getNamespaceContext());
  -      }
  -      catch (Exception e)
  -      {
  -        throw e;
  -      }
  -    }
  -    else
  -      throw new SAXNotSupportedException("Invalid context passed to evaluate " + myContext);
  -	}  
  -
  -	/**
  -	 * Returns a NodeSet containing one text node for each token in the first argument.
  -   * Delimiters are specified in the second argument.
  -   * Tokens are determined by a call to <code>StringTokenizer</code>.
  -   * If the first argument is an empty string or contains only delimiters, the result
  -   * will be an empty NodeSet.
  -   * Contributed to XalanJ1 by <a href="mailto:benoit.cerrina@writeme.com">Benoit Cerrina</a>.  
  -	 * @param myContext an <code>ExpressionContext</code> passed in by the
  -   *                  extension mechanism.  This must be an XPathContext.
  -	 * @param toTokenize The string to be split into text tokens.
  -   * @param delims The delimiters to use.
  -	 * @return a NodeSet as described above.
  -   *
  -	 */	
  -	public static NodeSet tokenize(ExpressionContext myContext, String toTokenize, String delims)
  -	{
  -    Document lDoc = myContext.getContextNode().getOwnerDocument();
  -    StringTokenizer lTokenizer = new StringTokenizer(toTokenize, delims);
  -    NodeSet resultSet = new NodeSet();
  -    while (lTokenizer.hasMoreTokens())
  -    {
  -      resultSet.addNode(lDoc.createTextNode(lTokenizer.nextToken()));
  -    }
  -    return resultSet;
  -}  
  -
  -	/**
  -	 * Returns a NodeSet containing one text node for each token in the first argument.
  -   * Delimiters are whitespace.  That is, the delimiters that are used are tab (&#x09),
  -   * linefeed (&#x0A), return (&#x0D), and space (&#x20).
  -   * Tokens are determined by a call to <code>StringTokenizer</code>.
  -   * If the first argument is an empty string or contains only delimiters, the result
  -   * will be an empty NodeSet.
  -   * Contributed to XalanJ1 by <a href="mailto:benoit.cerrina@writeme.com">Benoit Cerrina</a>.  
  -	 * @param myContext an <code>ExpressionContext</code> passed in by the
  -   *                  extension mechanism.  This must be an XPathContext.
  -	 * @param toTokenize The string to be split into text tokens.
  -	 * @return a NodeSet as described above.
  -   *
  -	 */	
  -	public static NodeSet tokenize(ExpressionContext myContext, String toTokenize)
  -	{
  -    return tokenize(myContext, toTokenize, " \t\n\r");
  -  }  
  +//  /**
  +//   * This method is an extension that implements as a Xalan extension
  +//   * the node-set function also found in xt and saxon.
  +//   * If the argument is a Result Tree Fragment, then <code>nodeset</code>
  +//   * returns a node-set consisting of a single root node as described in
  +//   * section 11.1 of the XSLT 1.0 Recommendation.  If the argument is a 
  +//   * node-set, <code>nodeset</code> returns a node-set.  If the argument
  +//   * is a string, number, or boolean, then <code>nodeset</code> returns
  +//   * a node-set consisting of a single root node with a single text node
  +//   * child that is the result of calling the XPath string() function on the 
  +//   * passed parameter.  If the argument is anything else, then a node-set
  +//   * is returned consisting of a single root node with a single text node
  +//   * child that is the result of calling the java <code>toString()</code>
  +//   * method on the passed argument.
  +//   * Most of the
  +//   * actual work here is done in <code>MethodResolver</code> and
  +//   * <code>XRTreeFrag</code>.
  +//   * @param myProcessor Context passed by the extension processor
  +//   * @param rtf Argument in the stylesheet to the nodeset extension function
  +//   */
  +//
  +//  public static NodeSet nodeset(ExpressionContext myProcessor, Object rtf) {
  +//
  +//    String textNodeValue;
  +//
  +//    if (rtf instanceof NodeIterator)
  +//    {
  +//      return new NodeSet((NodeIterator) rtf);
  +//    }
  +//    else
  +//    {
  +//      if (rtf instanceof String)
  +//      {
  +//        textNodeValue = (String) rtf;
  +//      }
  +//      else if (rtf instanceof Boolean)
  +//      {
  +//        textNodeValue = new XBoolean(((Boolean) rtf).booleanValue()).str();
  +//      }
  +//      else if (rtf instanceof Double)
  +//      {
  +//        textNodeValue = new XNumber(((Double) rtf).doubleValue()).str();
  +//      }
  +//      else
  +//      {
  +//        textNodeValue = rtf.toString();
  +//      }
  +//      Document myDoc = myProcessor.getContextNode().getOwnerDocument();
  +//      Text textNode = myDoc.createTextNode(textNodeValue);
  +//      DocumentFragment docFrag = myDoc.createDocumentFragment();
  +//      docFrag.appendChild(textNode);
  +//      return new NodeSet(docFrag);
  +//    }
  +//  }
  +//  
  +//	/**
  +//	 * Returns the intersection of two node-sets.
  +//	 * @param n1 NodeIterator for first node-set
  +//	 * @param ni2 NodeIterator for second node-set
  +//	 * @return a NodeSet containing the nodes in ni1 that are also
  +//	 * in ni2
  +//	 */	
  +//	public static NodeSet intersection(NodeIterator ni1, NodeIterator ni2)
  +//			throws javax.xml.transform.TransformerException
  +//	{
  +//		NodeSet ns1 = new NodeSet(ni1);
  +//		NodeSet ns2 = new NodeSet(ni2);
  +//		NodeSet inter= new NodeSet();
  +//		inter.setShouldCacheNodes(true);
  +//		for (int i=0; i < ns1.getLength(); i++)
  +//		{
  +//			Node n = ns1.elementAt(i);
  +//			if(ns2.contains(n))
  +//				inter.addElement(n);
  +//		}
  +//		return inter;
  +//	}
  +//	
  +//	/**
  +//	 * Returns the difference between two node-sets.
  +//	 * @param n1 NodeIterator for first node-set
  +//	 * @param ni2 NodeIterator for second node-set
  +//	 * @return a NodeSet containing the nodes in ni1 that are not
  +//	 * in ni2
  +//	 */	
  +//	public static NodeSet difference(NodeIterator ni1, NodeIterator ni2)
  +//			throws javax.xml.transform.TransformerException	
  +//	{
  +//		NodeSet ns1 = new NodeSet(ni1);
  +//		NodeSet ns2 = new NodeSet(ni2);
  +//		// NodeSet inter= new NodeSet();
  +//		NodeSet diff = new NodeSet();
  +//		diff.setShouldCacheNodes(true);		
  +//		for (int i = 0; i < ns1.getLength(); i++)
  +//		{
  +//			Node n = ns1.elementAt(i);
  +//			if(!ns2.contains(n))
  +//				diff.addElement(n);
  +//		}
  +//		return diff;
  +//	}
  +//
  +//	/**
  +//	 * Returns node-set containing distinct string values.
  +//	 * @param ni NodeIterator for node-set
  +//	 * @return a NodeSet with nodes from ni containing distinct string values. 
  +//	 * In other words, if more than one node in ni contains the same string value, 
  +//	 * only include the first such node found.
  +//	 */	
  +//	public static NodeSet distinct(NodeIterator ni)
  +//			throws javax.xml.transform.TransformerException	
  +//	{
  +//		NodeSet ns = new NodeSet(ni);
  +//		NodeSet dist = new NodeSet();
  +//		dist.setShouldCacheNodes(true);		
  +//		Hashtable stringTable = new Hashtable();
  +//		for (int i = 0; i < ns.getLength(); i++)
  +//		{
  +//			Node n = ns.elementAt(i);
  +//      String key = DOMHelper.getNodeData(n);
  +//      if (!stringTable.containsKey(key))
  +//			{
  +//        stringTable.put(key, n);
  +//        dist.addElement(n);
  +//			}
  +//		}
  +//		return dist;
  +//	}
  +//
  +//	/**
  +//	 * Returns true of both node-sets contain the same set of nodes.
  +//	 * @param n1 NodeIterator for first node-set
  +//	 * @param ni2 NodeIterator for second node-set
  +//	 * @return true if ni1 and ni2 contain exactly the same set of nodes.
  +//	 */	
  +//	public static boolean hasSameNodes(NodeIterator ni1, NodeIterator ni2)
  +//	{
  +//		NodeSet ns1 = new NodeSet(ni1);
  +//		NodeSet ns2 = new NodeSet(ni2);		
  +//		if (ns1.getLength() != ns2.getLength())
  +//			return false;
  +//		for (int i = 0; i < ns1.getLength(); i++)
  +//		{
  +//			Node n = ns1.elementAt(i);
  +//			if(!ns2.contains(n))
  +//				return false;
  +//		}
  +//		return true;
  +//	}  
  +//
  +//	/**
  +//	 * Returns the result of evaluating the argument as a string containing
  +//   * an XPath expression.  Used where the XPath expression is not known until
  +//   * run-time.  The expression is evaluated as if the run-time value of the
  +//   * argument appeared in place of the evaluate function call at compile time.
  +//	 * @param myContext an <code>ExpressionContext</code> passed in by the
  +//   *                  extension mechanism.  This must be an XPathContext.
  +//	 * @param xpathExtr The XPath expression to be evaluated.
  +//	 * @return the XObject resulting from evaluating the XPath
  +//	 */	
  +//	public static XObject evaluate(ExpressionContext myContext, String xpathExpr)
  +//                  throws SAXNotSupportedException, Exception
  +//	{
  +//    if (myContext instanceof XPathContext)
  +//    {
  +//      try
  +//      {
  +//        XPathContext xctxt = (XPathContext) myContext;
  +//        XPath dynamicXPath = new XPath(xpathExpr,
  +//                                  xctxt.getSAXLocator(),
  +//                                  xctxt.getNamespaceContext(),
  +//                                  XPath.SELECT);
  +//        return dynamicXPath.execute(xctxt,
  +//                                    myContext.getContextNode(),
  +//                                    xctxt.getNamespaceContext());
  +//      }
  +//      catch (Exception e)
  +//      {
  +//        throw e;
  +//      }
  +//    }
  +//    else
  +//      throw new SAXNotSupportedException("Invalid context passed to evaluate " + myContext);
  +//	}  
  +//
  +//	/**
  +//	 * Returns a NodeSet containing one text node for each token in the first argument.
  +//   * Delimiters are specified in the second argument.
  +//   * Tokens are determined by a call to <code>StringTokenizer</code>.
  +//   * If the first argument is an empty string or contains only delimiters, the result
  +//   * will be an empty NodeSet.
  +//   * Contributed to XalanJ1 by <a href="mailto:benoit.cerrina@writeme.com">Benoit Cerrina</a>.  
  +//	 * @param myContext an <code>ExpressionContext</code> passed in by the
  +//   *                  extension mechanism.  This must be an XPathContext.
  +//	 * @param toTokenize The string to be split into text tokens.
  +//   * @param delims The delimiters to use.
  +//	 * @return a NodeSet as described above.
  +//   *
  +//	 */	
  +//	public static NodeSet tokenize(ExpressionContext myContext, String toTokenize, String delims)
  +//	{
  +//    Document lDoc = myContext.getContextNode().getOwnerDocument();
  +//    StringTokenizer lTokenizer = new StringTokenizer(toTokenize, delims);
  +//    NodeSet resultSet = new NodeSet();
  +//    while (lTokenizer.hasMoreTokens())
  +//    {
  +//      resultSet.addNode(lDoc.createTextNode(lTokenizer.nextToken()));
  +//    }
  +//    return resultSet;
  +//}  
  +//
  +//	/**
  +//	 * Returns a NodeSet containing one text node for each token in the first argument.
  +//   * Delimiters are whitespace.  That is, the delimiters that are used are tab (&#x09),
  +//   * linefeed (&#x0A), return (&#x0D), and space (&#x20).
  +//   * Tokens are determined by a call to <code>StringTokenizer</code>.
  +//   * If the first argument is an empty string or contains only delimiters, the result
  +//   * will be an empty NodeSet.
  +//   * Contributed to XalanJ1 by <a href="mailto:benoit.cerrina@writeme.com">Benoit Cerrina</a>.  
  +//	 * @param myContext an <code>ExpressionContext</code> passed in by the
  +//   *                  extension mechanism.  This must be an XPathContext.
  +//	 * @param toTokenize The string to be split into text tokens.
  +//	 * @return a NodeSet as described above.
  +//   *
  +//	 */	
  +//	public static NodeSet tokenize(ExpressionContext myContext, String toTokenize)
  +//	{
  +//    return tokenize(myContext, toTokenize, " \t\n\r");
  +//  }  
   
   }
  
  
  
  1.12.2.1  +268 -268  xml-xalan/java/src/org/apache/xalan/lib/Redirect.java
  
  Index: Redirect.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/lib/Redirect.java,v
  retrieving revision 1.12
  retrieving revision 1.12.2.1
  diff -u -r1.12 -r1.12.2.1
  --- Redirect.java	2001/03/13 22:01:51	1.12
  +++ Redirect.java	2001/04/10 18:44:40	1.12.2.1
  @@ -154,272 +154,272 @@
      */
     protected Hashtable m_outputStreams = new Hashtable ();
   
  -  /**
  -   * Open the given file and put it in the XML, HTML, or Text formatter listener's table.
  -   */
  -  public void open(XSLProcessorContext context, ElemExtensionCall elem)
  -    throws java.net.MalformedURLException,
  -           java.io.FileNotFoundException,
  -           java.io.IOException,
  -           javax.xml.transform.TransformerException
  -  {
  -    String fileName = getFilename(context, elem);
  -    Object flistener = m_formatterListeners.get(fileName);
  -    if(null == flistener)
  -    {
  -      String mkdirsExpr 
  -        = elem.getAttribute ("mkdirs", context.getContextNode(), 
  -                                                  context.getTransformer());
  -      boolean mkdirs = (mkdirsExpr != null)
  -                       ? (mkdirsExpr.equals("true") || mkdirsExpr.equals("yes")) : true;
  -          // ContentHandler fl = 
  -          makeFormatterListener(context, elem, fileName, true, mkdirs);
  -          // fl.startDocument();
  -    }
  -  }
  -  
  -  /**
  -   * Write the evalutation of the element children to the given file. Then close the file
  -   * unless it was opened with the open extension element and is in the formatter listener's table.
  -   */
  -  public void write(XSLProcessorContext context, ElemExtensionCall elem)
  -    throws java.net.MalformedURLException,
  -           java.io.FileNotFoundException,
  -           java.io.IOException,
  -           javax.xml.transform.TransformerException
  -  {
  -    String fileName = getFilename(context, elem);
  -    Object flObject = m_formatterListeners.get(fileName);
  -    ContentHandler formatter;
  -    boolean inTable = false;
  -    if(null == flObject)
  -    {
  -      String mkdirsExpr 
  -        = ((ElemExtensionCall)elem).getAttribute ("mkdirs", 
  -                                                  context.getContextNode(), 
  -                                                  context.getTransformer());
  -      boolean mkdirs = (mkdirsExpr != null)
  -                       ? (mkdirsExpr.equals("true") || mkdirsExpr.equals("yes")) : true;
  -      formatter = makeFormatterListener(context, elem, fileName, true, mkdirs);
  -    }
  -    else
  -    {
  -      inTable = true;
  -      formatter = (ContentHandler)flObject;
  -    }
  -    
  -    TransformerImpl transf = context.getTransformer();
  -    
  -    transf.executeChildTemplates(elem,
  -                                 context.getContextNode(),
  -                                 context.getMode(), formatter);
  -    
  -    if(!inTable)
  -    {
  -      OutputStream ostream = (OutputStream)m_outputStreams.get(fileName);
  -      if(null != ostream)
  -      {
  -        try
  -        {
  -          formatter.endDocument();
  -        }
  -        catch(org.xml.sax.SAXException se)
  -        {
  -          throw new TransformerException(se);
  -        }
  -        ostream.close();
  -        m_outputStreams.remove(fileName);
  -        m_formatterListeners.remove(fileName);
  -      }
  -    }
  -  }
  -
  -
  -  /**
  -   * Close the given file and remove it from the formatter listener's table.
  -   */
  -  public void close(XSLProcessorContext context, ElemExtensionCall elem)
  -    throws java.net.MalformedURLException,
  -    java.io.FileNotFoundException,
  -    java.io.IOException,
  -    javax.xml.transform.TransformerException
  -  {
  -    String fileName = getFilename(context, elem);
  -    Object formatterObj = m_formatterListeners.get(fileName);
  -    if(null != formatterObj)
  -    {
  -      ContentHandler fl = (ContentHandler)formatterObj;
  -      try
  -      {
  -        fl.endDocument();
  -      }
  -      catch(org.xml.sax.SAXException se)
  -      {
  -        throw new TransformerException(se);
  -      }
  -      OutputStream ostream = (OutputStream)m_outputStreams.get(fileName);
  -      if(null != ostream)
  -      {
  -        ostream.close();
  -        m_outputStreams.remove(fileName);
  -      }
  -      m_formatterListeners.remove(fileName);
  -    }
  -  }
  -
  -  /**
  -   * Get the filename from the 'select' or the 'file' attribute.
  -   */
  -  private String getFilename(XSLProcessorContext context, ElemExtensionCall elem)
  -    throws java.net.MalformedURLException,
  -    java.io.FileNotFoundException,
  -    java.io.IOException,
  -    javax.xml.transform.TransformerException
  -  {
  -    String fileName;
  -    String fileNameExpr 
  -      = ((ElemExtensionCall)elem).getAttribute ("select", 
  -                                                context.getContextNode(), 
  -                                                context.getTransformer());
  -    if(null != fileNameExpr)
  -    {
  -      org.apache.xpath.XPathContext xctxt 
  -        = context.getTransformer().getXPathContext();
  -      XPath myxpath = new XPath(fileNameExpr, elem, xctxt.getNamespaceContext(), XPath.SELECT);
  -      XObject xobj = myxpath.execute(xctxt, context.getContextNode(), xctxt.getNamespaceContext());
  -      fileName = xobj.str();
  -      if((null == fileName) || (fileName.length() == 0))
  -      {
  -        fileName = elem.getAttribute ("file", 
  -                                      context.getContextNode(), 
  -                                      context.getTransformer());
  -      }
  -    }
  -    else
  -    {
  -      fileName = elem.getAttribute ("file", context.getContextNode(), 
  -                                                               context.getTransformer());
  -    }
  -    if(null == fileName)
  -    {
  -      context.getTransformer().getMsgMgr().error(elem, elem, 
  -                                     context.getContextNode(), 
  -                                     XSLTErrorResources.ER_REDIRECT_COULDNT_GET_FILENAME);
  -                              //"Redirect extension: Could not get filename - file or select attribute must return vald string.");
  -    }
  -    return fileName;
  -  }
  -  
  -  // yuck.
  -  private String urlToFileName(String base)
  -  {
  -    if(null != base)
  -    {
  -      if(base.startsWith("file:////"))
  -      {
  -        base = base.substring(7);
  -      }
  -      else if(base.startsWith("file:///"))
  -      {
  -        base = base.substring(6);
  -      }
  -      else if(base.startsWith("file://"))
  -      {
  -        base = base.substring(5); // absolute?
  -      }
  -      else if(base.startsWith("file:/"))
  -      {
  -        base = base.substring(5);
  -      }
  -      else if(base.startsWith("file:"))
  -      {
  -        base = base.substring(4);
  -      }
  -    }
  -    return base;
  -  }
  -
  -  /**
  -   * Create a new ContentHandler, based on attributes of the current ContentHandler.
  -   */
  -  private ContentHandler makeFormatterListener(XSLProcessorContext context,
  -                                               ElemExtensionCall elem,
  -                                               String fileName,
  -                                               boolean shouldPutInTable,
  -                                               boolean mkdirs)
  -    throws java.net.MalformedURLException,
  -    java.io.FileNotFoundException,
  -    java.io.IOException,
  -    javax.xml.transform.TransformerException
  -  {
  -    File file = new File(fileName);
  -    TransformerImpl transformer = context.getTransformer();
  -    String base;          // Base URI to use for relative paths
  -
  -    if(!file.isAbsolute())
  -    {
  -      // This code is attributed to Jon Grov <jo...@linpro.no>.  A relative file name
  -      // is relative to the Result used to kick off the transform.  If no such
  -      // Result was supplied, the filename is relative to the source document.
  -      // When transforming with a SAXResult or DOMResult, call
  -      // TransformerImpl.setOutputTarget() to set the desired Result base.
  -//      String base = urlToFileName(elem.getStylesheet().getSystemId());
  -
  -      Result outputTarget = transformer.getOutputTarget();
  -      if ( (null != outputTarget) && ((base = outputTarget.getSystemId()) != null) ) {
  -        base = urlToFileName(base);
  -      }
  -      else
  -      {
  -        base = urlToFileName(transformer.getBaseURLOfSource());
  -      }
  -
  -      if(null != base)
  -      {
  -        File baseFile = new File(base);
  -        file = new File(baseFile.getParent(), fileName);
  -      }
  -    }
  -
  -    if(mkdirs)
  -    {
  -      String dirStr = file.getParent();
  -      if((null != dirStr) && (dirStr.length() > 0))
  -      {
  -        File dir = new File(dirStr);
  -        dir.mkdirs();
  -      }
  -    }
  -
  -    // This should be worked on so that the output format can be 
  -    // defined by a first child of the redirect element.
  -    OutputProperties format = transformer.getOutputFormat();
  -
  -    FileOutputStream ostream = new FileOutputStream(file);
  -    
  -    try
  -    {
  -      ContentHandler flistener 
  -        = transformer.createResultContentHandler(new StreamResult(ostream), format);
  -      try
  -      {
  -        flistener.startDocument();
  -      }
  -      catch(org.xml.sax.SAXException se)
  -      {
  -        throw new TransformerException(se);
  -      }
  -      if(shouldPutInTable)
  -      {
  -        m_outputStreams.put(fileName, ostream);
  -        m_formatterListeners.put(fileName, flistener);
  -      }
  -      return flistener;
  -    }
  -    catch(TransformerException te)
  -    {
  -      throw new javax.xml.transform.TransformerException(te);
  -    }
  -    
  -  }
  +//  /**
  +//   * Open the given file and put it in the XML, HTML, or Text formatter listener's table.
  +//   */
  +//  public void open(XSLProcessorContext context, ElemExtensionCall elem)
  +//    throws java.net.MalformedURLException,
  +//           java.io.FileNotFoundException,
  +//           java.io.IOException,
  +//           javax.xml.transform.TransformerException
  +//  {
  +//    String fileName = getFilename(context, elem);
  +//    Object flistener = m_formatterListeners.get(fileName);
  +//    if(null == flistener)
  +//    {
  +//      String mkdirsExpr 
  +//        = elem.getAttribute ("mkdirs", context.getContextNode(), 
  +//                                                  context.getTransformer());
  +//      boolean mkdirs = (mkdirsExpr != null)
  +//                       ? (mkdirsExpr.equals("true") || mkdirsExpr.equals("yes")) : true;
  +//          // ContentHandler fl = 
  +//          makeFormatterListener(context, elem, fileName, true, mkdirs);
  +//          // fl.startDocument();
  +//    }
  +//  }
  +//  
  +//  /**
  +//   * Write the evalutation of the element children to the given file. Then close the file
  +//   * unless it was opened with the open extension element and is in the formatter listener's table.
  +//   */
  +//  public void write(XSLProcessorContext context, ElemExtensionCall elem)
  +//    throws java.net.MalformedURLException,
  +//           java.io.FileNotFoundException,
  +//           java.io.IOException,
  +//           javax.xml.transform.TransformerException
  +//  {
  +//    String fileName = getFilename(context, elem);
  +//    Object flObject = m_formatterListeners.get(fileName);
  +//    ContentHandler formatter;
  +//    boolean inTable = false;
  +//    if(null == flObject)
  +//    {
  +//      String mkdirsExpr 
  +//        = ((ElemExtensionCall)elem).getAttribute ("mkdirs", 
  +//                                                  context.getContextNode(), 
  +//                                                  context.getTransformer());
  +//      boolean mkdirs = (mkdirsExpr != null)
  +//                       ? (mkdirsExpr.equals("true") || mkdirsExpr.equals("yes")) : true;
  +//      formatter = makeFormatterListener(context, elem, fileName, true, mkdirs);
  +//    }
  +//    else
  +//    {
  +//      inTable = true;
  +//      formatter = (ContentHandler)flObject;
  +//    }
  +//    
  +//    TransformerImpl transf = context.getTransformer();
  +//    
  +//    transf.executeChildTemplates(elem,
  +//                                 context.getContextNode(),
  +//                                 context.getMode(), formatter);
  +//    
  +//    if(!inTable)
  +//    {
  +//      OutputStream ostream = (OutputStream)m_outputStreams.get(fileName);
  +//      if(null != ostream)
  +//      {
  +//        try
  +//        {
  +//          formatter.endDocument();
  +//        }
  +//        catch(org.xml.sax.SAXException se)
  +//        {
  +//          throw new TransformerException(se);
  +//        }
  +//        ostream.close();
  +//        m_outputStreams.remove(fileName);
  +//        m_formatterListeners.remove(fileName);
  +//      }
  +//    }
  +//  }
  +//
  +//
  +//  /**
  +//   * Close the given file and remove it from the formatter listener's table.
  +//   */
  +//  public void close(XSLProcessorContext context, ElemExtensionCall elem)
  +//    throws java.net.MalformedURLException,
  +//    java.io.FileNotFoundException,
  +//    java.io.IOException,
  +//    javax.xml.transform.TransformerException
  +//  {
  +//    String fileName = getFilename(context, elem);
  +//    Object formatterObj = m_formatterListeners.get(fileName);
  +//    if(null != formatterObj)
  +//    {
  +//      ContentHandler fl = (ContentHandler)formatterObj;
  +//      try
  +//      {
  +//        fl.endDocument();
  +//      }
  +//      catch(org.xml.sax.SAXException se)
  +//      {
  +//        throw new TransformerException(se);
  +//      }
  +//      OutputStream ostream = (OutputStream)m_outputStreams.get(fileName);
  +//      if(null != ostream)
  +//      {
  +//        ostream.close();
  +//        m_outputStreams.remove(fileName);
  +//      }
  +//      m_formatterListeners.remove(fileName);
  +//    }
  +//  }
  +//
  +//  /**
  +//   * Get the filename from the 'select' or the 'file' attribute.
  +//   */
  +//  private String getFilename(XSLProcessorContext context, ElemExtensionCall elem)
  +//    throws java.net.MalformedURLException,
  +//    java.io.FileNotFoundException,
  +//    java.io.IOException,
  +//    javax.xml.transform.TransformerException
  +//  {
  +//    String fileName;
  +//    String fileNameExpr 
  +//      = ((ElemExtensionCall)elem).getAttribute ("select", 
  +//                                                context.getContextNode(), 
  +//                                                context.getTransformer());
  +//    if(null != fileNameExpr)
  +//    {
  +//      org.apache.xpath.XPathContext xctxt 
  +//        = context.getTransformer().getXPathContext();
  +//      XPath myxpath = new XPath(fileNameExpr, elem, xctxt.getNamespaceContext(), XPath.SELECT);
  +//      XObject xobj = myxpath.execute(xctxt, context.getContextNode(), xctxt.getNamespaceContext());
  +//      fileName = xobj.str();
  +//      if((null == fileName) || (fileName.length() == 0))
  +//      {
  +//        fileName = elem.getAttribute ("file", 
  +//                                      context.getContextNode(), 
  +//                                      context.getTransformer());
  +//      }
  +//    }
  +//    else
  +//    {
  +//      fileName = elem.getAttribute ("file", context.getContextNode(), 
  +//                                                               context.getTransformer());
  +//    }
  +//    if(null == fileName)
  +//    {
  +//      context.getTransformer().getMsgMgr().error(elem, elem, 
  +//                                     context.getContextNode(), 
  +//                                     XSLTErrorResources.ER_REDIRECT_COULDNT_GET_FILENAME);
  +//                              //"Redirect extension: Could not get filename - file or select attribute must return vald string.");
  +//    }
  +//    return fileName;
  +//  }
  +//  
  +//  // yuck.
  +//  private String urlToFileName(String base)
  +//  {
  +//    if(null != base)
  +//    {
  +//      if(base.startsWith("file:////"))
  +//      {
  +//        base = base.substring(7);
  +//      }
  +//      else if(base.startsWith("file:///"))
  +//      {
  +//        base = base.substring(6);
  +//      }
  +//      else if(base.startsWith("file://"))
  +//      {
  +//        base = base.substring(5); // absolute?
  +//      }
  +//      else if(base.startsWith("file:/"))
  +//      {
  +//        base = base.substring(5);
  +//      }
  +//      else if(base.startsWith("file:"))
  +//      {
  +//        base = base.substring(4);
  +//      }
  +//    }
  +//    return base;
  +//  }
  +//
  +//  /**
  +//   * Create a new ContentHandler, based on attributes of the current ContentHandler.
  +//   */
  +//  private ContentHandler makeFormatterListener(XSLProcessorContext context,
  +//                                               ElemExtensionCall elem,
  +//                                               String fileName,
  +//                                               boolean shouldPutInTable,
  +//                                               boolean mkdirs)
  +//    throws java.net.MalformedURLException,
  +//    java.io.FileNotFoundException,
  +//    java.io.IOException,
  +//    javax.xml.transform.TransformerException
  +//  {
  +//    File file = new File(fileName);
  +//    TransformerImpl transformer = context.getTransformer();
  +//    String base;          // Base URI to use for relative paths
  +//
  +//    if(!file.isAbsolute())
  +//    {
  +//      // This code is attributed to Jon Grov <jo...@linpro.no>.  A relative file name
  +//      // is relative to the Result used to kick off the transform.  If no such
  +//      // Result was supplied, the filename is relative to the source document.
  +//      // When transforming with a SAXResult or DOMResult, call
  +//      // TransformerImpl.setOutputTarget() to set the desired Result base.
  +//  //      String base = urlToFileName(elem.getStylesheet().getSystemId());
  +//
  +//      Result outputTarget = transformer.getOutputTarget();
  +//      if ( (null != outputTarget) && ((base = outputTarget.getSystemId()) != null) ) {
  +//        base = urlToFileName(base);
  +//      }
  +//      else
  +//      {
  +//        base = urlToFileName(transformer.getBaseURLOfSource());
  +//      }
  +//
  +//      if(null != base)
  +//      {
  +//        File baseFile = new File(base);
  +//        file = new File(baseFile.getParent(), fileName);
  +//      }
  +//    }
  +//
  +//    if(mkdirs)
  +//    {
  +//      String dirStr = file.getParent();
  +//      if((null != dirStr) && (dirStr.length() > 0))
  +//      {
  +//        File dir = new File(dirStr);
  +//        dir.mkdirs();
  +//      }
  +//    }
  +//
  +//    // This should be worked on so that the output format can be 
  +//    // defined by a first child of the redirect element.
  +//    OutputProperties format = transformer.getOutputFormat();
  +//
  +//    FileOutputStream ostream = new FileOutputStream(file);
  +//    
  +//    try
  +//    {
  +//      ContentHandler flistener 
  +//        = transformer.createResultContentHandler(new StreamResult(ostream), format);
  +//      try
  +//      {
  +//        flistener.startDocument();
  +//      }
  +//      catch(org.xml.sax.SAXException se)
  +//      {
  +//        throw new TransformerException(se);
  +//      }
  +//      if(shouldPutInTable)
  +//      {
  +//        m_outputStreams.put(fileName, ostream);
  +//        m_formatterListeners.put(fileName, flistener);
  +//      }
  +//      return flistener;
  +//    }
  +//    catch(TransformerException te)
  +//    {
  +//      throw new javax.xml.transform.TransformerException(te);
  +//    }
  +//    
  +//  }
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.23.2.1  +122 -119  xml-xalan/java/src/org/apache/xalan/processor/CompilingStylesheetHandler.java
  
  Index: CompilingStylesheetHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/processor/CompilingStylesheetHandler.java,v
  retrieving revision 1.23
  retrieving revision 1.23.2.1
  diff -u -r1.23 -r1.23.2.1
  --- CompilingStylesheetHandler.java	2001/01/02 03:36:41	1.23
  +++ CompilingStylesheetHandler.java	2001/04/10 18:44:41	1.23.2.1
  @@ -107,12 +107,12 @@
   public class CompilingStylesheetHandler
     extends StylesheetHandler
   {
  -	/** Constants for the "maythrow" field (gates whether catch
  -	 * statements are generated):
  -	 */
  -	final int MAY_THROW_SAX_EXCEPTION=0x01;
  -	
  -	
  +        /** Constants for the "maythrow" field (gates whether catch
  +         * statements are generated):
  +         */
  +        final int MAY_THROW_SAX_EXCEPTION=0x01;
  +        
  +        
     /**
      * Create a StylesheetHandler object, creating a root stylesheet 
      * as the target.
  @@ -137,63 +137,63 @@
     public void endDocument ()
       throws org.xml.sax.SAXException
     {
  -	  
  +          
   //    try
   //    {
  -	  
  -	  // Perform normal end-of-parse operations -- in particular, 
  -	  // the "composition" process which performs data gathering
  -	  // and optimization of the interpretable tree.
  +          
  +          // Perform normal end-of-parse operations -- in particular, 
  +          // the "composition" process which performs data gathering
  +          // and optimization of the interpretable tree.
         super.endDocument();
         
         if(isStylesheetParsingComplete())
         {    
           Stylesheet current=getStylesheet();
   
  -		// Record the Templates as we compile them; this list gets
  -		// passed into the "bundling" code to copy their excutable code
  -		// into the .xsb file.
  -		// TODO: Can we just use the StylesheetRoot's list?
  +                // Record the Templates as we compile them; this list gets
  +                // passed into the "bundling" code to copy their excutable code
  +                // into the .xsb file.
  +                // TODO: Can we just use the StylesheetRoot's list?
           Vector compiledTemplates=new Vector();
   
  -		// cache the typecast
  +                // cache the typecast
           StylesheetRoot root=(StylesheetRoot)getStylesheetRoot();
           
  -		// For all templates used in this stylesheet (including
  -		// those from imported and included stylesheets), 
  -		// compile to Java. (Takes advantage of the fact that
  -		// ComposedStylesheet processing has already gathered
  -		// these and reconciled conflicts.)
  -		
  -		// New TemplateList being generated
  -		org.apache.xalan.templates.TemplateList newTl 
  -			= new org.apache.xalan.templates.TemplateList();
  -		// Iterate over contents of old TemplateList
  -		org.apache.xalan.templates.TemplateList.TemplateWalker tw
  -			=root.getTemplateListComposed().getWalker();
  -		
  -		// Scan all templates in old list, compile, insert into new
  -		ElemTemplate et;
  -		while ( null != (et = tw.next()) )
  -		{
  -			ElemTemplate ct = compileTemplate(et);
  -			
  -			// If compilation succeeds, use it; else fall back on interp
  -			newTl.setTemplate( (ct!=null) ? ct : et);
  -		}
  -		// Postprocess/reconcile list
  -		newTl.compose();
  -		// And make it active
  -		root.setTemplateListComposed(newTl);
  -
  -		// TODO: Theoretically, we can now discard imports/includes
  -		// -- they're no longer pointing at the right ElemTemplates
  -		// anyway. There's discussion of doing so in any case when
  -		// they aren't needed for tooling support. Always do it here,
  -		// leave it to be handled there, or other?
  +                // For all templates used in this stylesheet (including
  +                // those from imported and included stylesheets), 
  +                // compile to Java. (Takes advantage of the fact that
  +                // ComposedStylesheet processing has already gathered
  +                // these and reconciled conflicts.)
  +                
  +                // New TemplateList being generated
  +                org.apache.xalan.templates.TemplateList newTl 
  +                        = new org.apache.xalan.templates.TemplateList();
  +                // Iterate over contents of old TemplateList
  +                org.apache.xalan.templates.TemplateList.TemplateWalker tw
  +                        =root.getTemplateListComposed().getWalker();
  +                
  +                // Scan all templates in old list, compile, insert into new
  +                ElemTemplate et;
  +                while ( null != (et = tw.next()) )
  +                {
  +                        ElemTemplate ct = compileTemplate(et);
  +                        
  +                        // If compilation succeeds, use it; else fall back on interp
  +                        newTl.setTemplate( (ct!=null) ? ct : et);
  +                }
  +                // Postprocess/reconcile list
  +                newTl.compose();
  +                // And make it active
  +                root.setTemplateListComposed(newTl);
  +
  +                // TODO: Theoretically, we can now discard imports/includes
  +                // -- they're no longer pointing at the right ElemTemplates
  +                // anyway. There's discussion of doing so in any case when
  +                // they aren't needed for tooling support. Always do it here,
  +                // leave it to be handled there, or other?
   
   /****** OLD APPROACH
  -		int nImports = root.getGlobalImportCount();
  +                int nImports = root.getGlobalImportCount();
           for(int imp = 0; imp < nImports; imp++)
           {
             org.apache.xalan.templates.StylesheetComposed
  @@ -235,16 +235,16 @@
           root.recomposeTemplates(true); 
    ****** OLD APPROACH */
   
  -		// TODO: Theoretically, we no longer need the Imported trees.
  -		// Eliminating them would save some bytes in memory and in the
  -		// .xsb bundle file. (They should be needed only for tooling 
  -		// support, which doesn't seem to apply to compiled operation.)
  -		// Try that _AFTER_ the compile loop has been revived!
  -		
  +                // TODO: Theoretically, we no longer need the Imported trees.
  +                // Eliminating them would save some bytes in memory and in the
  +                // .xsb bundle file. (They should be needed only for tooling 
  +                // support, which doesn't seem to apply to compiled operation.)
  +                // Try that _AFTER_ the compile loop has been revived!
  +                
           // TODO: Should bundling occur elsewhere or be optional?
           CompiledStylesheetBundle.createBundle(root,compiledTemplates);
         }
  -	  
  +          
   //    }
   //    catch(TransformerException te)
   //    {
  @@ -394,8 +394,8 @@
           }
           
           // Compile the new java class. Note that any existing class
  -		// by the same name will be walked upon... which is why I'm
  -		// going to the trouble of generating unique classnames.
  +                // by the same name will be walked upon... which is why I'm
  +                // going to the trouble of generating unique classnames.
           // TODO: ***** ISSUE: Where write out the class? Parameterize.
           // Needs to be somewhere on the classpath, or we need a classloader.
           Class realclass=compileSyntheticClass(tClass,".");
  @@ -440,18 +440,18 @@
     
     int compileElemTemplateElement(ElemTemplateElement kid,StringBuffer body,Vector interpretVector)
     {
  -	int maythrow=0;  
  +        int maythrow=0;  
       ++uniqueVarSuffix; // Maintain unique variable naming
         
           switch(kid.getXSLToken())
           {
           case Constants.ELEMNAME_LITERALRESULT:
  -			maythrow=compileElemLiteralResult((ElemLiteralResult)kid,body,interpretVector);
  +                        maythrow=compileElemLiteralResult((ElemLiteralResult)kid,body,interpretVector);
               break;
   
  -	// TODO: ***** Redirection of attr value not working yet.
  -	// TODO: ***** Attrs should be preprocessed (SAX-ordered)
  -	//case Constants.ELEMNAME_ATTRIBUTE:
  +        // TODO: ***** Redirection of attr value not working yet.
  +        // TODO: ***** Attrs should be preprocessed (SAX-ordered)
  +        //case Constants.ELEMNAME_ATTRIBUTE:
           //    compileElemAttribute((ElemAttribute)kid,body,interpretVector);
           //    break;
                   
  @@ -466,14 +466,14 @@
               );
                   break;
           }
  -		
  -		return maythrow;
  +                
  +                return maythrow;
     }  
     
     int compileElemLiteralResult(ElemLiteralResult ele,StringBuffer body,Vector interpretVector)
     {
  -	int maythrow=0;
  -	
  +        int maythrow=0;
  +        
       ++uniqueVarSuffix; // Maintain unique variable naming
         
       body.append("rhandler.startElement(\""
  @@ -532,13 +532,14 @@
               {
                   // Literal value, can fully resolve at compile time.
                   // Exception won't be thrown, but we've gotta catch
  -                try{
  -                    avtValueExpression=makeQuotedString(
  -                        avt.evaluate(null,null,null)
  -                        );
  -                }catch(TransformerException e)
  -                {
  -                }
  +//                try{
  +                  // %TBD% ??
  +//                    avtValueExpression=makeQuotedString(
  +//                        avt.evaluate(null,null,null)
  +//                        );
  +//                }catch(TransformerException e)
  +//                {
  +//                }
               }
               else
               {
  @@ -573,8 +574,8 @@
       // Process children
       // TODO:***** "Process m_extensionElementPrefixes && m_attributeSetsNames"
   
  -	// TODO: Should maythrow be passed outward, unwinding try/catch?
  -	// maythrow !=
  +        // TODO: Should maythrow be passed outward, unwinding try/catch?
  +        // maythrow !=
       compileChildTemplates(ele,body,interpretVector);
   
       // Close the patient
  @@ -584,8 +585,8 @@
                   +ele.getRawName()+"\");\n");
       if(newNSlevel)
           body.append("nsSupport.popContext();\n");
  -	
  -	return maythrow | MAY_THROW_SAX_EXCEPTION;
  +        
  +        return maythrow | MAY_THROW_SAX_EXCEPTION;
     }
   
     // Detect and report AttributeSet loops.
  @@ -630,14 +631,15 @@
   
                   // Recurse, since attrsets can reference attrsets
                   compileUseAttrSet(attrSet,body,interpretVector);
  -                        
  -                ElemAttribute attr = (ElemAttribute)attrSet.getFirstChild();
  -                while(null != attr)
  -                {
  -                    compileElemTemplateElement(attr,body,interpretVector);
  -                    attr = (ElemAttribute)attr.getNextSibling();
  -                }
                       
  +                // %TBD%    
  +//                ElemAttribute attr = (ElemAttribute)attrSet.getFirstChild();
  +//                while(null != attr)
  +//                {
  +//                    compileElemTemplateElement(attr,body,interpretVector);
  +//                    attr = (ElemAttribute)attr.getNextSibling();
  +//                }
  +                    
                   attrSetStack.pop();
               }
           }
  @@ -647,18 +649,19 @@
     String compileAVTvalue(org.apache.xalan.templates.AVT avt,StringBuffer body,Vector interpretVector)
     {
         // Literal string is easy -- except for potential of " within "".
  -      if(avt.isContextInsensitive())
  -          try
  -          {
  -            return makeQuotedString(avt.evaluate(null,null,null));
  -          } catch(TransformerException e)
  -          {
  -              // Should never arise
  -              String s=">UNEXPECTED ERROR evaluating context-insensitive AVT<";
  -              System.err.println(s);
  -              e.printStackTrace();
  -              return "\""+s+'"';
  -          }
  +      // %TBD%
  +//      if(avt.isContextInsensitive())
  +//          try
  +//          {
  +//            return makeQuotedString(avt.evaluate(null,null,null));
  +//          } catch(TransformerException e)
  +//          {
  +//              // Should never arise
  +//              String s=">UNEXPECTED ERROR evaluating context-insensitive AVT<";
  +//              System.err.println(s);
  +//              e.printStackTrace();
  +//              return "\""+s+'"';
  +//          }
         
         // Otherwise no compilation yet, just reference and return expression.
         // Note that we do _not_ code-gen directly into the body, due to
  @@ -668,8 +671,8 @@
         interpretVector.addElement(avt);
         return 
             "( ((org.apache.xalan.templates.AVT)m_interpretArray["
  -		  +offset
  -		  +"]).evaluate(transformer.getXPathContext(),sourceNode,this,new StringBuffer()) )"
  +                  +offset
  +                  +"]).evaluate(transformer.getXPathContext(),sourceNode,this,new StringBuffer()) )"
             ;
     }
     
  @@ -866,7 +869,7 @@
     void compileChildTemplates(ElemTemplateElement source,StringBuffer body,Vector interpretVector)
     {      
       int maythrow=0;
  -	
  +        
       ++uniqueVarSuffix; // Maintain unique variable naming
         
       // If no kids, no code gen.
  @@ -896,25 +899,25 @@
             kid!=null;
             kid=kid.getNextSiblingElem())
            {
  -			//TODO: NEED EQUIVALENT? This Node is Going Away...
  -			// body.append("transformer.pushElemTemplateElement(kid);\n");
  -		  
  -			maythrow|=compileElemTemplateElement(kid,body,interpretVector);
  +                        //TODO: NEED EQUIVALENT? This Node is Going Away...
  +                        // body.append("transformer.pushElemTemplateElement(kid);\n");
  +                  
  +                        maythrow|=compileElemTemplateElement(kid,body,interpretVector);
   
  -			//TODO: NEED EQUIVALENT? This Node is Going Away...
  -			// body.append("transformer.popElemTemplateElement(kid);\n");
  +                        //TODO: NEED EQUIVALENT? This Node is Going Away...
  +                        // body.append("transformer.popElemTemplateElement(kid);\n");
            }
   
  -	  // End the class wrapper. 
  -	  // TODO: Should "maythrow" be returned and processed @ outermost compile?
  -	  body.append("\n\n}\n");
  -	  if(0!=(maythrow & MAY_THROW_SAX_EXCEPTION))
  -		body.append("catch(org.xml.sax.SAXException se) {\n"
  -					+"  throw new javax.xml.transform.TransformerException(se);\n"
  -					+"}\n"
  -					);
  +          // End the class wrapper. 
  +          // TODO: Should "maythrow" be returned and processed @ outermost compile?
  +          body.append("\n\n}\n");
  +          if(0!=(maythrow & MAY_THROW_SAX_EXCEPTION))
  +                body.append("catch(org.xml.sax.SAXException se) {\n"
  +                                        +"  throw new javax.xml.transform.TransformerException(se);\n"
  +                                        +"}\n"
  +                                        );
         body.append(
  -		"finally {\n"
  +                "finally {\n"
           +"  xctxt.setSAXLocator("+savedLocatorName+");\n"
           +"  // Pop all the variables in this element frame.\n"
           +"  "+varstackName+".popElemFrame();\n"
  @@ -983,13 +986,13 @@
       // Try to pick up the same classpath we're executing under. That
       // ought to include everything in Xalan and the standard libraries.
       String classpath=System.getProperty ("java.class.path");
  -	
  +        
       // If compiling with the -g switch (Java debugging), we should retain 
       // the Java source code to support debugging into the synthesized class.
       // Some additional diagnostics are also turned on as a side effect.
       // TODO: Find a better place to put the debugging control. Property? Parm?
       String javac_options=
  -	System.getProperty("org.apache.xalan.processor.CompilingStylesheetHandler.options","");
  +        System.getProperty("org.apache.xalan.processor.CompilingStylesheetHandler.options","");
       boolean debug=(javac_options.indexOf("-g")>=0);
   
       // Run the compilation. Encapsulates the fallbacks and
  @@ -1078,8 +1081,8 @@
       long templateNumber;
       synchronized(this)
       {   // Atomic get-next-count -- last-ditch protection against
  -		// the risk of multiple threads trying to process the same
  -		// stylesheet at the same instant on the same machine.
  +                // the risk of multiple threads trying to process the same
  +                // stylesheet at the same instant on the same machine.
           templateNumber = ++templateCounter;
       }
       
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.21.2.1  +10 -9     xml-xalan/java/src/org/apache/xalan/stree/Parent.java
  
  Index: Parent.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/stree/Parent.java,v
  retrieving revision 1.21
  retrieving revision 1.21.2.1
  diff -u -r1.21 -r1.21.2.1
  --- Parent.java	2001/01/29 11:49:06	1.21
  +++ Parent.java	2001/04/10 18:44:42	1.21.2.1
  @@ -373,14 +373,15 @@
           {
             StylesheetRoot stylesheet = transformer.getStylesheet();
   
  -          try
  +//          try
             {
               ElementImpl elem = (ElementImpl) child;
               if(null == doc.m_xpathContext)
                 doc.m_xpathContext = new org.apache.xpath.XPathContext(doc);
  -            WhiteSpaceInfo info =
  -              stylesheet.getWhiteSpaceInfo(doc.m_xpathContext,
  -                                           elem);
  +              // %TBD%
  +            WhiteSpaceInfo info = null;
  +//              stylesheet.getWhiteSpaceInfo(doc.m_xpathContext,
  +//                                           elem);
               boolean shouldStrip;
   
               if (null == info)
  @@ -394,11 +395,11 @@
   
               sh.setShouldStripWhitespace(shouldStrip);
             }
  -          catch (TransformerException se)
  -          {
  -
  -            // TODO: Diagnostics
  -          }
  +//          catch (TransformerException se)
  +//          {
  +//
  +//            // TODO: Diagnostics
  +//          }
           }
         }
       }
  
  
  
  1.35.2.1  +17 -15    xml-xalan/java/src/org/apache/xalan/stree/SourceTreeHandler.java
  
  Index: SourceTreeHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/stree/SourceTreeHandler.java,v
  retrieving revision 1.35
  retrieving revision 1.35.2.1
  diff -u -r1.35 -r1.35.2.1
  --- SourceTreeHandler.java	2001/03/28 04:41:02	1.35
  +++ SourceTreeHandler.java	2001/04/10 18:44:42	1.35.2.1
  @@ -402,11 +402,11 @@
               
             }
           } 
  -        
  -        if(null != m_docFrag)
  -          m_transformer.setSourceTreeDocForThread(m_docFrag);
  -        else
  -          m_transformer.setSourceTreeDocForThread(m_root);
  +        // %TBD?%        
  +//        if(null != m_docFrag)
  +//          m_transformer.setSourceTreeDocForThread(m_docFrag);
  +//        else
  +//          m_transformer.setSourceTreeDocForThread(m_root);
   
           Thread t = m_transformer.createTransformThread();
   
  @@ -448,15 +448,16 @@
   
         if (!m_useMultiThreading && (null != m_transformer) && m_shouldTransformAtEnd)
         {
  -        try
  -        {
  -          m_transformer.transformNode(m_root);
  -        }
  -        catch(TransformerException te)
  -        {
  -          // te.printStackTrace();
  -          throw new org.xml.sax.SAXException(te);
  -        }
  +          // %TBD?%
  +//        try
  +//        {
  +//          // m_transformer.transformNode(m_root);
  +//        }
  +//        catch(TransformerException te)
  +//        {
  +//          // te.printStackTrace();
  +//          throw new org.xml.sax.SAXException(te);
  +//        }
         }
       }
   
  @@ -1009,7 +1010,8 @@
       
       m_inputSource = new StreamSource(baseID);
       
  -    stm.putDocumentInCache(m_root, m_inputSource);
  +          // %TBD?%
  +//    stm.putDocumentInCache(m_root, m_inputSource);
     }
     
     /**
  
  
  
  1.15.2.1  +2 -2      xml-xalan/java/src/org/apache/xalan/stree/StreeDOMBuilder.java
  
  Index: StreeDOMBuilder.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/stree/StreeDOMBuilder.java,v
  retrieving revision 1.15
  retrieving revision 1.15.2.1
  diff -u -r1.15 -r1.15.2.1
  --- StreeDOMBuilder.java	2001/03/05 19:54:48	1.15
  +++ StreeDOMBuilder.java	2001/04/10 18:44:42	1.15.2.1
  @@ -217,8 +217,8 @@
       }
       
       append(elem);
  -
  -    m_elemStack.push(elem);
  +    // %TBD%
  +//    m_elemStack.push(elem);
   
       m_currentNode = elem;
     }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.13.2.1  +2 -2      xml-xalan/java/src/org/apache/xalan/templates/AVT.java
  
  Index: AVT.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/AVT.java,v
  retrieving revision 1.13
  retrieving revision 1.13.2.1
  diff -u -r1.13 -r1.13.2.1
  --- AVT.java	2001/01/02 03:36:45	1.13
  +++ AVT.java	2001/04/10 18:44:44	1.13.2.1
  @@ -56,7 +56,7 @@
    */
   package org.apache.xalan.templates;
   
  -import org.w3c.dom.Node;
  +import org.apache.xml.dtm.DTM;
   
   import java.util.Vector;
   import java.util.StringTokenizer;
  @@ -498,7 +498,7 @@
      * @throws javax.xml.transform.TransformerException
      */
     public String evaluate(
  -          XPathContext xctxt, Node context, org.apache.xml.utils.PrefixResolver nsNode)
  +          XPathContext xctxt, int context, org.apache.xml.utils.PrefixResolver nsNode)
               throws javax.xml.transform.TransformerException
     {
   
  
  
  
  1.9.2.1   +3 -2      xml-xalan/java/src/org/apache/xalan/templates/AVTPart.java
  
  Index: AVTPart.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/AVTPart.java,v
  retrieving revision 1.9
  retrieving revision 1.9.2.1
  diff -u -r1.9 -r1.9.2.1
  --- AVTPart.java	2000/12/27 22:26:25	1.9
  +++ AVTPart.java	2001/04/10 18:44:45	1.9.2.1
  @@ -56,7 +56,8 @@
    */
   package org.apache.xalan.templates;
   
  -import org.w3c.dom.*;
  +//import org.w3c.dom.*;
  +import org.apache.xml.dtm.DTM;
   
   import org.apache.xpath.XPathContext;
   import org.apache.xml.utils.FastStringBuffer;
  @@ -94,7 +95,7 @@
      * @throws javax.xml.transform.TransformerException
      */
     public abstract void evaluate(
  -    XPathContext xctxt, FastStringBuffer buf, Node context,
  +    XPathContext xctxt, FastStringBuffer buf, int context,
         org.apache.xml.utils.PrefixResolver nsNode)
           throws javax.xml.transform.TransformerException;
   
  
  
  
  1.9.2.1   +2 -2      xml-xalan/java/src/org/apache/xalan/templates/AVTPartSimple.java
  
  Index: AVTPartSimple.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/AVTPartSimple.java,v
  retrieving revision 1.9
  retrieving revision 1.9.2.1
  diff -u -r1.9 -r1.9.2.1
  --- AVTPartSimple.java	2001/01/02 03:36:45	1.9
  +++ AVTPartSimple.java	2001/04/10 18:44:45	1.9.2.1
  @@ -56,7 +56,7 @@
    */
   package org.apache.xalan.templates;
   
  -import org.w3c.dom.*;
  +//import org.w3c.dom.*;
   
   import org.apache.xpath.XPathContext;
   import org.apache.xml.utils.FastStringBuffer;
  @@ -106,7 +106,7 @@
      * @param NodeList The current Context Node List.
      */
     public void evaluate(XPathContext xctxt, FastStringBuffer buf,
  -                       Node context,
  +                       int context,
                          org.apache.xml.utils.PrefixResolver nsNode)
     {
       buf.append(m_val);
  
  
  
  1.12.2.1  +3 -2      xml-xalan/java/src/org/apache/xalan/templates/AVTPartXPath.java
  
  Index: AVTPartXPath.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/AVTPartXPath.java,v
  retrieving revision 1.12
  retrieving revision 1.12.2.1
  diff -u -r1.12 -r1.12.2.1
  --- AVTPartXPath.java	2001/01/07 06:24:40	1.12
  +++ AVTPartXPath.java	2001/04/10 18:44:45	1.12.2.1
  @@ -62,7 +62,8 @@
   import org.apache.xpath.compiler.XPathParser;
   import org.apache.xml.utils.FastStringBuffer;
   
  -import org.w3c.dom.*;
  +//import org.w3c.dom.*;
  +import org.apache.xml.dtm.DTM;
   
   /**
    * <meta name="usage" content="internal"/>
  @@ -150,7 +151,7 @@
      * @throws javax.xml.transform.TransformerException
      */
     public void evaluate(
  -          XPathContext xctxt, FastStringBuffer buf, Node context, org.apache.xml.utils.PrefixResolver nsNode)
  +          XPathContext xctxt, FastStringBuffer buf, int context, org.apache.xml.utils.PrefixResolver nsNode)
               throws javax.xml.transform.TransformerException
     {
   
  
  
  
  1.8.2.1   +9 -9      xml-xalan/java/src/org/apache/xalan/templates/ElemApplyImport.java
  
  Index: ElemApplyImport.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemApplyImport.java,v
  retrieving revision 1.8
  retrieving revision 1.8.2.1
  diff -u -r1.8 -r1.8.2.1
  --- ElemApplyImport.java	2001/01/26 01:26:58	1.8
  +++ ElemApplyImport.java	2001/04/10 18:44:45	1.8.2.1
  @@ -56,8 +56,9 @@
    */
   package org.apache.xalan.templates;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.DOMException;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.DOMException;
  +import org.apache.xml.dtm.DTM;
   
   import javax.xml.transform.TransformerException;
   
  @@ -107,7 +108,7 @@
      * @throws TransformerException
      */
     public void execute(
  -          TransformerImpl transformer, Node sourceNode, QName mode)
  +          TransformerImpl transformer)
               throws TransformerException
     {
   
  @@ -118,14 +119,15 @@
       }
   
       if (TransformerImpl.S_DEBUG)
  -      transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
  +      transformer.getTraceManager().fireTraceEvent(this);
   
  -    if (null != sourceNode)
  +    int sourceNode = transformer.getXPathContext().getCurrentNode();
  +    if (DTM.NULL != sourceNode)
       {
   
         // This will have to change to current template, (which will have 
         // to be the top of a current template stack).
  -      transformer.applyTemplateToNode(this, null, sourceNode, mode);
  +      transformer.applyTemplateToNode(this, null, sourceNode);
       }
       else  // if(null == sourceNode)
       {
  @@ -141,10 +143,8 @@
      * @param newChild New element to append to this element's children list
      *
      * @return null, xsl:apply-Imports cannot have children 
  -   *
  -   * @throws DOMException
      */
  -  public Node appendChild(Node newChild) throws DOMException
  +  public ElemTemplateElement appendChild(ElemTemplateElement newChild)
     {
   
       error(XSLTErrorResources.ER_CANNOT_ADD,
  
  
  
  1.13.2.1  +29 -18    xml-xalan/java/src/org/apache/xalan/templates/ElemApplyTemplates.java
  
  Index: ElemApplyTemplates.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemApplyTemplates.java,v
  retrieving revision 1.13
  retrieving revision 1.13.2.1
  diff -u -r1.13 -r1.13.2.1
  --- ElemApplyTemplates.java	2001/01/26 01:26:58	1.13
  +++ ElemApplyTemplates.java	2001/04/10 18:44:45	1.13.2.1
  @@ -56,7 +56,7 @@
    */
   package org.apache.xalan.templates;
   
  -import org.w3c.dom.*;
  +//import org.w3c.dom.*;
   
   import org.xml.sax.*;
   
  @@ -170,36 +170,47 @@
      * @throws TransformerException
      */
     public void execute(
  -          TransformerImpl transformer, Node sourceNode, QName mode)
  +          TransformerImpl transformer)
               throws TransformerException
     {
   
       transformer.pushCurrentTemplateRuleIsNull(false);
   
  +    boolean pushMode = false;
  +    
       try
       {
         if (TransformerImpl.S_DEBUG)
  -        transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
  -
  -      if (null != sourceNode)
  -      {
  -
  +        transformer.getTraceManager().fireTraceEvent(this);
  +        
  +        // %REVIEW% Do we need this check??
  +//      if (null != sourceNode)
  +//      {
  +          
           // boolean needToTurnOffInfiniteLoopCheck = false;
  +        QName mode = transformer.getMode();
           if (!m_isDefaultTemplate)
           {
  -          mode = m_mode;
  +          if(((null == mode) && (null != m_mode) ) ||
  +              !mode.equals(m_mode))
  +          {
  +            pushMode = true;
  +            transformer.pushMode(m_mode);
  +          }
           }
   
  -        transformSelectedNodes(transformer, sourceNode, null, mode);
  -      }
  -      else  // if(null == sourceNode)
  -      {
  -        transformer.getMsgMgr().error(this,
  -          XSLTErrorResources.ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES);  //"sourceNode is null in handleApplyTemplatesInstruction!");
  -      }
  +        transformSelectedNodes(transformer, null);
  +//      }
  +//      else  // if(null == sourceNode)
  +//      {
  +//        transformer.getMsgMgr().error(this,
  +//          XSLTErrorResources.ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES);  //"sourceNode is null in handleApplyTemplatesInstruction!");
  +//      }
       }
       finally
       {
  +      if(pushMode)
  +        transformer.popMode();
         transformer.popCurrentTemplateRuleIsNull();
       }
     }
  @@ -231,7 +242,7 @@
      * @throws TransformerException
      */
     int pushParams(
  -          TransformerImpl transformer, XPathContext xctxt, Node sourceNode, QName mode)
  +          TransformerImpl transformer, XPathContext xctxt)
               throws TransformerException
     {
   
  @@ -240,8 +251,8 @@
       
       if (null != m_paramElems)
       {  
  -      transformer.pushParams(xctxt, this, sourceNode, mode);
  -     }  
  +      transformer.pushParams(xctxt, this);
  +    }  
       else
         vars.pushContextMarker();
       
  
  
  
  1.14.2.1  +10 -8     xml-xalan/java/src/org/apache/xalan/templates/ElemAttribute.java
  
  Index: ElemAttribute.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemAttribute.java,v
  retrieving revision 1.14
  retrieving revision 1.14.2.1
  diff -u -r1.14 -r1.14.2.1
  --- ElemAttribute.java	2001/03/11 21:44:02	1.14
  +++ ElemAttribute.java	2001/04/10 18:44:45	1.14.2.1
  @@ -56,8 +56,9 @@
    */
   package org.apache.xalan.templates;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.DOMException;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.DOMException;
  +import org.apache.xml.dtm.DTM;
   
   import javax.xml.transform.TransformerException;
   
  @@ -118,7 +119,7 @@
      * @throws TransformerException
      */
     public void execute(
  -          TransformerImpl transformer, Node sourceNode, QName mode)
  +          TransformerImpl transformer)
               throws TransformerException
     {
       ResultTreeHandler rhandler = transformer.getResultTreeHandler();
  @@ -129,9 +130,10 @@
       {
         // Make sure the trace event is sent.
         if (TransformerImpl.S_DEBUG)
  -        transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
  +        transformer.getTraceManager().fireTraceEvent(this);
   
         XPathContext xctxt = transformer.getXPathContext();
  +      int sourceNode = xctxt.getCurrentNode();
         String attrName = m_name_avt.evaluate(xctxt, sourceNode, this);
         transformer.getMsgMgr().warn(this,
                                      XSLTErrorResources.WG_ILLEGAL_ATTRIBUTE,
  @@ -142,7 +144,7 @@
         // warn(templateChild, sourceNode, "Trying to add attribute after element child has been added, ignoring...");
       }
       
  -    super.execute(transformer, sourceNode, mode);
  +    super.execute(transformer);
       
     }
     
  @@ -211,7 +213,7 @@
      * @throws TransformerException
      */
     void constructNode(
  -          String nodeName, String prefix, String nodeNamespace, TransformerImpl transformer, Node sourceNode, QName mode)
  +          String nodeName, String prefix, String nodeNamespace, TransformerImpl transformer)
               throws TransformerException
     {
   
  @@ -229,7 +231,7 @@
             throw new TransformerException(se);
           }
         }
  -      String val = transformer.transformToString(this, sourceNode, mode);
  +      String val = transformer.transformToString(this);
         String localName = QName.getLocalPart(nodeName);
         rhandler.addAttribute(nodeNamespace, localName, nodeName, "CDATA", val);
       }
  @@ -251,7 +253,7 @@
      *
      * @throws DOMException
      */
  -  public Node appendChild(Node newChild) throws DOMException
  +  public ElemTemplateElement appendChild(ElemTemplateElement newChild)
     {
   
       int type = ((ElemTemplateElement) newChild).getXSLToken();
  
  
  
  1.8.2.1   +6 -6      xml-xalan/java/src/org/apache/xalan/templates/ElemAttributeSet.java
  
  Index: ElemAttributeSet.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemAttributeSet.java,v
  retrieving revision 1.8
  retrieving revision 1.8.2.1
  diff -u -r1.8 -r1.8.2.1
  --- ElemAttributeSet.java	2001/01/02 03:36:45	1.8
  +++ ElemAttributeSet.java	2001/04/10 18:44:46	1.8.2.1
  @@ -143,7 +143,7 @@
      * @throws TransformerException
      */
     public void execute(
  -          TransformerImpl transformer, Node sourceNode, QName mode)
  +          TransformerImpl transformer)
               throws TransformerException
     {
   
  @@ -156,15 +156,15 @@
       }
   
       transformer.pushElemAttributeSet(this);
  -    super.execute(transformer, sourceNode, mode);
  +    super.execute(transformer);
   
  -    ElemAttribute attr = (ElemAttribute) getFirstChild();
  +    ElemAttribute attr = (ElemAttribute) getFirstChildElem();
   
       while (null != attr)
       {
  -      attr.execute(transformer, sourceNode, mode);
  +      attr.execute(transformer);
   
  -      attr = (ElemAttribute) attr.getNextSibling();
  +      attr = (ElemAttribute) attr.getNextSiblingElem();
       }
   
       transformer.popElemAttributeSet();
  @@ -184,7 +184,7 @@
      *
      * @throws DOMException
      */
  -  public Node appendChild(Node newChild) throws DOMException
  +  public ElemTemplateElement appendChildElem(ElemTemplateElement newChild)
     {
   
       int type = ((ElemTemplateElement) newChild).getXSLToken();
  
  
  
  1.17.2.1  +5 -5      xml-xalan/java/src/org/apache/xalan/templates/ElemCallTemplate.java
  
  Index: ElemCallTemplate.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemCallTemplate.java,v
  retrieving revision 1.17
  retrieving revision 1.17.2.1
  diff -u -r1.17 -r1.17.2.1
  --- ElemCallTemplate.java	2001/03/18 09:26:57	1.17
  +++ ElemCallTemplate.java	2001/04/10 18:44:46	1.17.2.1
  @@ -170,12 +170,12 @@
      * @throws TransformerException
      */
     public void execute(
  -          TransformerImpl transformer, Node sourceNode, QName mode)
  +          TransformerImpl transformer)
               throws TransformerException
     {
   
       if (TransformerImpl.S_DEBUG)
  -      transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
  +      transformer.getTraceManager().fireTraceEvent(this);
   
       if (null != m_template)
       {
  @@ -185,7 +185,7 @@
         int savedSearchStart = vars.getSearchStart();
   
         if (null != m_paramElems)
  -        transformer.pushParams(xctxt, this, sourceNode, mode);
  +        transformer.pushParams(xctxt, this);
         else
           vars.pushContextMarker();
         
  @@ -199,7 +199,7 @@
   
           // template.executeChildTemplates(transformer, sourceNode, mode, true);
           transformer.pushElemTemplateElement(m_template);
  -        m_template.execute(transformer, sourceNode, mode);
  +        m_template.execute(transformer);
         }
         finally
         {
  @@ -269,7 +269,7 @@
      *
      * @throws DOMException
      */
  -  public Node appendChild(Node newChild) throws DOMException
  +  public ElemTemplateElement appendChild(ElemTemplateElement newChild)
     {
   
       int type = ((ElemTemplateElement) newChild).getXSLToken();
  
  
  
  1.9.2.1   +9 -6      xml-xalan/java/src/org/apache/xalan/templates/ElemChoose.java
  
  Index: ElemChoose.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemChoose.java,v
  retrieving revision 1.9
  retrieving revision 1.9.2.1
  diff -u -r1.9 -r1.9.2.1
  --- ElemChoose.java	2001/02/13 20:28:56	1.9
  +++ ElemChoose.java	2001/04/10 18:44:46	1.9.2.1
  @@ -56,7 +56,8 @@
    */
   package org.apache.xalan.templates;
   
  -import org.w3c.dom.*;
  +//import org.w3c.dom.*;
  +import org.apache.xml.dtm.DTM;
   
   import org.xml.sax.*;
   
  @@ -119,12 +120,12 @@
      * @throws TransformerException
      */
     public void execute(
  -          TransformerImpl transformer, Node sourceNode, QName mode)
  +          TransformerImpl transformer)
               throws TransformerException
     {
   
       if (TransformerImpl.S_DEBUG)
  -      transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
  +      transformer.getTraceManager().fireTraceEvent(this);
   
       boolean found = false;
   
  @@ -140,6 +141,8 @@
           ElemWhen when = (ElemWhen) childElem;
   
           // must be xsl:when
  +        XPathContext xctxt = transformer.getXPathContext();
  +        int sourceNode = xctxt.getCurrentNode();
           XObject test = when.getTest().execute(transformer.getXPathContext(),
                                                 sourceNode, this);
   
  @@ -149,7 +152,7 @@
   
           if ((null != test) && test.bool())
           {
  -          transformer.executeChildTemplates(when, sourceNode, mode, true);
  +          transformer.executeChildTemplates(when, true);
   
             return;
           }
  @@ -159,7 +162,7 @@
           found = true;
   
           // xsl:otherwise                
  -        transformer.executeChildTemplates(childElem, sourceNode, mode, true);
  +        transformer.executeChildTemplates(childElem, true);
   
           return;
         }
  @@ -179,7 +182,7 @@
      *
      * @throws DOMException
      */
  -  public Node appendChild(Node newChild) throws DOMException
  +  public ElemTemplateElement appendChild(ElemTemplateElement newChild)
     {
   
       int type = ((ElemTemplateElement) newChild).getXSLToken();
  
  
  
  1.7.2.1   +6 -5      xml-xalan/java/src/org/apache/xalan/templates/ElemComment.java
  
  Index: ElemComment.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemComment.java,v
  retrieving revision 1.7
  retrieving revision 1.7.2.1
  diff -u -r1.7 -r1.7.2.1
  --- ElemComment.java	2000/12/05 22:29:24	1.7
  +++ ElemComment.java	2001/04/10 18:44:46	1.7.2.1
  @@ -56,7 +56,8 @@
    */
   package org.apache.xalan.templates;
   
  -import org.w3c.dom.*;
  +//import org.w3c.dom.*;
  +import org.apache.xml.dtm.DTM;
   
   import org.xml.sax.*;
   
  @@ -111,13 +112,13 @@
      * @throws TransformerException
      */
     public void execute(
  -          TransformerImpl transformer, Node sourceNode, QName mode)
  +          TransformerImpl transformer)
               throws TransformerException
     {
       try
       {
         if (TransformerImpl.S_DEBUG)
  -        transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
  +        transformer.getTraceManager().fireTraceEvent(this);
   
         // Note the content model is:
         // <!ENTITY % instructions "
  @@ -127,7 +128,7 @@
         // | xsl:element
         // | xsl:attribute
         // ">
  -      String data = transformer.transformToString(this, sourceNode, mode);
  +      String data = transformer.transformToString(this);
   
         transformer.getResultTreeHandler().comment(data);
       }
  @@ -146,7 +147,7 @@
      *
      * @throws DOMException
      */
  -  public Node appendChild(Node newChild) throws DOMException
  +  public ElemTemplateElement appendChild(ElemTemplateElement newChild)
     {
   
       int type = ((ElemTemplateElement) newChild).getXSLToken();
  
  
  
  1.12.2.1  +18 -16    xml-xalan/java/src/org/apache/xalan/templates/ElemCopy.java
  
  Index: ElemCopy.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemCopy.java,v
  retrieving revision 1.12
  retrieving revision 1.12.2.1
  diff -u -r1.12 -r1.12.2.1
  --- ElemCopy.java	2001/02/13 20:28:57	1.12
  +++ ElemCopy.java	2001/04/10 18:44:46	1.12.2.1
  @@ -56,7 +56,8 @@
    */
   package org.apache.xalan.templates;
   
  -import org.w3c.dom.*;
  +//import org.w3c.dom.*;
  +import org.apache.xml.dtm.DTM;
   
   import org.xml.sax.*;
   
  @@ -130,46 +131,47 @@
      * @throws TransformerException
      */
     public void execute(
  -          TransformerImpl transformer, Node sourceNode, QName mode)
  +          TransformerImpl transformer)
               throws TransformerException
     {
       try
       {
  -      short nodeType = sourceNode.getNodeType();
  +      XPathContext xctxt = transformer.getXPathContext();
  +      int sourceNode = xctxt.getCurrentNode();
  +      DTM dtm = xctxt.getDTM(sourceNode);
  +      short nodeType = dtm.getNodeType(sourceNode);
   
  -      if ((Node.DOCUMENT_NODE != nodeType) && (Node.DOCUMENT_FRAGMENT_NODE != nodeType))
  +      if ((DTM.DOCUMENT_NODE != nodeType) && (DTM.DOCUMENT_FRAGMENT_NODE != nodeType))
         {
           ResultTreeHandler rthandler = transformer.getResultTreeHandler();
   
           // TODO: Process the use-attribute-sets stuff
           rthandler.cloneToResultTree(sourceNode, false);
   
  -        if (Node.ELEMENT_NODE == nodeType)
  +        if (DTM.ELEMENT_NODE == nodeType)
           {
  -          super.execute(transformer, sourceNode, mode);
  +          super.execute(transformer);
             rthandler.processNSDecls(sourceNode);
  -          transformer.executeChildTemplates(this, sourceNode, mode, true);
  +          transformer.executeChildTemplates(this, true);
             
  -          DOMHelper dhelper = transformer.getXPathContext().getDOMHelper();
  -          String ns = dhelper.getNamespaceOfNode(sourceNode);
  -          String localName = dhelper.getLocalNameOfNode(sourceNode);
  +          String ns = dtm.getNamespaceURI(sourceNode);
  +          String localName = dtm.getLocalName(sourceNode);
             transformer.getResultTreeHandler().endElement(ns, localName,
  -                                                        sourceNode.getNodeName());
  +                                                        dtm.getNodeName(sourceNode));
           }
           else
           {
             if (TransformerImpl.S_DEBUG)
  -            transformer.getTraceManager().fireTraceEvent(sourceNode, mode,
  -                                                         this);
  +            transformer.getTraceManager().fireTraceEvent(this);
           }
         }
         else
         {
           if (TransformerImpl.S_DEBUG)
  -          transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
  +          transformer.getTraceManager().fireTraceEvent(this);
   
  -        super.execute(transformer, sourceNode, mode);
  -        transformer.executeChildTemplates(this, sourceNode, mode, true);
  +        super.execute(transformer);
  +        transformer.executeChildTemplates(this, true);
         }
       }
       catch(org.xml.sax.SAXException se)
  
  
  
  1.10.2.1  +21 -18    xml-xalan/java/src/org/apache/xalan/templates/ElemCopyOf.java
  
  Index: ElemCopyOf.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemCopyOf.java,v
  retrieving revision 1.10
  retrieving revision 1.10.2.1
  diff -u -r1.10 -r1.10.2.1
  --- ElemCopyOf.java	2001/01/02 03:36:45	1.10
  +++ ElemCopyOf.java	2001/04/10 18:44:47	1.10.2.1
  @@ -56,8 +56,11 @@
    */
   package org.apache.xalan.templates;
   
  -import org.w3c.dom.*;
  -import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.*;
  +//import org.w3c.dom.traversal.NodeIterator;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
  +import org.apache.xml.dtm.DTMTreeWalker;
   
   import org.xml.sax.*;
   
  @@ -146,16 +149,17 @@
      * @throws TransformerException
      */
     public void execute(
  -          TransformerImpl transformer, Node sourceNode, QName mode)
  +          TransformerImpl transformer)
               throws TransformerException
     {
   
       try
       {
         if (TransformerImpl.S_DEBUG)
  -        transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
  +        transformer.getTraceManager().fireTraceEvent(this);
   
         XPathContext xctxt = transformer.getXPathContext();
  +      int sourceNode = xctxt.getCurrentNode();
         XObject value = m_selectExpression.execute(xctxt, sourceNode, this);
   
         if (TransformerImpl.S_DEBUG)
  @@ -181,30 +185,30 @@
           case XObject.CLASS_NODESET :
   
             // System.out.println(value);
  -          NodeIterator nl = value.nodeset();
  +          DTMIterator nl = value.nodeset();
   
             // Copy the tree.
  -          org.apache.xml.utils.TreeWalker tw =
  -                                                new TreeWalker2Result(transformer, handler);
  -          Node pos;
  +          DTMTreeWalker tw = new TreeWalker2Result(transformer, handler);
  +          int pos;
   
  -          while (null != (pos = nl.nextNode()))
  +          while (DTM.NULL != (pos = nl.nextNode()))
             {
  -            short t = pos.getNodeType();
  +            DTM dtm = nl.getDTM(pos);
  +            short t = dtm.getNodeType(pos);
   
               // If we just copy the whole document, a startDoc and endDoc get 
               // generated, so we need to only walk the child nodes.
  -            if (t == Node.DOCUMENT_NODE)
  +            if (t == DTM.DOCUMENT_NODE)
               {
  -              for (Node child = pos.getFirstChild(); child != null;
  -                   child = child.getNextSibling())
  +              for (int child = dtm.getFirstChild(pos); child != DTM.NULL;
  +                   child = dtm.getNextSibling(child))
                 {
                   tw.traverse(child);
                 }
               }
  -            else if (t == Node.ATTRIBUTE_NODE)
  +            else if (t == DTM.ATTRIBUTE_NODE)
               {
  -              handler.addAttribute((Attr) pos);
  +              handler.addAttribute(pos);
               }
               else
               {
  @@ -218,6 +222,7 @@
                                              transformer.getXPathContext());
             break;
           default :
  +          
             s = value.str();
   
             handler.characters(s.toCharArray(), 0, s.length());
  @@ -238,10 +243,8 @@
      * @param newChild Child to add to this node's child list
      *
      * @return Child just added to child list
  -   *
  -   * @throws DOMException
      */
  -  public Node appendChild(Node newChild) throws DOMException
  +  public ElemTemplateElement appendChild(ElemTemplateElement newChild)
     {
   
       error(XSLTErrorResources.ER_CANNOT_ADD,
  
  
  
  1.18.2.1  +8 -8      xml-xalan/java/src/org/apache/xalan/templates/ElemElement.java
  
  Index: ElemElement.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemElement.java,v
  retrieving revision 1.18
  retrieving revision 1.18.2.1
  diff -u -r1.18 -r1.18.2.1
  --- ElemElement.java	2001/03/11 21:44:02	1.18
  +++ ElemElement.java	2001/04/10 18:44:47	1.18.2.1
  @@ -56,7 +56,8 @@
    */
   package org.apache.xalan.templates;
   
  -import org.w3c.dom.*;
  +//import org.w3c.dom.*;
  +import org.apache.xml.dtm.DTM;
   
   import org.xml.sax.*;
   
  @@ -256,12 +257,13 @@
      * @throws TransformerException
      */
     public void execute(
  -          TransformerImpl transformer, Node sourceNode, QName mode)
  +          TransformerImpl transformer)
               throws TransformerException
     {
   
       ResultTreeHandler rhandler = transformer.getResultTreeHandler();
       XPathContext xctxt = transformer.getXPathContext();
  +    int sourceNode = xctxt.getCurrentNode();
       String nodeName = m_name_avt.evaluate(xctxt, sourceNode, this);
   
       // make sure that if a prefix is specified on the attribute name, it is valid
  @@ -351,8 +353,7 @@
         }
       }
   
  -    constructNode(nodeName, prefix, nodeNamespace, transformer, sourceNode,
  -                  mode);
  +    constructNode(nodeName, prefix, nodeNamespace, transformer);
     }
     
     /**
  @@ -369,7 +370,7 @@
      * @throws TransformerException
      */
     void constructNode(
  -          String nodeName, String prefix, String nodeNamespace, TransformerImpl transformer, Node sourceNode, QName mode)
  +          String nodeName, String prefix, String nodeNamespace, TransformerImpl transformer)
               throws TransformerException
     {
   
  @@ -395,10 +396,9 @@
         boolean shouldAddAttrs = (null != nodeName);
   
         if (shouldAddAttrs)
  -        super.execute(transformer, sourceNode, mode);
  +        super.execute(transformer);
   
  -      transformer.executeChildTemplates(this, sourceNode, mode,
  -                                        shouldAddAttrs);
  +      transformer.executeChildTemplates(this, shouldAddAttrs);
   
         // Now end the element if name was valid
         if (null != nodeName)
  
  
  
  1.24.2.1  +8 -9      xml-xalan/java/src/org/apache/xalan/templates/ElemExtensionCall.java
  
  Index: ElemExtensionCall.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemExtensionCall.java,v
  retrieving revision 1.24
  retrieving revision 1.24.2.1
  diff -u -r1.24 -r1.24.2.1
  --- ElemExtensionCall.java	2001/03/18 09:26:57	1.24
  +++ ElemExtensionCall.java	2001/04/10 18:44:47	1.24.2.1
  @@ -60,7 +60,7 @@
   
   import java.util.*;
   
  -import org.w3c.dom.*;
  +//import org.w3c.dom.*;
   
   import org.xml.sax.*;
   import org.xml.sax.helpers.*;
  @@ -238,7 +238,7 @@
      * @throws TransformerException
      */
     public void executeFallbacks(
  -          TransformerImpl transformer, Node sourceNode, QName mode)
  +          TransformerImpl transformer)
               throws TransformerException
     {
       for (ElemTemplateElement child = m_firstChild; child != null;
  @@ -249,7 +249,7 @@
           try
           {
             transformer.pushElemTemplateElement(child);
  -          ((ElemFallback) child).executeFallback(transformer, sourceNode, mode);
  +          ((ElemFallback) child).executeFallback(transformer);
           }
           finally
           {
  @@ -271,7 +271,7 @@
      * @throws TransformerException
      */
     public void execute(
  -          TransformerImpl transformer, Node sourceNode, QName mode)
  +          TransformerImpl transformer)
               throws TransformerException
     {
   
  @@ -294,7 +294,7 @@
             etable.addExtensionNamespace(m_extns, nsh);
           else
           {
  -          executeFallbacks(transformer, sourceNode, mode);
  +          executeFallbacks(transformer);
             return;
           }
   
  @@ -303,8 +303,7 @@
         try
         {
           nsh.processElement(this.getLocalName(), this, transformer,
  -                           getStylesheet(), sourceNode.getOwnerDocument(),
  -                           sourceNode, mode, this);
  +                           getStylesheet(), this);
         }
         catch (Exception e)
         {
  @@ -344,7 +343,7 @@
             transformer.getErrorListener().error(te); // ??
   
           executeFallbacks(
  -          transformer, sourceNode, mode);
  +          transformer);
         }
       }
       catch(org.xml.sax.SAXException se)
  @@ -387,7 +386,7 @@
      * @throws TransformerException
      */
     public String getAttribute(
  -          String rawName, Node sourceNode, TransformerImpl transformer)
  +          String rawName, int sourceNode /* %TBD% Node varient? */, TransformerImpl transformer)
               throws TransformerException
     {
   
  
  
  
  1.10.2.1  +4 -5      xml-xalan/java/src/org/apache/xalan/templates/ElemFallback.java
  
  Index: ElemFallback.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemFallback.java,v
  retrieving revision 1.10
  retrieving revision 1.10.2.1
  diff -u -r1.10 -r1.10.2.1
  --- ElemFallback.java	2001/02/13 20:28:57	1.10
  +++ ElemFallback.java	2001/04/10 18:44:47	1.10.2.1
  @@ -113,7 +113,7 @@
      * @throws TransformerException
      */
     public void execute(
  -          TransformerImpl transformer, Node sourceNode, QName mode)
  +          TransformerImpl transformer)
               throws TransformerException
     {
     }
  @@ -134,7 +134,7 @@
      * @throws TransformerException
      */
     public void executeFallback(
  -          TransformerImpl transformer, Node sourceNode, QName mode)
  +          TransformerImpl transformer)
               throws TransformerException
     {
   
  @@ -142,10 +142,9 @@
       {
   
         if (TransformerImpl.S_DEBUG)
  -        transformer.getTraceManager().fireTraceEvent(sourceNode, mode,
  -                this);
  +        transformer.getTraceManager().fireTraceEvent(this);
   
  -      transformer.executeChildTemplates(this, sourceNode, mode, true);
  +      transformer.executeChildTemplates(this, true);
   
       }
       else
  
  
  
  1.20.2.1  +45 -75    xml-xalan/java/src/org/apache/xalan/templates/ElemForEach.java
  
  Index: ElemForEach.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemForEach.java,v
  retrieving revision 1.20
  retrieving revision 1.20.2.1
  diff -u -r1.20 -r1.20.2.1
  --- ElemForEach.java	2001/03/28 04:41:03	1.20
  +++ ElemForEach.java	2001/04/10 18:44:47	1.20.2.1
  @@ -56,9 +56,12 @@
    */
   package org.apache.xalan.templates;
   
  -import org.w3c.dom.*;
  -import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.*;
  +//import org.w3c.dom.traversal.NodeIterator;
   
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
  +
   import org.xml.sax.*;
   
   import org.apache.xpath.*;
  @@ -206,15 +209,12 @@
     /**
      * Execute the xsl:for-each transformation 
      *
  -   *
      * @param transformer non-null reference to the the current transform-time state.
  -   * @param sourceNode non-null reference to the <a href="http://www.w3.org/TR/xslt#dt-current-node">current source node</a>.
  -   * @param mode reference, which may be null, to the <a href="http://www.w3.org/TR/xslt#modes">current mode</a>.
      *
      * @throws TransformerException
      */
     public void execute(
  -          TransformerImpl transformer, Node sourceNode, QName mode)
  +          TransformerImpl transformer)
               throws TransformerException
     {
   
  @@ -223,9 +223,9 @@
       try
       {
         if (TransformerImpl.S_DEBUG)
  -        transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
  +        transformer.getTraceManager().fireTraceEvent(this);
   
  -      transformSelectedNodes(transformer, sourceNode, this, mode);
  +      transformSelectedNodes(transformer, this);
       }
       finally
       {
  @@ -256,35 +256,23 @@
      *
      * @throws TransformerException
      */
  -  protected NodeIterator sortNodes(
  -          XPathContext xctxt, Vector keys, NodeIterator sourceNodes)
  +  protected DTMIterator sortNodes(
  +          XPathContext xctxt, Vector keys, DTMIterator sourceNodes)
               throws TransformerException
     {
   
       NodeSorter sorter = new NodeSorter(xctxt);
  -    NodeSet nodeList;
  +    
  +    sourceNodes.setShouldCacheNodes(true);
  +    sourceNodes.runTo(-1);
   
  -    if (sourceNodes instanceof NodeSet)
  -    {
  -      nodeList = ((NodeSet) sourceNodes);
  +    xctxt.pushContextNodeList(sourceNodes);
   
  -      nodeList.setShouldCacheNodes(true);
  -      nodeList.runTo(-1);
  -    }
  -    else
  -    {
  -      nodeList = new NodeSet(sourceNodes);
  -      sourceNodes = nodeList;
  -
  -      ((ContextNodeList) sourceNodes).setCurrentPos(0);
  -    }
  -
  -    xctxt.pushContextNodeList((ContextNodeList) sourceNodes);
  -
       try
       {
  -      sorter.sort(nodeList, keys, xctxt);
  -      nodeList.setCurrentPos(0);
  +      // %TBD%
  +//      sorter.sort(sourceNodes, keys, xctxt);
  +      sourceNodes.setCurrentPos(0);
       }
       finally
       {
  @@ -321,7 +309,7 @@
      * @throws TransformerException
      */
     int pushParams(
  -          TransformerImpl transformer, XPathContext xctxt, Node sourceNode, QName mode)
  +          TransformerImpl transformer, XPathContext xctxt)
               throws TransformerException
     {
   
  @@ -359,25 +347,13 @@
      * <meta name="usage" content="advanced"/>
      * Perform a query if needed, and call transformNode for each child.
      *
  -   *
      * @param transformer non-null reference to the the current transform-time state.
  -   * @param sourceNode non-null reference to the <a href="http://www.w3.org/TR/xslt#dt-current-node">current source node</a>.
  -   * @throws TransformerException Thrown in a variety of circumstances.
  -   * @param stylesheetTree The owning stylesheet tree.
  -   * @param xslInstruction The stylesheet element context (depricated -- I do
  -   *      not think we need this).
      * @param template The owning template context.
  -   * @param sourceNodeContext The current source node context.
  -   * @param mode The current mode.
  -   * @param selectPattern The XPath with which to perform the selection.
  -   * @param xslToken The current XSLT instruction (depricated -- I do not
  -   *     think we want this).
  -   * @param tcontext The TransformerImpl context.
  -   * @param selectStackFrameIndex The stack frame context for executing the
  -   *                              select statement.
  +   * 
  +   * @throws TransformerException Thrown in a variety of circumstances.
      */
     public void transformSelectedNodes(
  -          TransformerImpl transformer, Node sourceNode, ElemTemplateElement template, QName mode)
  +          TransformerImpl transformer, ElemTemplateElement template)
               throws TransformerException
     {
       try
  @@ -385,6 +361,7 @@
         boolean rdebug = TransformerImpl.S_DEBUG;
         XPathContext xctxt = transformer.getXPathContext();
         XPath selectPattern = getSelectOrDefault();
  +      int sourceNode = xctxt.getCurrentNode();
         XObject selectResult = selectPattern.execute(xctxt, sourceNode, this);
         
         if (rdebug)
  @@ -392,7 +369,7 @@
                                                           "test", selectPattern, selectResult);
         
         Vector keys = transformer.processSortKeys(this, sourceNode);
  -      NodeIterator sourceNodes = selectResult.nodeset();
  +      DTMIterator sourceNodes = selectResult.nodeset();
   
         // Sort if we need to.
         if (null != keys)
  @@ -401,14 +378,14 @@
         // The returned value is only relevant for ElemApplyTemplates.
         // This value needs to be passed to popParams which will
         // restore it in the variable stack.
  -      int savedSearchStart = pushParams(transformer, xctxt, sourceNode, mode);
  +      int savedSearchStart = pushParams(transformer, xctxt);
   
         // Push the ContextNodeList on a stack, so that select="position()"
         // and the like will work.
         // System.out.println("pushing context node list...");
         SourceLocator savedLocator = xctxt.getSAXLocator();
   
  -      xctxt.pushContextNodeList((ContextNodeList) sourceNodes);
  +      xctxt.pushContextNodeList(sourceNodes);
         transformer.pushElemTemplateElement(null);
   
         ResultTreeHandler rth = transformer.getResultTreeHandler();
  @@ -423,38 +400,33 @@
         
         try
         {
  -        Node child;
  +        int child;
   
  -        while (null != (child = sourceNodes.nextNode()))
  +        while (DTM.NULL != (child = sourceNodes.nextNode()))
           {
  +          DTM dtm = xctxt.getDTM(child);
             if (needToFindTemplate)
             {
  +            QName mode = transformer.getMode();
  +            
               template = tl.getTemplate(xctxt, child, mode, -1, quiet);
   
               // If that didn't locate a node, fall back to a default template rule.
               // See http://www.w3.org/TR/xslt#built-in-rule.
               if (null == template)
               {
  -              switch (child.getNodeType())
  +              switch (dtm.getNodeType(child))
                 {
  -              case Node.DOCUMENT_FRAGMENT_NODE :
  -              case Node.ELEMENT_NODE :
  +              case DTM.DOCUMENT_FRAGMENT_NODE :
  +              case DTM.ELEMENT_NODE :
                   template = sroot.getDefaultRule();
                   break;
  -              case Node.ATTRIBUTE_NODE :
  -              case Node.CDATA_SECTION_NODE :
  -              case Node.TEXT_NODE :
  -                if (child.isSupported(SaxEventDispatch.SUPPORTSINTERFACE, "1.0"))
  -                {
  -                  ((SaxEventDispatch) child).dispatchCharactersEvent(rth);
  -                }
  -                else
  -                {
  -                  String data = child.getNodeValue();
  -                  rth.characters(data.toCharArray(), 0, data.length());
  -                }
  +              case DTM.ATTRIBUTE_NODE :
  +              case DTM.CDATA_SECTION_NODE :
  +              case DTM.TEXT_NODE :
  +                dtm.dispatchCharactersEvents(child, rth);
                   continue;
  -              case Node.DOCUMENT_NODE :
  +              case DTM.DOCUMENT_NODE :
                   template = sroot.getDefaultRootRule();
                   break;
                 default :
  @@ -480,13 +452,13 @@
   
               // Fire a trace event for the template.
               if (rdebug)
  -              transformer.getTraceManager().fireTraceEvent(child, mode,
  -                                                           template);
  +              transformer.getTraceManager().fireTraceEvent(template);
   
               // And execute the child templates.
  -            if (template.isCompiledTemplate())
  -              template.execute(transformer, child, mode);
  -            else
  +            // %TBD% ???
  +//            if (template.isCompiledTemplate())
  +//              template.execute(transformer, child, mode);
  +//            else
               {
   
                 // Loop through the children of the template, calling execute on 
  @@ -496,7 +468,7 @@
                 {
                   xctxt.setSAXLocator(t);
                   transformer.setCurrentElement(t);
  -                t.execute(transformer, child, mode);
  +                t.execute(transformer);
                 }
               }
               reMarkParams(xctxt);
  @@ -539,10 +511,8 @@
      * @param newChild Child to add to child list
      *
      * @return Child just added to child list
  -   *
  -   * @throws DOMException
      */
  -  public Node appendChild(Node newChild) throws DOMException
  +  public ElemTemplateElement appendChild(ElemTemplateElement newChild)
     {
   
       int type = ((ElemTemplateElement) newChild).getXSLToken();
  
  
  
  1.9.2.1   +7 -5      xml-xalan/java/src/org/apache/xalan/templates/ElemIf.java
  
  Index: ElemIf.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemIf.java,v
  retrieving revision 1.9
  retrieving revision 1.9.2.1
  diff -u -r1.9 -r1.9.2.1
  --- ElemIf.java	2001/02/13 20:28:57	1.9
  +++ ElemIf.java	2001/04/10 18:44:48	1.9.2.1
  @@ -56,7 +56,8 @@
    */
   package org.apache.xalan.templates;
   
  -import org.w3c.dom.*;
  +//import org.w3c.dom.*;
  +import org.apache.xml.dtm.DTM;
   
   import org.xml.sax.*;
   
  @@ -147,23 +148,24 @@
      * @throws TransformerException
      */
     public void execute(
  -          TransformerImpl transformer, Node sourceNode, QName mode)
  +          TransformerImpl transformer)
               throws TransformerException
     {
   
       if (TransformerImpl.S_DEBUG)
  -      transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
  +      transformer.getTraceManager().fireTraceEvent(this);
   
       XPathContext xctxt = transformer.getXPathContext();
  +    
  +    int sourceNode = xctxt.getCurrentNode();
       XObject test = m_test.execute(xctxt, sourceNode, this);
  -
       if (TransformerImpl.S_DEBUG)
         transformer.getTraceManager().fireSelectedEvent(sourceNode, this,
                 "test", m_test, test);
   
       if (test.bool())
       {
  -      transformer.executeChildTemplates(this, sourceNode, mode, true);
  +      transformer.executeChildTemplates(this, true);
       }
     }
   }
  
  
  
  1.25.2.1  +6 -4      xml-xalan/java/src/org/apache/xalan/templates/ElemLiteralResult.java
  
  Index: ElemLiteralResult.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemLiteralResult.java,v
  retrieving revision 1.25
  retrieving revision 1.25.2.1
  diff -u -r1.25 -r1.25.2.1
  --- ElemLiteralResult.java	2001/03/28 04:41:03	1.25
  +++ ElemLiteralResult.java	2001/04/10 18:44:48	1.25.2.1
  @@ -56,7 +56,8 @@
    */
   package org.apache.xalan.templates;
   
  -import org.w3c.dom.*;
  +//import org.w3c.dom.*;
  +import org.apache.xml.dtm.DTM;
   
   import org.xml.sax.*;
   import org.xml.sax.helpers.*;
  @@ -589,7 +590,7 @@
      * @throws TransformerException
      */
     public void execute(
  -          TransformerImpl transformer, Node sourceNode, QName mode)
  +          TransformerImpl transformer)
               throws TransformerException
     {
   
  @@ -605,7 +606,7 @@
         {
   
           // Process any possible attributes from xsl:use-attribute-sets first
  -        super.execute(transformer, sourceNode, mode);
  +        super.execute(transformer);
   
           //xsl:version, excludeResultPrefixes???
           // Process the list of avts next
  @@ -617,6 +618,7 @@
             {
               AVT avt = (AVT) m_avts.elementAt(i);
               XPathContext xctxt = transformer.getXPathContext();
  +            int sourceNode = xctxt.getCurrentNode();
               String stringedValue = avt.evaluate(xctxt, sourceNode, this);
   
               if (null != stringedValue)
  @@ -634,7 +636,7 @@
   
           // Now process all the elements in this subtree
           // TODO: Process m_extensionElementPrefixes && m_attributeSetsNames
  -        transformer.executeChildTemplates(this, sourceNode, mode, true);
  +        transformer.executeChildTemplates(this, true);
         }
         finally
         {
  
  
  
  1.10.2.1  +4 -4      xml-xalan/java/src/org/apache/xalan/templates/ElemMessage.java
  
  Index: ElemMessage.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemMessage.java,v
  retrieving revision 1.10
  retrieving revision 1.10.2.1
  diff -u -r1.10 -r1.10.2.1
  --- ElemMessage.java	2001/01/26 01:46:01	1.10
  +++ ElemMessage.java	2001/04/10 18:44:48	1.10.2.1
  @@ -56,7 +56,7 @@
    */
   package org.apache.xalan.templates;
   
  -import org.w3c.dom.*;
  +//import org.w3c.dom.*;
   
   import org.xml.sax.*;
   
  @@ -152,14 +152,14 @@
      * @throws TransformerException
      */
     public void execute(
  -          TransformerImpl transformer, Node sourceNode, QName mode)
  +          TransformerImpl transformer)
               throws TransformerException
     {
   
       if (TransformerImpl.S_DEBUG)
  -      transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
  +      transformer.getTraceManager().fireTraceEvent(this);
   
  -    String data = transformer.transformToString(this, sourceNode, mode);
  +    String data = transformer.transformToString(this);
   
       transformer.getMsgMgr().message(this, data, m_terminate);
       
  
  
  
  1.18.2.1  +72 -63    xml-xalan/java/src/org/apache/xalan/templates/ElemNumber.java
  
  Index: ElemNumber.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemNumber.java,v
  retrieving revision 1.18
  retrieving revision 1.18.2.1
  diff -u -r1.18 -r1.18.2.1
  --- ElemNumber.java	2001/02/12 20:21:47	1.18
  +++ ElemNumber.java	2001/04/10 18:44:48	1.18.2.1
  @@ -58,8 +58,10 @@
   
   import org.apache.xml.utils.res.XResourceBundle;
   
  -import org.w3c.dom.*;
  -import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.*;
  +//import org.w3c.dom.traversal.NodeIterator;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
   
   import org.xml.sax.*;
   
  @@ -508,13 +510,14 @@
      * @throws TransformerException
      */
     public void execute(
  -          TransformerImpl transformer, Node sourceNode, QName mode)
  +          TransformerImpl transformer)
               throws TransformerException
     {
   
       if (TransformerImpl.S_DEBUG)
  -      transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
  +      transformer.getTraceManager().fireTraceEvent(this);
   
  +    int sourceNode = transformer.getXPathContext().getCurrentNode();
       String countString = getCountString(transformer, sourceNode);
   
       try
  @@ -537,7 +540,7 @@
      *
      * @throws DOMException
      */
  -  public Node appendChild(Node newChild) throws DOMException
  +  public ElemTemplateElement appendChild(ElemTemplateElement newChild)
     {
   
       error(XSLTErrorResources.ER_CANNOT_ADD,
  @@ -564,12 +567,13 @@
      *
      * @throws javax.xml.transform.TransformerException
      */
  -  Node findAncestor(
  -          XPathContext xctxt, XPath fromMatchPattern, XPath countMatchPattern, Node context, Element namespaceContext)
  +  int findAncestor(
  +          XPathContext xctxt, XPath fromMatchPattern, XPath countMatchPattern, 
  +          int context, ElemNumber namespaceContext)
               throws javax.xml.transform.TransformerException
     {
  -
  -    while (null != context)
  +    DTM dtm = xctxt.getDTM(context);
  +    while (DTM.NULL != context)
       {
         if (null != fromMatchPattern)
         {
  @@ -591,7 +595,7 @@
           }
         }
   
  -      context = xctxt.getDOMHelper().getParentOfNode(context);
  +      context = dtm.getParent(context);
       }
   
       return context;
  @@ -613,19 +617,20 @@
      *
      * @throws javax.xml.transform.TransformerException
      */
  -  private Node findPrecedingOrAncestorOrSelf(
  -          XPathContext xctxt, XPath fromMatchPattern, XPath countMatchPattern, Node context, Element namespaceContext)
  +  private int findPrecedingOrAncestorOrSelf(
  +          XPathContext xctxt, XPath fromMatchPattern, XPath countMatchPattern, 
  +          int context, ElemNumber namespaceContext)
               throws javax.xml.transform.TransformerException
     {
  -
  -    while (null != context)
  +    DTM dtm = xctxt.getDTM(context);
  +    while (DTM.NULL != context)
       {
         if (null != fromMatchPattern)
         {
           if (fromMatchPattern.getMatchScore(xctxt, context)
                   != XPath.MATCH_SCORE_NONE)
           {
  -          context = null;
  +          context = DTM.NULL;
   
             break;
           }
  @@ -640,19 +645,19 @@
           }
         }
   
  -      Node prevSibling = context.getPreviousSibling();
  +      int prevSibling = dtm.getPreviousSibling(context);
   
  -      if (null == prevSibling)
  +      if (DTM.NULL == prevSibling)
         {
  -        context = xctxt.getDOMHelper().getParentOfNode(context);
  +        context = dtm.getParent(context);
         }
         else
         {
   
           // Now go down the chain of children of this sibling 
  -        context = prevSibling.getLastChild();
  +        context = dtm.getLastChild(prevSibling);
   
  -        if (context == null)
  +        if (context == DTM.NULL)
             context = prevSibling;
         }
       }
  @@ -670,48 +675,48 @@
      *
      * @throws javax.xml.transform.TransformerException
      */
  -  XPath getCountMatchPattern(XPathContext support, Node contextNode)
  +  XPath getCountMatchPattern(XPathContext support, int contextNode)
             throws javax.xml.transform.TransformerException
     {
   
       XPath countMatchPattern = m_countMatchPattern;
  -
  +    DTM dtm = support.getDTM(contextNode);
       if (null == countMatchPattern)
       {
  -      switch (contextNode.getNodeType())
  +      switch (dtm.getNodeType(contextNode))
         {
  -      case Node.ELEMENT_NODE :
  +      case DTM.ELEMENT_NODE :
   
           // countMatchPattern = m_stylesheet.createMatchPattern(contextNode.getNodeName(), this);
  -        countMatchPattern = new XPath(contextNode.getNodeName(), this, this,
  +        countMatchPattern = new XPath(dtm.getNodeName(contextNode), this, this,
                                         XPath.MATCH, support.getErrorListener());
           break;
  -      case Node.ATTRIBUTE_NODE :
  +      case DTM.ATTRIBUTE_NODE :
   
           // countMatchPattern = m_stylesheet.createMatchPattern("@"+contextNode.getNodeName(), this);
  -        countMatchPattern = new XPath("@" + contextNode.getNodeName(), this,
  +        countMatchPattern = new XPath("@" + dtm.getNodeName(contextNode), this,
                                         this, XPath.MATCH, support.getErrorListener());
           break;
  -      case Node.CDATA_SECTION_NODE :
  -      case Node.TEXT_NODE :
  +      case DTM.CDATA_SECTION_NODE :
  +      case DTM.TEXT_NODE :
   
           // countMatchPattern = m_stylesheet.createMatchPattern("text()", this);
           countMatchPattern = new XPath("text()", this, this, XPath.MATCH, support.getErrorListener());
           break;
  -      case Node.COMMENT_NODE :
  +      case DTM.COMMENT_NODE :
   
           // countMatchPattern = m_stylesheet.createMatchPattern("comment()", this);
           countMatchPattern = new XPath("comment()", this, this, XPath.MATCH, support.getErrorListener());
           break;
  -      case Node.DOCUMENT_NODE :
  +      case DTM.DOCUMENT_NODE :
   
           // countMatchPattern = m_stylesheet.createMatchPattern("/", this);
           countMatchPattern = new XPath("/", this, this, XPath.MATCH, support.getErrorListener());
           break;
  -      case Node.PROCESSING_INSTRUCTION_NODE :
  +      case DTM.PROCESSING_INSTRUCTION_NODE :
   
           // countMatchPattern = m_stylesheet.createMatchPattern("pi("+contextNode.getNodeName()+")", this);
  -        countMatchPattern = new XPath("pi(" + contextNode.getNodeName()
  +        countMatchPattern = new XPath("pi(" + dtm.getNodeName(contextNode)
                                         + ")", this, this, XPath.MATCH, support.getErrorListener());
           break;
         default :
  @@ -732,7 +737,7 @@
      *
      * @throws TransformerException
      */
  -  String getCountString(TransformerImpl transformer, Node sourceNode)
  +  String getCountString(TransformerImpl transformer, int sourceNode)
             throws TransformerException
     {
   
  @@ -768,7 +773,7 @@
   
             for (int i = lastIndex; i >= 0; i--)
             {
  -            Node target = ancestors.elementAt(i);
  +            int target = ancestors.elementAt(i);
   
               list[lastIndex - i] = ctable.countNode(xctxt, this, target);
             }
  @@ -790,11 +795,12 @@
      *
      * @throws TransformerException
      */
  -  public Node getPreviousNode(XPathContext xctxt, Node pos)
  +  public int getPreviousNode(XPathContext xctxt, int pos)
             throws TransformerException
     {
   
       XPath countMatchPattern = getCountMatchPattern(xctxt, pos);
  +    DTM dtm = xctxt.getDTM(pos);
   
       if (Constants.NUMBERLEVEL_ANY == m_level)
       {
  @@ -803,22 +809,23 @@
         // Do a backwards document-order walk 'till a node is found that matches 
         // the 'from' pattern, or a node is found that matches the 'count' pattern, 
         // or the top of the tree is found.
  -      while (null != pos)
  +      while (DTM.NULL != pos)
         {
   
           // Get the previous sibling, if there is no previous sibling, 
           // then count the parent, but if there is a previous sibling, 
           // dive down to the lowest right-hand (last) child of that sibling.
  -        Node next = pos.getPreviousSibling();
  +        int next = dtm.getPreviousSibling(pos);
   
  -        if (null == next)
  +        if (DTM.NULL == next)
           {
  -          next = pos.getParentNode();
  +          next = dtm.getParent(pos);
   
  -          if ((null != next) && ((((null != fromMatchPattern) && (fromMatchPattern.getMatchScore(
  -                  xctxt, next) != XPath.MATCH_SCORE_NONE))) || (next.getNodeType() == Node.DOCUMENT_NODE)))
  +          if ((DTM.NULL != next) && ((((null != fromMatchPattern) && (fromMatchPattern.getMatchScore(
  +                  xctxt, next) != XPath.MATCH_SCORE_NONE))) 
  +              || (dtm.getNodeType(next) == DTM.DOCUMENT_NODE)))
             {
  -            pos = null;  // return null from function.
  +            pos = DTM.NULL;  // return null from function.
   
               break;  // from while loop
             }
  @@ -827,20 +834,20 @@
           {
   
             // dive down to the lowest right child.
  -          Node child = next;
  +          int child = next;
   
  -          while (null != child)
  +          while (DTM.NULL != child)
             {
  -            child = next.getLastChild();
  +            child = dtm.getLastChild(next);
   
  -            if (null != child)
  +            if (DTM.NULL != child)
                 next = child;
             }
           }
   
           pos = next;
   
  -        if ((null != pos)
  +        if ((DTM.NULL != pos)
                   && ((null == countMatchPattern)
                       || (countMatchPattern.getMatchScore(xctxt, pos)
                           != XPath.MATCH_SCORE_NONE)))
  @@ -851,11 +858,11 @@
       }
       else  // NUMBERLEVEL_MULTI or NUMBERLEVEL_SINGLE
       {
  -      while (null != pos)
  +      while (DTM.NULL != pos)
         {
  -        pos = pos.getPreviousSibling();
  +        pos = dtm.getPreviousSibling(pos);
   
  -        if ((null != pos)
  +        if ((DTM.NULL != pos)
                   && ((null == countMatchPattern)
                       || (countMatchPattern.getMatchScore(xctxt, pos)
                           != XPath.MATCH_SCORE_NONE)))
  @@ -878,11 +885,11 @@
      *
      * @throws TransformerException
      */
  -  public Node getTargetNode(XPathContext xctxt, Node sourceNode)
  +  public int getTargetNode(XPathContext xctxt, int sourceNode)
             throws TransformerException
     {
   
  -    Node target = null;
  +    int target = DTM.NULL;
       XPath countMatchPattern = getCountMatchPattern(xctxt, sourceNode);
   
       if (Constants.NUMBERLEVEL_ANY == m_level)
  @@ -916,14 +923,15 @@
      * @throws javax.xml.transform.TransformerException
      */
     NodeVector getMatchingAncestors(
  -          XPathContext xctxt, Node node, boolean stopAtFirstFound)
  +          XPathContext xctxt, int node, boolean stopAtFirstFound)
               throws javax.xml.transform.TransformerException
     {
   
       NodeSet ancestors = new NodeSet();
       XPath countMatchPattern = getCountMatchPattern(xctxt, node);
  +    DTM dtm = xctxt.getDTM(node);
   
  -    while (null != node)
  +    while (DTM.NULL != node)
       {
         if ((null != m_fromMatchPattern)
                 && (m_fromMatchPattern.getMatchScore(xctxt, node)
  @@ -953,7 +961,7 @@
             break;
         }
   
  -      node = xctxt.getDOMHelper().getParentOfNode(node);
  +      node = dtm.getParent(node);
       }
   
       return ancestors;
  @@ -970,7 +978,7 @@
      *
      * @throws TransformerException
      */
  -  Locale getLocale(TransformerImpl transformer, Node contextNode)
  +  Locale getLocale(TransformerImpl transformer, int contextNode)
             throws TransformerException
     {
   
  @@ -992,9 +1000,10 @@
           //Locale.getDefault().getDisplayCountry());
           if (null == locale)
           {
  -          transformer.getMsgMgr().warn(this, null, contextNode,
  -                                       XSLTErrorResources.WG_LOCALE_NOT_FOUND,
  -                                       new Object[]{ langValue });  //"Warning: Could not find locale for xml:lang="+langValue);
  +          // %TBD%
  +//          transformer.getMsgMgr().warn(this, null, contextNode,
  +//                                       XSLTErrorResources.WG_LOCALE_NOT_FOUND,
  +//                                       new Object[]{ langValue });  //"Warning: Could not find locale for xml:lang="+langValue);
   
             locale = Locale.getDefault();
           }
  @@ -1019,7 +1028,7 @@
      * @throws TransformerException
      */
     private DecimalFormat getNumberFormatter(
  -          TransformerImpl transformer, Node contextNode) throws TransformerException
  +          TransformerImpl transformer, int contextNode) throws TransformerException
     {
       // Patch from Steven Serocki
       // Maybe we really want to do the clone in getLocale() and return  
  @@ -1078,7 +1087,7 @@
      * @throws TransformerException
      */
     String formatNumberList(
  -          TransformerImpl transformer, int[] list, Node contextNode)
  +          TransformerImpl transformer, int[] list, int contextNode)
               throws TransformerException
     {
   
  @@ -1235,7 +1244,7 @@
      * @throws javax.xml.transform.TransformerException
      */
     private void getFormattedNumber(
  -          TransformerImpl transformer, Node contextNode, 
  +          TransformerImpl transformer, int contextNode, 
             char numberType, int numberWidth, int listElement, 
             FastStringBuffer formattedNumber)
               throws javax.xml.transform.TransformerException
  
  
  
  1.9.2.1   +11 -8     xml-xalan/java/src/org/apache/xalan/templates/ElemPI.java
  
  Index: ElemPI.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemPI.java,v
  retrieving revision 1.9
  retrieving revision 1.9.2.1
  diff -u -r1.9 -r1.9.2.1
  --- ElemPI.java	2001/01/02 03:36:46	1.9
  +++ ElemPI.java	2001/04/10 18:44:48	1.9.2.1
  @@ -56,7 +56,8 @@
    */
   package org.apache.xalan.templates;
   
  -import org.w3c.dom.*;
  +//import org.w3c.dom.*;
  +import org.apache.xml.dtm.DTM;
   
   import org.xml.sax.*;
   
  @@ -147,19 +148,21 @@
      * @throws TransformerException
      */
     public void execute(
  -          TransformerImpl transformer, Node sourceNode, QName mode)
  +          TransformerImpl transformer)
               throws TransformerException
     {
   
       if (TransformerImpl.S_DEBUG)
  -      transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
  +      transformer.getTraceManager().fireTraceEvent(this);
   
  -    String piName = m_name_atv.evaluate(transformer.getXPathContext(),
  -                                        sourceNode, this);
  +    XPathContext xctxt = transformer.getXPathContext();
  +    int sourceNode = xctxt.getCurrentNode();
  +    String piName = m_name_atv.evaluate(xctxt, sourceNode, this);
   
       if (piName.equalsIgnoreCase("xml"))
       {
  -      error(XSLTErrorResources.ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML);  //"processing-instruction name can not be 'xml'");
  +      // %TBD%
  +//      error(XSLTErrorResources.ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML);  //"processing-instruction name can not be 'xml'");
       }
       else if (!isValidNCName(piName))
       {
  @@ -175,7 +178,7 @@
       // | xsl:element
       // | xsl:attribute
       // ">
  -    String data = transformer.transformToString(this, sourceNode, mode);
  +    String data = transformer.transformToString(this);
   
       try
       {
  @@ -196,7 +199,7 @@
      *
      * @throws DOMException
      */
  -  public Node appendChild(Node newChild) throws DOMException
  +  public ElemTemplateElement appendChild(ElemTemplateElement newChild)
     {
   
       int type = ((ElemTemplateElement) newChild).getXSLToken();
  
  
  
  1.10.2.1  +3 -3      xml-xalan/java/src/org/apache/xalan/templates/ElemParam.java
  
  Index: ElemParam.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemParam.java,v
  retrieving revision 1.10
  retrieving revision 1.10.2.1
  diff -u -r1.10 -r1.10.2.1
  --- ElemParam.java	2001/03/07 04:27:17	1.10
  +++ ElemParam.java	2001/04/10 18:44:49	1.10.2.1
  @@ -136,7 +136,7 @@
      * @throws TransformerException
      */
     public void execute(
  -          TransformerImpl transformer, Node sourceNode, QName mode)
  +          TransformerImpl transformer)
               throws TransformerException
     {
   
  @@ -145,13 +145,13 @@
   
       if (null == arg)
       {
  -      super.execute(transformer, sourceNode, mode);
  +      super.execute(transformer);
       }
       else
       {
         arg.setIsVisible(true);
         if (TransformerImpl.S_DEBUG)
  -        transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
  +        transformer.getTraceManager().fireTraceEvent(this);
       }
     }
   }
  
  
  
  1.12.2.1  +15 -15    xml-xalan/java/src/org/apache/xalan/templates/ElemTemplate.java
  
  Index: ElemTemplate.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemTemplate.java,v
  retrieving revision 1.12
  retrieving revision 1.12.2.1
  diff -u -r1.12 -r1.12.2.1
  --- ElemTemplate.java	2001/02/13 20:28:57	1.12
  +++ ElemTemplate.java	2001/04/10 18:44:49	1.12.2.1
  @@ -368,25 +368,25 @@
      * @throws TransformerException
      */
     public void execute(
  -          TransformerImpl transformer, Node sourceNode, QName mode)
  +          TransformerImpl transformer)
               throws TransformerException
     {
  -
       if (TransformerImpl.S_DEBUG)
  -      transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
  -
  -    if (null != sourceNode)
  -    {
  -      transformer.executeChildTemplates(this, sourceNode, mode, true);
  -    }
  -    else  // if(null == sourceNode)
  -    {
  -      transformer.getMsgMgr().error(this,
  -        this, sourceNode,
  -        XSLTErrorResources.ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES);
  +      transformer.getTraceManager().fireTraceEvent(this);
   
  -      //"sourceNode is null in handleApplyTemplatesInstruction!");
  -    }
  +      // %REVIEW% commenting out of the code below.
  +//    if (null != sourceNode)
  +//    {
  +      transformer.executeChildTemplates(this, true);
  +//    }
  +//    else  // if(null == sourceNode)
  +//    {
  +//      transformer.getMsgMgr().error(this,
  +//        this, sourceNode,
  +//        XSLTErrorResources.ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES);
  +//
  +//      //"sourceNode is null in handleApplyTemplatesInstruction!");
  +//    }
     }
   
     /**
  
  
  
  1.38.2.1  +254 -102  xml-xalan/java/src/org/apache/xalan/templates/ElemTemplateElement.java
  
  Index: ElemTemplateElement.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemTemplateElement.java,v
  retrieving revision 1.38
  retrieving revision 1.38.2.1
  diff -u -r1.38 -r1.38.2.1
  --- ElemTemplateElement.java	2001/03/18 09:26:57	1.38
  +++ ElemTemplateElement.java	2001/04/10 18:44:49	1.38.2.1
  @@ -82,10 +82,11 @@
   import javax.xml.transform.SourceLocator;
   
   // DOM Imports
  -import org.w3c.dom.Node;
  -import org.w3c.dom.NodeList;
  -import org.w3c.dom.DOMException;
  -import org.w3c.dom.Document;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.NodeList;
  +//import org.w3c.dom.DOMException;
  +//import org.w3c.dom.Document;
  +import org.apache.xml.dtm.DTM;
   
   // SAX Imports
   import org.xml.sax.Locator;
  @@ -105,7 +106,7 @@
    *
    * @see Stylesheet
    */
  -public class ElemTemplateElement extends UnImplNode
  +public class ElemTemplateElement /* %TBD% extends UnImplNode */
           implements PrefixResolver, Serializable, SourceLocator, 
                      WhitespaceStrippingElementMatcher
   {
  @@ -175,7 +176,7 @@
      * @throws TransformerException if any checked exception occurs.
      */
     public void execute(
  -          TransformerImpl transformer, Node sourceNode, QName mode)
  +          TransformerImpl transformer)
               throws TransformerException{}
   
     /**
  @@ -283,6 +284,18 @@
     }
     
     /**
  +   * Throw an error.
  +   *
  +   * @param msg Message code for the error
  +   */
  +  public void error(int msg)
  +  {
  +    error(
  +      XSLMessages.createMessage(
  +        XSLTErrorResources.ER_ELEMTEMPLATEELEM_ERR, null));
  +  }
  +  
  +  /**
      * Throw a template element runtime error.  (Note: should we throw a TransformerException instead?)
      *
      * @param msg Description of the error that occured.
  @@ -295,6 +308,45 @@
     
   
     // Implemented DOM Element methods.
  +// %TBD%
  +//  /**
  +//   * Add a child to the child list.
  +//   * NOTE: This presumes the child did not previously have a parent.
  +//   * Making that assumption makes this a less expensive operation -- but
  +//   * requires that if you *do* want to reparent a node, you use removeChild()
  +//   * first to remove it from its previous context. Failing to do so will
  +//   * damage the tree.
  +//   *
  +//   * @param newChild Child to be added to child list
  +//   *
  +//   * @return Child just added to the child list
  +//   * @throws DOMException
  +//   */
  +//  public Node appendChild(Node newChild) throws DOMException
  +//  {
  +//
  +//    if (null == newChild)
  +//    {
  +//      error(XSLTErrorResources.ER_NULL_CHILD, null);  //"Trying to add a null child!");
  +//    }
  +//
  +//    ElemTemplateElement elem = (ElemTemplateElement) newChild;
  +//
  +//    if (null == m_firstChild)
  +//    {
  +//      m_firstChild = elem;
  +//    }
  +//    else
  +//    {
  +//      ElemTemplateElement last = (ElemTemplateElement) getLastChild();
  +//
  +//      last.m_nextSibling = elem;
  +//    }
  +//
  +//    elem.m_parentNode = this;
  +//
  +//    return newChild;
  +//  }
   
     /**
      * Add a child to the child list.
  @@ -307,34 +359,32 @@
      * @param newChild Child to be added to child list
      *
      * @return Child just added to the child list
  -   * @throws DOMException
      */
  -  public Node appendChild(Node newChild) throws DOMException
  +  public ElemTemplateElement appendChild(ElemTemplateElement elem)
     {
   
  -    if (null == newChild)
  +    if (null == elem)
       {
         error(XSLTErrorResources.ER_NULL_CHILD, null);  //"Trying to add a null child!");
       }
   
  -    ElemTemplateElement elem = (ElemTemplateElement) newChild;
  -
       if (null == m_firstChild)
       {
         m_firstChild = elem;
       }
       else
       {
  -      ElemTemplateElement last = (ElemTemplateElement) getLastChild();
  +      ElemTemplateElement last = getLastChildElem();
   
         last.m_nextSibling = elem;
       }
   
       elem.m_parentNode = this;
   
  -    return newChild;
  +    return elem;
     }
   
  +
     /**
      * Tell if there are child nodes.
      *
  @@ -352,18 +402,19 @@
      */
     public short getNodeType()
     {
  -    return Node.ELEMENT_NODE;
  +    return org.w3c.dom.Node.ELEMENT_NODE;
     }
   
  -  /**
  -   * Return the nodelist (same reference).
  -   *
  -   * @return The nodelist containing the child nodes (this)
  -   */
  -  public NodeList getChildNodes()
  -  {
  -    return this;
  -  }
  +  // %TBD%
  +//  /**
  +//   * Return the nodelist (same reference).
  +//   *
  +//   * @return The nodelist containing the child nodes (this)
  +//   */
  +//  public NodeList getChildNodes()
  +//  {
  +//    return this;
  +//  }
   
     /**
      * Remove a child.
  @@ -378,10 +429,8 @@
      *
      * @return the removed child, or null if the specified
      * node was not a child of this element.
  -   *
  -   * @throws DOMException
      */
  -  public Node removeChild(ElemTemplateElement childETE) throws DOMException
  +  public ElemTemplateElement removeChild(ElemTemplateElement childETE)
     {
   
       if (childETE == null || childETE.m_parentNode != this)
  @@ -392,8 +441,7 @@
         m_firstChild = childETE.m_nextSibling;
       else
       {
  -      ElemTemplateElement prev =
  -        (ElemTemplateElement) (childETE.getPreviousSibling());
  +      ElemTemplateElement prev = childETE.getPreviousSiblingElem();
   
         prev.m_nextSibling = childETE.m_nextSibling;
       }
  @@ -405,6 +453,47 @@
       return childETE;
     }
   
  +  // %TBD%
  +//  /**
  +//   * Replace the old child with a new child.
  +//   *
  +//   * @param newChild New child to replace with
  +//   * @param oldChild Old child to be replaced
  +//   *
  +//   * @return The new child
  +//   *
  +//   * @throws DOMException
  +//   */
  +//  public Node replaceChild(Node newChild, Node oldChild) throws DOMException
  +//  {
  +//
  +//    if (oldChild == null || oldChild.getParentNode() != this)
  +//      return null;
  +//
  +//    ElemTemplateElement newChildElem = ((ElemTemplateElement) newChild);
  +//    ElemTemplateElement oldChildElem = ((ElemTemplateElement) oldChild);
  +//
  +//    // Fix up previous sibling.
  +//    ElemTemplateElement prev =
  +//      (ElemTemplateElement) oldChildElem.getPreviousSibling();
  +//
  +//    if (null != prev)
  +//      prev.m_nextSibling = newChildElem;
  +//
  +//    // Fix up parent (this)
  +//    if (m_firstChild == oldChildElem)
  +//      m_firstChild = newChildElem;
  +//
  +//    newChildElem.m_parentNode = this;
  +//    oldChildElem.m_parentNode = null;
  +//    newChildElem.m_nextSibling = oldChildElem.m_nextSibling;
  +//    oldChildElem.m_nextSibling = null;
  +//
  +//    // newChildElem.m_stylesheet = oldChildElem.m_stylesheet;
  +//    // oldChildElem.m_stylesheet = null;
  +//    return newChildElem;
  +//  }
  +
     /**
      * Replace the old child with a new child.
      *
  @@ -415,18 +504,16 @@
      *
      * @throws DOMException
      */
  -  public Node replaceChild(Node newChild, Node oldChild) throws DOMException
  +  public ElemTemplateElement replaceChild(ElemTemplateElement newChildElem, 
  +                                          ElemTemplateElement oldChildElem)
     {
   
  -    if (oldChild == null || oldChild.getParentNode() != this)
  +    if (oldChildElem == null || oldChildElem.getParentElem() != this)
         return null;
   
  -    ElemTemplateElement newChildElem = ((ElemTemplateElement) newChild);
  -    ElemTemplateElement oldChildElem = ((ElemTemplateElement) oldChild);
  -
       // Fix up previous sibling.
       ElemTemplateElement prev =
  -      (ElemTemplateElement) oldChildElem.getPreviousSibling();
  +      oldChildElem.getPreviousSiblingElem();
   
       if (null != prev)
         prev.m_nextSibling = newChildElem;
  @@ -467,40 +554,42 @@
       return count;
     }  // getLength():int
   
  -  /**
  -   * NodeList method: Return the Nth immediate child of this node, or
  -   * null if the index is out of bounds.
  -   *
  -   * @param index Index of child to find
  -   * @return org.w3c.dom.Node: the child node at given index
  -   */
  -  public Node item(int index)
  -  {
  +  // %TDB%
  +//  /**
  +//   * NodeList method: Return the Nth immediate child of this node, or
  +//   * null if the index is out of bounds.
  +//   *
  +//   * @param index Index of child to find
  +//   * @return org.w3c.dom.Node: the child node at given index
  +//   */
  +//  public Node item(int index)
  +//  {
  +//
  +//    // It is assumed that the getChildNodes call synchronized
  +//    // the children. Therefore, we can access the first child
  +//    // reference directly.
  +//    ElemTemplateElement node = m_firstChild;
  +//
  +//    for (int i = 0; i < index && node != null; i++)
  +//    {
  +//      node = node.m_nextSibling;
  +//    }
  +//
  +//    return node;
  +//  }  // item(int):Node
  +
  +  // %TBD%
  +//  /**
  +//   * Get the stylesheet owner.
  +//   *
  +//   * @return The stylesheet owner
  +//   */
  +//  public Document getOwnerDocument()
  +//  {
  +//    return getStylesheet();
  +//  }
   
  -    // It is assumed that the getChildNodes call synchronized
  -    // the children. Therefore, we can access the first child
  -    // reference directly.
  -    ElemTemplateElement node = m_firstChild;
  -
  -    for (int i = 0; i < index && node != null; i++)
  -    {
  -      node = node.m_nextSibling;
  -    }
  -
  -    return node;
  -  }  // item(int):Node
  -
     /**
  -   * Get the stylesheet owner.
  -   *
  -   * @return The stylesheet owner
  -   */
  -  public Document getOwnerDocument()
  -  {
  -    return getStylesheet();
  -  }
  -
  -  /**
      * Return the element name.
      *
      * @return The element name
  @@ -885,7 +974,7 @@
         }
       }
   
  -    ElemTemplateElement parent = (ElemTemplateElement) this.getParentNode();
  +    ElemTemplateElement parent = this.getParentNodeElem();
   
       if (null != parent)
       {
  @@ -1039,15 +1128,16 @@
      */
     protected ElemTemplateElement m_parentNode;
   
  -  /**
  -   * Get the parent as a Node.
  -   *
  -   * @return This node's parent node
  -   */
  -  public Node getParentNode()
  -  {
  -    return m_parentNode;
  -  }
  +  // %TBD%
  +//  /**
  +//   * Get the parent as a Node.
  +//   *
  +//   * @return This node's parent node
  +//   */
  +//  public Node getParentNode()
  +//  {
  +//    return m_parentNode;
  +//  }
   
     /**
      * Get the parent as an ElemTemplateElement.
  @@ -1065,15 +1155,42 @@
      */
     ElemTemplateElement m_nextSibling;
   
  -  /**
  -   * Get the next sibling (as a Node) or return null.
  -   *
  -   * @return this node's next sibling or null
  -   */
  -  public Node getNextSibling()
  -  {
  -    return m_nextSibling;
  -  }
  +  // %TBD%
  +//  /**
  +//   * Get the next sibling (as a Node) or return null.
  +//   *
  +//   * @return this node's next sibling or null
  +//   */
  +//  public Node getNextSibling()
  +//  {
  +//    return m_nextSibling;
  +//  }
  +
  +  // %TBD%
  +//  /**
  +//   * Get the previous sibling (as a Node) or return null.
  +//   * Note that this may be expensive if the parent has many kids;
  +//   * we accept that price in exchange for avoiding the prev pointer
  +//   * TODO: If we were sure parents and sibs are always ElemTemplateElements,
  +//   * we could hit the fields directly rather than thru accessors.
  +//   *
  +//   * @return This node's previous sibling or null
  +//   */
  +//  public Node getPreviousSibling()
  +//  {
  +//
  +//    Node walker = getParentNode(), prev = null;
  +//
  +//    if (walker != null)
  +//      for (walker = walker.getFirstChild(); walker != null;
  +//              prev = walker, walker = walker.getNextSibling())
  +//      {
  +//        if (walker == this)
  +//          return prev;
  +//      }
  +//
  +//    return null;
  +//  }
   
     /**
      * Get the previous sibling (as a Node) or return null.
  @@ -1084,14 +1201,15 @@
      *
      * @return This node's previous sibling or null
      */
  -  public Node getPreviousSibling()
  +  public ElemTemplateElement getPreviousSiblingElem()
     {
   
  -    Node walker = getParentNode(), prev = null;
  +    ElemTemplateElement walker = getParentNodeElem();
  +    ElemTemplateElement prev = null;
   
       if (walker != null)
  -      for (walker = walker.getFirstChild(); walker != null;
  -              prev = walker, walker = walker.getNextSibling())
  +      for (walker = walker.getFirstChildElem(); walker != null;
  +              prev = walker, walker = walker.getNextSiblingElem())
         {
           if (walker == this)
             return prev;
  @@ -1100,6 +1218,7 @@
       return null;
     }
   
  +
     /**
      * Get the next sibling (as a ElemTemplateElement) or return null.
      *
  @@ -1109,6 +1228,17 @@
     {
       return m_nextSibling;
     }
  +  
  +  /**
  +   * Get the parent element.
  +   *
  +   * @return This node's next parent (as a ElemTemplateElement) or null 
  +   */
  +  public ElemTemplateElement getParentNodeElem()
  +  {
  +    return m_parentNode;
  +  }
  +
   
     /**
      * First child.
  @@ -1116,15 +1246,16 @@
      */
     ElemTemplateElement m_firstChild;
   
  -  /**
  -   * Get the first child as a Node.
  -   *
  -   * @return This node's first child or null
  -   */
  -  public Node getFirstChild()
  -  {
  -    return m_firstChild;
  -  }
  +  // %TBD%
  +//  /**
  +//   * Get the first child as a Node.
  +//   *
  +//   * @return This node's first child or null
  +//   */
  +//  public Node getFirstChild()
  +//  {
  +//    return m_firstChild;
  +//  }
   
     /**
      * Get the first child as a ElemTemplateElement.
  @@ -1136,12 +1267,32 @@
       return m_firstChild;
     }
   
  +  // %TBD%
  +//  /**
  +//   * Get the last child.
  +//   *
  +//   * @return This node's last child
  +//   */
  +//  public Node getLastChild()
  +//  {
  +//
  +//    ElemTemplateElement lastChild = null;
  +//
  +//    for (ElemTemplateElement node = m_firstChild; node != null;
  +//            node = node.m_nextSibling)
  +//    {
  +//      lastChild = node;
  +//    }
  +//
  +//    return lastChild;
  +//  }
  +
     /**
      * Get the last child.
      *
      * @return This node's last child
      */
  -  public Node getLastChild()
  +  public ElemTemplateElement getLastChildElem()
     {
   
       ElemTemplateElement lastChild = null;
  @@ -1155,8 +1306,9 @@
       return lastChild;
     }
   
  +
     /** DOM backpointer that this element originated from.          */
  -  transient private Node m_DOMBackPointer;
  +  transient private org.w3c.dom.Node m_DOMBackPointer;
   
     /**
      * If this stylesheet was created from a DOM, get the
  @@ -1165,7 +1317,7 @@
      *
      * @return DOM backpointer that this element originated from or null.
      */
  -  public Node getDOMBackPointer()
  +  public org.w3c.dom.Node getDOMBackPointer()
     {
       return m_DOMBackPointer;
     }
  @@ -1177,7 +1329,7 @@
      *
      * @param n DOM backpointer that this element originated from.
      */
  -  public void setDOMBackPointer(Node n)
  +  public void setDOMBackPointer(org.w3c.dom.Node n)
     {
       m_DOMBackPointer = n;
     }
  
  
  
  1.4.2.1   +3 -2      xml-xalan/java/src/org/apache/xalan/templates/ElemText.java
  
  Index: ElemText.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemText.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- ElemText.java	2001/01/02 03:36:46	1.4
  +++ ElemText.java	2001/04/10 18:44:49	1.4.2.1
  @@ -56,7 +56,8 @@
    */
   package org.apache.xalan.templates;
   
  -import org.w3c.dom.*;
  +//import org.w3c.dom.*;
  +import org.apache.xml.dtm.DTM;
   
   import org.xml.sax.*;
   
  @@ -170,7 +171,7 @@
      *
      * @throws DOMException
      */
  -  public Node appendChild(Node newChild) throws DOMException
  +  public ElemTemplateElement appendChild(ElemTemplateElement newChild)
     {
   
       int type = ((ElemTemplateElement) newChild).getXSLToken();
  
  
  
  1.8.2.1   +4 -4      xml-xalan/java/src/org/apache/xalan/templates/ElemTextLiteral.java
  
  Index: ElemTextLiteral.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemTextLiteral.java,v
  retrieving revision 1.8
  retrieving revision 1.8.2.1
  diff -u -r1.8 -r1.8.2.1
  --- ElemTextLiteral.java	2001/01/02 03:36:46	1.8
  +++ ElemTextLiteral.java	2001/04/10 18:44:49	1.8.2.1
  @@ -56,8 +56,8 @@
    */
   package org.apache.xalan.templates;
   
  -import org.w3c.dom.*;
  -
  +//import org.w3c.dom.*;
  + 
   import org.xml.sax.*;
   
   import org.apache.xml.utils.QName;
  @@ -216,13 +216,13 @@
      * @throws TransformerException
      */
     public void execute(
  -          TransformerImpl transformer, Node sourceNode, QName mode)
  +          TransformerImpl transformer)
               throws TransformerException
     {
       try
       {
         if (TransformerImpl.S_DEBUG)
  -        transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
  +        transformer.getTraceManager().fireTraceEvent(this);
   
         ResultTreeHandler rth = transformer.getResultTreeHandler();
         if (m_disableOutputEscaping)
  
  
  
  1.5.2.1   +1 -1      xml-xalan/java/src/org/apache/xalan/templates/ElemUnknown.java
  
  Index: ElemUnknown.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemUnknown.java,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- ElemUnknown.java	2000/12/01 17:50:16	1.5
  +++ ElemUnknown.java	2001/04/10 18:44:50	1.5.2.1
  @@ -96,6 +96,6 @@
      * @throws TransformerException
      */
     public void execute(
  -          TransformerImpl transformer, Node sourceNode, QName mode)
  +          TransformerImpl transformer)
               throws TransformerException{}
   }
  
  
  
  1.10.2.1  +6 -7      xml-xalan/java/src/org/apache/xalan/templates/ElemUse.java
  
  Index: ElemUse.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemUse.java,v
  retrieving revision 1.10
  retrieving revision 1.10.2.1
  diff -u -r1.10 -r1.10.2.1
  --- ElemUse.java	2001/01/02 03:36:47	1.10
  +++ ElemUse.java	2001/04/10 18:44:50	1.10.2.1
  @@ -58,7 +58,7 @@
   
   import java.util.Vector;
   
  -import org.w3c.dom.Node;
  +import org.apache.xml.dtm.DTM;
   
   import javax.xml.transform.TransformerException;
   
  @@ -160,7 +160,7 @@
      * @throws TransformerException
      */
     private void applyAttrSets(
  -          TransformerImpl transformer, StylesheetRoot stylesheet, QName attributeSetsNames[], Node sourceNode, QName mode)
  +          TransformerImpl transformer, StylesheetRoot stylesheet, QName attributeSetsNames[])
               throws TransformerException
     {
   
  @@ -182,7 +182,7 @@
               ElemAttributeSet attrSet =
                 (ElemAttributeSet) attrSets.elementAt(k);
   
  -            attrSet.execute(transformer, sourceNode, mode);
  +            attrSet.execute(transformer);
             }
           }
         }
  @@ -207,17 +207,16 @@
      * @throws TransformerException
      */
     public void execute(
  -          TransformerImpl transformer, Node sourceNode, QName mode)
  +          TransformerImpl transformer)
               throws TransformerException
     {
  -
       if (TransformerImpl.S_DEBUG)
  -      transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
  +      transformer.getTraceManager().fireTraceEvent(this);
   
       if (null != m_attributeSetsNames)
       {
         applyAttrSets(transformer, getStylesheetRoot(),
  -                    m_attributeSetsNames, sourceNode, mode);
  +                    m_attributeSetsNames);
       }
     }
   }
  
  
  
  1.13.2.1  +21 -23    xml-xalan/java/src/org/apache/xalan/templates/ElemValueOf.java
  
  Index: ElemValueOf.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemValueOf.java,v
  retrieving revision 1.13
  retrieving revision 1.13.2.1
  diff -u -r1.13 -r1.13.2.1
  --- ElemValueOf.java	2001/01/12 07:35:55	1.13
  +++ ElemValueOf.java	2001/04/10 18:44:50	1.13.2.1
  @@ -56,7 +56,9 @@
    */
   package org.apache.xalan.templates;
   
  -import org.w3c.dom.*;
  +//import org.w3c.dom.*;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
   
   import org.xml.sax.*;
   
  @@ -227,16 +229,18 @@
      * @throws TransformerException
      */
     public void execute(
  -          TransformerImpl transformer, Node sourceNode, QName mode)
  +          TransformerImpl transformer)
               throws TransformerException
     {
   
       try
       {
         if (TransformerImpl.S_DEBUG)
  -        transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
  +        transformer.getTraceManager().fireTraceEvent(this);
   
  -      Node child;
  +      XPathContext xctxt = transformer.getXPathContext();
  +      int sourceNode = xctxt.getCurrentNode();
  +      int child;
         XObject value;
         
         // Optimize for "."
  @@ -251,38 +255,32 @@
                                                    sourceNode, this);
           if(value.getType() == XObject.CLASS_NODESET)
           {
  -          org.w3c.dom.traversal.NodeIterator iterator = value.nodeset();
  +          DTMIterator iterator = value.nodeset();
             child = iterator.nextNode();
  -          if(null == child)
  +          if(DTM.NULL == child)
               return;
           }
           else
  -          child = null;
  +          child = DTM.NULL;
           if (TransformerImpl.S_DEBUG)
             transformer.getTraceManager().fireSelectedEvent(sourceNode, this,
                                                             "select", m_selectExpression, value);
         }
            
         String s;                                                                                             
  -      if(null != child)
  +      if(DTM.NULL != child)
         {
  -        if (child.isSupported(SaxEventDispatch.SUPPORTSINTERFACE, "1.0"))
  +        DTM dtm = xctxt.getDTM(child);
  +        ResultTreeHandler rth = transformer.getResultTreeHandler();
  +        if (m_disableOutputEscaping)
           {
  -          if (m_disableOutputEscaping)
  -          {
  -            ResultTreeHandler rth = transformer.getResultTreeHandler();
  -            rth.processingInstruction(javax.xml.transform.Result.PI_DISABLE_OUTPUT_ESCAPING, "");
  -            ((SaxEventDispatch) child).dispatchCharactersEvent(rth);
  -            rth.processingInstruction(javax.xml.transform.Result.PI_ENABLE_OUTPUT_ESCAPING, "");
  -          }
  -          else
  -            ((SaxEventDispatch) child).dispatchCharactersEvent(transformer.getResultTreeHandler());
  -          return;
  +          rth.processingInstruction(javax.xml.transform.Result.PI_DISABLE_OUTPUT_ESCAPING, "");
  +          dtm.dispatchCharactersEvents(child, rth);
  +          rth.processingInstruction(javax.xml.transform.Result.PI_ENABLE_OUTPUT_ESCAPING, "");
           }
           else
  -        {
  -          s = XNodeSet.getStringFromNode(child);
  -        }
  +          dtm.dispatchCharactersEvents(child, rth);
  +        return;
         }
         else
           s = value.str();
  @@ -318,7 +316,7 @@
      *
      * @throws DOMException
      */
  -  public Node appendChild(Node newChild) throws DOMException
  +  public ElemTemplateElement appendChild(ElemTemplateElement newChild)
     {
   
       error(XSLTErrorResources.ER_CANNOT_ADD,
  
  
  
  1.10.2.1  +10 -9     xml-xalan/java/src/org/apache/xalan/templates/ElemVariable.java
  
  Index: ElemVariable.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemVariable.java,v
  retrieving revision 1.10
  retrieving revision 1.10.2.1
  diff -u -r1.10 -r1.10.2.1
  --- ElemVariable.java	2001/01/02 03:36:47	1.10
  +++ ElemVariable.java	2001/04/10 18:44:52	1.10.2.1
  @@ -56,7 +56,8 @@
    */
   package org.apache.xalan.templates;
   
  -import org.w3c.dom.*;
  +//import org.w3c.dom.*;
  +import org.apache.xml.dtm.DTM;
   
   import org.xml.sax.*;
   
  @@ -245,13 +246,14 @@
      * @throws TransformerException
      */
     public void execute(
  -          TransformerImpl transformer, Node sourceNode, QName mode)
  +          TransformerImpl transformer)
               throws TransformerException
     {
   
       if (TransformerImpl.S_DEBUG)
  -      transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
  +      transformer.getTraceManager().fireTraceEvent(this);
   
  +    int sourceNode = transformer.getXPathContext().getCurrentNode();
       XObject var = getValue(transformer, sourceNode);
   
       transformer.getXPathContext().getVarStack().pushVariable(m_qname, var);
  @@ -267,7 +269,7 @@
      *
      * @throws TransformerException
      */
  -  public XObject getValue(TransformerImpl transformer, Node sourceNode)
  +  public XObject getValue(TransformerImpl transformer, int sourceNode)
             throws TransformerException
     {
   
  @@ -282,7 +284,7 @@
           transformer.getTraceManager().fireSelectedEvent(sourceNode, this, 
                                         "select", m_selectPattern, var);
       }
  -    else if (null == getFirstChild())
  +    else if (null == getFirstChildElem())
       {
         var = XString.EMPTYSTRING;
       }
  @@ -290,10 +292,9 @@
       {
   
         // Use result tree fragment
  -      DocumentFragment df = transformer.transformToRTF(this, sourceNode,
  -                              null);
  -
  -      var = new XRTreeFrag(df);
  +      int df = transformer.transformToRTF(this);
  +      XPathContext xctxt = transformer.getXPathContext();
  +      var = new XRTreeFrag(xctxt.createDTMIterator(df));
       }
   
       return var;
  
  
  
  1.19.2.1  +36 -33    xml-xalan/java/src/org/apache/xalan/templates/FuncDocument.java
  
  Index: FuncDocument.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/FuncDocument.java,v
  retrieving revision 1.19
  retrieving revision 1.19.2.1
  diff -u -r1.19 -r1.19.2.1
  --- FuncDocument.java	2001/01/29 11:46:24	1.19
  +++ FuncDocument.java	2001/04/10 18:44:52	1.19.2.1
  @@ -62,9 +62,13 @@
   import java.io.PrintWriter;
   import java.io.IOException;
   
  -import org.w3c.dom.Document;
  -import org.w3c.dom.Node;
  -import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.Document;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.traversal.NodeIterator;
  +
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
  +import org.apache.xml.dtm.DTMManager;
   
   import org.apache.xpath.NodeSet;
   import org.apache.xpath.functions.Function;
  @@ -74,7 +78,7 @@
   import org.apache.xpath.objects.XNodeSet;
   import org.apache.xpath.XPath;
   import org.apache.xpath.XPathContext;
  -import org.apache.xpath.DOMHelper;
  +//import org.apache.xpath.DOMHelper;
   import org.apache.xpath.SourceTreeManager;
   import org.apache.xpath.Expression;
   import org.apache.xpath.XPathContext;
  @@ -121,9 +125,10 @@
     public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
     {
   
  -    Node context = xctxt.getCurrentNode();
  -    Document docContext = (Node.DOCUMENT_NODE == context.getNodeType())
  -                          ? (Document) context : context.getOwnerDocument();
  +    int context = xctxt.getCurrentNode();
  +    DTM dtm = xctxt.getDTM(context);
  +    
  +    int docContext = dtm.getDocument();
       XObject arg = (XObject) this.getArg0().execute(xctxt);
       String base = "";
       Expression arg1Expr = this.getArg1();
  @@ -139,18 +144,15 @@
   
         if (XObject.CLASS_NODESET == arg2.getType())
         {
  -        Node baseNode = arg2.nodeset().nextNode();
  +        int baseNode = arg2.nodeset().nextNode();
   
  -        if (baseNode == null)
  +        if (baseNode == DTM.NULL)
             warn(xctxt, XSLTErrorResources.WG_EMPTY_SECOND_ARG, null);
  -
  -        Document baseDoc = (baseNode == null
  -                            ? null
  -                            : (Node.DOCUMENT_NODE == baseNode.getNodeType())
  -                              ? (Document) baseNode
  -                              : baseNode.getOwnerDocument());
  +        
  +        DTM baseDTM = xctxt.getDTM(baseNode);
  +        int baseDoc = baseDTM.getDocument();
   
  -        if (baseDoc == null || baseDoc instanceof Stylesheet)
  +        if (baseDoc == DTM.NULL /* || baseDoc instanceof Stylesheet  %TBD% What to do?? */)
           {
   
             // base = ((Stylesheet)baseDoc).getBaseIdentifier();
  @@ -180,20 +182,20 @@
       }
   
       XNodeSet nodes = new XNodeSet();
  -    NodeSet mnl = nodes.mutableNodeset();
  -    NodeIterator iterator = (XObject.CLASS_NODESET == arg.getType())
  +//    NodeSet mnl = nodes.mutableNodeset();
  +    DTMIterator iterator = (XObject.CLASS_NODESET == arg.getType())
                               ? arg.nodeset() : null;
  -    Node pos = null;
  +    int pos = DTM.NULL;
   
  -    while ((null == iterator) || (null != (pos = iterator.nextNode())))
  +    while ((null == iterator) || (DTM.NULL != (pos = iterator.nextNode())))
       {
         String ref = (null != iterator)
  -                   ? DOMHelper.getNodeData(pos) : arg.str();
  +                   ? xctxt.getDTM(pos).getStringValue(pos) : arg.str();
   
         if (null == ref)
           continue;
   
  -      if (null == docContext)
  +      if (DTM.NULL == docContext)
         {
           error(xctxt, XSLTErrorResources.ER_NO_CONTEXT_OWNERDOC, null);  //"context does not have an owner document!");
         }
  @@ -215,18 +217,19 @@
           base = null;
         }
   
  -      Node newDoc = getDoc(xctxt, context, ref, base);
  +      int newDoc = getDoc(xctxt, context, ref, base);
   
         // nodes.mutableNodeset().addNode(newDoc);  
  -      if (null != newDoc)
  +      if (DTM.NULL != newDoc)
         {
   
           // TODO: mnl.addNodeInDocOrder(newDoc, true, xctxt); ??
  -        if (!mnl.contains(newDoc))
  -          mnl.addElement(newDoc);
  +        // %TBD%
  +//        if (!mnl.contains(newDoc))
  +//          mnl.addElement(newDoc);
         }
   
  -      if (null == iterator || newDoc == null)
  +      if (null == iterator || newDoc == DTM.NULL)
           break;
       }
   
  @@ -246,14 +249,14 @@
      *
      * @throws javax.xml.transform.TransformerException
      */
  -  Node getDoc(XPathContext xctxt, Node context, String uri, String base)
  +  int getDoc(XPathContext xctxt, int context, String uri, String base)
             throws javax.xml.transform.TransformerException
     {
   
       // System.out.println("base: "+base+", uri: "+uri);
       SourceTreeManager treeMgr = xctxt.getSourceTreeManager();
       
  -    Node newDoc;
  +    int newDoc;
       try
       {
         Source source = treeMgr.resolveURI(base, uri, xctxt.getSAXLocator());
  @@ -269,7 +272,7 @@
         throw new TransformerException(te);
       }
   
  -    if (null != newDoc)
  +    if (DTM.NULL != newDoc)
         return newDoc;
   
       // If the uri length is zero, get the uri of the stylesheet.
  @@ -282,7 +285,7 @@
       {
         if ((null != uri) && (uri.toString().length() > 0))
         {
  -        newDoc = treeMgr.getSourceTree(base, uri, xctxt.getSAXLocator());
  +        newDoc = treeMgr.getSourceTree(base, uri, xctxt.getSAXLocator(), xctxt);
   
           // System.out.println("newDoc: "+((Document)newDoc).getDocumentElement().getNodeName());
         }
  @@ -294,7 +297,7 @@
       {
   
         // throwable.printStackTrace();
  -      newDoc = null;
  +      newDoc = DTM.NULL;
   
         // path.warn(XSLTErrorResources.WG_ENCODING_NOT_SUPPORTED_USING_JAVA, new Object[]{((base == null) ? "" : base )+uri}); //"Can not load requested doc: "+((base == null) ? "" : base )+uri);
         while (throwable
  @@ -359,7 +362,7 @@
         diagnosticsString = throwable.getMessage(); //sw.toString();
       }
   
  -    if (null == newDoc)
  +    if (DTM.NULL == newDoc)
       {
   
         // System.out.println("what?: "+base+", uri: "+uri);
  
  
  
  1.8.2.1   +16 -13    xml-xalan/java/src/org/apache/xalan/templates/FuncKey.java
  
  Index: FuncKey.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/FuncKey.java,v
  retrieving revision 1.8
  retrieving revision 1.8.2.1
  diff -u -r1.8 -r1.8.2.1
  --- FuncKey.java	2000/12/10 05:21:34	1.8
  +++ FuncKey.java	2001/04/10 18:44:52	1.8.2.1
  @@ -64,7 +64,7 @@
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
   import org.apache.xpath.objects.XNodeSet;
  -import org.apache.xpath.DOMHelper;
  +//import org.apache.xpath.DOMHelper;
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.axes.LocPathIterator;
   import org.apache.xpath.axes.UnionPathIterator;
  @@ -74,10 +74,12 @@
   import org.apache.xpath.res.XPATHErrorResources;
   import org.apache.xpath.XPathContext;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.Document;
  -import org.w3c.dom.NodeList;
  -import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.Document;
  +//import org.w3c.dom.NodeList;
  +//import org.w3c.dom.traversal.NodeIterator;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
   
   /**
    * <meta name="usage" content="advanced"/>
  @@ -103,11 +105,11 @@
       // TransformerImpl transformer = (TransformerImpl)xctxt;
       TransformerImpl transformer = (TransformerImpl) xctxt.getOwnerObject();
       XNodeSet nodes = null;
  -    Node context = xctxt.getCurrentNode();
  -    Document docContext = (Node.DOCUMENT_NODE == context.getNodeType())
  -                          ? (Document) context : context.getOwnerDocument();
  +    int context = xctxt.getCurrentNode();
  +    DTM dtm = xctxt.getDTM(context);
  +    int docContext = dtm.getDocument();
   
  -    if (null == docContext)
  +    if (DTM.NULL == docContext)
       {
   
         // path.error(context, XPATHErrorResources.ER_CONTEXT_HAS_NO_OWNERDOC); //"context does not have an owner document!");
  @@ -122,13 +124,14 @@
       if (argIsNodeSet)
       {
         Hashtable usedrefs = null;
  -      NodeIterator ni = arg.nodeset();
  -      Node pos;
  +      DTMIterator ni = arg.nodeset();
  +      int pos;
         UnionPathIterator upi = new UnionPathIterator();
   
  -      while (null != (pos = ni.nextNode()))
  +      while (DTM.NULL != (pos = ni.nextNode()))
         {
  -        String ref = DOMHelper.getNodeData(pos);
  +        dtm = xctxt.getDTM(pos);
  +        String ref = dtm.getStringValue(pos);
   
           if (null == ref)
             continue;
  
  
  
  1.22.2.1  +6 -5      xml-xalan/java/src/org/apache/xalan/templates/Stylesheet.java
  
  Index: Stylesheet.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/Stylesheet.java,v
  retrieving revision 1.22
  retrieving revision 1.22.2.1
  diff -u -r1.22 -r1.22.2.1
  --- Stylesheet.java	2001/01/04 08:06:23	1.22
  +++ Stylesheet.java	2001/04/10 18:44:52	1.22.2.1
  @@ -74,8 +74,9 @@
   import org.apache.xpath.XPath;
   
   // DOM Imports
  -import org.w3c.dom.Node;
  -import org.w3c.dom.Document;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.Document;
  +import org.apache.xml.dtm.DTM;
   
   // SAX2 Imports
   import javax.xml.transform.TransformerException;
  @@ -127,7 +128,7 @@
    * @see <a href="http://www.w3.org/TR/xslt#section-Stylesheet-Structure">section-Stylesheet-Structure in XSLT Specification</a>
    */
   public class Stylesheet extends ElemTemplateElement
  -        implements java.io.Serializable, Document
  +        implements java.io.Serializable /* , Document */
   {
   
     /**
  @@ -1351,7 +1352,7 @@
      */
     public short getNodeType()
     {
  -    return Node.DOCUMENT_NODE;
  +    return DTM.DOCUMENT_NODE;
     }
   
     /**
  @@ -1394,7 +1395,7 @@
       if (null == m_templates)
         throw new ArrayIndexOutOfBoundsException();
   
  -    replaceChild(v, (Node) m_templates.elementAt(i));
  +    replaceChild(v, (ElemTemplateElement)m_templates.elementAt(i));
       m_templates.setElementAt(v, i);
       v.setStylesheet(this);
     }
  
  
  
  1.40.2.1  +12 -10    xml-xalan/java/src/org/apache/xalan/templates/StylesheetRoot.java
  
  Index: StylesheetRoot.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/StylesheetRoot.java,v
  retrieving revision 1.40
  retrieving revision 1.40.2.1
  diff -u -r1.40 -r1.40.2.1
  --- StylesheetRoot.java	2001/03/18 09:26:58	1.40
  +++ StylesheetRoot.java	2001/04/10 18:44:52	1.40.2.1
  @@ -56,7 +56,8 @@
    */
   package org.apache.xalan.templates;
   
  -import org.w3c.dom.*;
  +// import org.w3c.dom.*;
  +import org.apache.xml.dtm.DTM;
   
   import java.util.*;
   
  @@ -698,7 +699,7 @@
      * @throws TransformerException
      */
     public ElemTemplate getTemplateComposed(XPathContext xctxt,
  -                                          Node targetNode,
  +                                          int targetNode,
                                             QName mode,
                                             int maxImportLevel,
                                             boolean quietConflictWarnings)
  @@ -820,7 +821,7 @@
      * @throws TransformerException
      */
     public WhiteSpaceInfo getWhiteSpaceInfo(
  -          XPathContext support, Element targetElement) throws TransformerException
  +          XPathContext support, int targetElement) throws TransformerException
     {
   
       if (null != m_whiteSpaceInfoList)
  @@ -842,22 +843,23 @@
      * @throws TransformerException
      */
     public boolean shouldStripWhiteSpace(
  -          XPathContext support, Element targetElement) throws TransformerException
  +          XPathContext support, int targetElement) throws TransformerException
     {
       if (null != m_whiteSpaceInfoList)
       {
  -      while(null != targetElement)
  +      while(DTM.NULL != targetElement)
         {
           WhiteSpaceInfo info = (WhiteSpaceInfo) m_whiteSpaceInfoList.getTemplate(support,
                   targetElement, null, -1, false);
           if(null != info)
             return info.getShouldStripSpace();
  -          
  -        Node parent = targetElement.getParentNode();
  -        if(null != parent && Node.ELEMENT_NODE == parent.getNodeType())
  -          targetElement = (Element)parent;
  +        
  +        DTM dtm = support.getDTM(targetElement);
  +        int parent = dtm.getParent(targetElement);
  +        if(DTM.NULL != parent && DTM.ELEMENT_NODE == dtm.getNodeType(parent))
  +          targetElement = parent;
           else
  -          targetElement = null;
  +          targetElement = DTM.NULL;
         }
       }
       return false;
  
  
  
  1.30.2.1  +22 -20    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.30
  retrieving revision 1.30.2.1
  diff -u -r1.30 -r1.30.2.1
  --- TemplateList.java	2001/01/02 03:36:47	1.30
  +++ TemplateList.java	2001/04/10 18:44:53	1.30.2.1
  @@ -62,7 +62,8 @@
   
   import java.io.Serializable;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
  +import org.apache.xml.dtm.DTM;
   
   import javax.xml.transform.TransformerException;
   
  @@ -457,43 +458,44 @@
      * @return The head of a linked list that contains all possible match pattern to 
      * template associations.
      */
  -  public TemplateSubPatternAssociation getHead(XPathContext xctxt, Node targetNode)
  +  public TemplateSubPatternAssociation getHead(XPathContext xctxt, int targetNode)
     {
   
  -    short targetNodeType = targetNode.getNodeType();
  +    DTM dtm = xctxt.getDTM(targetNode);
  +    short targetNodeType = dtm.getNodeType(targetNode);
       TemplateSubPatternAssociation head;
   
       switch (targetNodeType)
       {
  -    case Node.ELEMENT_NODE :
  -    case Node.ATTRIBUTE_NODE :
  +    case DTM.ELEMENT_NODE :
  +    case DTM.ATTRIBUTE_NODE :
         head = (TemplateSubPatternAssociation) m_patternTable.get(
  -        xctxt.getDOMHelper().getLocalNameOfNode(targetNode));
  +        dtm.getLocalName(targetNode));
         break;
  -    case Node.TEXT_NODE :
  -    case Node.CDATA_SECTION_NODE :
  +    case DTM.TEXT_NODE :
  +    case DTM.CDATA_SECTION_NODE :
         head = m_textPatterns;
         break;
  -    case Node.ENTITY_REFERENCE_NODE :
  -    case Node.ENTITY_NODE :
  +    case DTM.ENTITY_REFERENCE_NODE :
  +    case DTM.ENTITY_NODE :
         head = (TemplateSubPatternAssociation) m_patternTable.get(
  -        targetNode.getNodeName());
  +        dtm.getNodeName(targetNode)); // %REVIEW% I think this is right
         break;
  -    case Node.PROCESSING_INSTRUCTION_NODE :
  +    case DTM.PROCESSING_INSTRUCTION_NODE :
         head = (TemplateSubPatternAssociation) m_patternTable.get(
  -        xctxt.getDOMHelper().getLocalNameOfNode(targetNode));
  +        dtm.getLocalName(targetNode));
         break;
  -    case Node.COMMENT_NODE :
  +    case DTM.COMMENT_NODE :
         head = m_commentPatterns;
         break;
  -    case Node.DOCUMENT_NODE :
  -    case Node.DOCUMENT_FRAGMENT_NODE :
  +    case DTM.DOCUMENT_NODE :
  +    case DTM.DOCUMENT_FRAGMENT_NODE :
         head = m_docPatterns;
         break;
  -    case Node.NOTATION_NODE :
  +    case DTM.NOTATION_NODE :
       default :
         head = (TemplateSubPatternAssociation) m_patternTable.get(
  -        targetNode.getNodeName());
  +        dtm.getNodeName(targetNode)); // %REVIEW% I think this is right
       }
   
       return (null == head) ? m_wildCardPatterns : head;
  @@ -518,7 +520,7 @@
      * @throws TransformerException
      */
     public ElemTemplate getTemplate(XPathContext xctxt,
  -                                Node targetNode,
  +                                int targetNode,
                                   QName mode,
                                   int maxImportLevel,
                                   boolean quietConflictWarnings)
  @@ -585,7 +587,7 @@
      * @param mode reference, which may be null, to the <a href="http://www.w3.org/TR/xslt#modes">current mode</a>.
      */
     private void checkConflicts(TemplateSubPatternAssociation head,
  -                              XPathContext xctxt, Node targetNode, QName mode)
  +                              XPathContext xctxt, int targetNode, QName mode)
     {
   
       // TODO: Check for conflicts.
  
  
  
  1.9.2.1   +2 -2      xml-xalan/java/src/org/apache/xalan/templates/TemplateSubPatternAssociation.java
  
  Index: TemplateSubPatternAssociation.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/TemplateSubPatternAssociation.java,v
  retrieving revision 1.9
  retrieving revision 1.9.2.1
  diff -u -r1.9 -r1.9.2.1
  --- TemplateSubPatternAssociation.java	2000/12/13 21:56:20	1.9
  +++ TemplateSubPatternAssociation.java	2001/04/10 18:44:53	1.9.2.1
  @@ -58,7 +58,7 @@
   
   import java.io.Serializable;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
   
   import javax.xml.transform.TransformerException;
   
  @@ -185,7 +185,7 @@
      *
      * @throws TransformerException
      */
  -  public boolean matches(XPathContext xctxt, Node targetNode, QName mode)
  +  public boolean matches(XPathContext xctxt, int targetNode, QName mode)
             throws TransformerException
     {
   
  
  
  
  1.5.2.1   +5 -4      xml-xalan/java/src/org/apache/xalan/templates/XUnresolvedVariable.java
  
  Index: XUnresolvedVariable.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/XUnresolvedVariable.java,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- XUnresolvedVariable.java	2001/01/26 01:26:59	1.5
  +++ XUnresolvedVariable.java	2001/04/10 18:44:53	1.5.2.1
  @@ -66,8 +66,9 @@
   import org.apache.xalan.transformer.TransformerImpl;
   import org.apache.xalan.res.XSLMessages;
   import org.apache.xalan.res.XSLTErrorResources;
  -import org.w3c.dom.DocumentFragment;
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.DocumentFragment;
  +//import org.w3c.dom.Node;
  +import org.apache.xml.dtm.DTM;
   
   /**
    * An instance of this class holds unto a variable until 
  @@ -77,7 +78,7 @@
   public class XUnresolvedVariable extends XObject
   {  
     /** The node context for execution. */
  -  transient private Node m_context;
  +  transient private int m_context;
     
     /** The transformer context for execution. */
     transient private TransformerImpl m_transformer;
  @@ -116,7 +117,7 @@
      * ends, i.e. at the point we should terminate the search.
      * @param isGlobal true if this is a global variable.
      */
  -  public XUnresolvedVariable(ElemVariable obj, Node sourceNode, 
  +  public XUnresolvedVariable(ElemVariable obj, int sourceNode, 
                                TransformerImpl transformer,
                                int varStackPos, int varStackContext,
                                boolean isGlobal)
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.6.2.1   +31 -31    xml-xalan/java/src/org/apache/xalan/trace/PrintTraceListener.java
  
  Index: PrintTraceListener.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/trace/PrintTraceListener.java,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- PrintTraceListener.java	2001/01/02 03:36:51	1.6
  +++ PrintTraceListener.java	2001/04/10 18:45:00	1.6.2.1
  @@ -186,7 +186,7 @@
           // You may not have line numbers if the selection is occuring from a
           // default template.
           ElemTemplateElement parent =
  -          (ElemTemplateElement) ete.getParentNode();
  +          (ElemTemplateElement) ete.getParentElem();
   
           if (parent == ete.getStylesheetRoot().getDefaultRootRule())
           {
  @@ -215,36 +215,36 @@
         if (ev.m_selection.getType() == ev.m_selection.CLASS_NODESET)
         {
           m_pw.println();
  -
  -        NodeIterator nl = ev.m_selection.nodeset();
  -        if(nl instanceof ContextNodeList)
  -        {
  -          try
  -          {
  -            nl = ((ContextNodeList)nl).cloneWithReset();
  -          }
  -          catch(CloneNotSupportedException cnse)
  -          {
  -            m_pw.println("     [Can't trace nodelist because it it threw a CloneNotSupportedException]");
  -            return;
  -          }
  -          Node pos = nl.nextNode();
  -
  -          if (null == pos)
  -          {
  -            m_pw.println("     [empty node list]");
  -          }
  -          else
  -          {
  -            while (null != pos)
  -            {
  -              m_pw.println("     " + pos);
  -
  -              pos = nl.nextNode();
  -            }
  -          }
  -        }
  -        else
  +        // %TBD%
  +//        NodeIterator nl = ev.m_selection.nodeset();
  +//        if(nl instanceof ContextNodeList)
  +//        {
  +//          try
  +//          {
  +//            nl = ((ContextNodeList)nl).cloneWithReset();
  +//          }
  +//          catch(CloneNotSupportedException cnse)
  +//          {
  +//            m_pw.println("     [Can't trace nodelist because it it threw a CloneNotSupportedException]");
  +//            return;
  +//          }
  +//          Node pos = nl.nextNode();
  +//
  +//          if (null == pos)
  +//          {
  +//            m_pw.println("     [empty node list]");
  +//          }
  +//          else
  +//          {
  +//            while (null != pos)
  +//            {
  +//              m_pw.println("     " + pos);
  +//
  +//              pos = nl.nextNode();
  +//            }
  +//          }
  +//        }
  +//        else
           {
               m_pw.println("     [Can't trace nodelist because it isn't a ContextNodeList]");
           }
  
  
  
  1.7.2.1   +13 -12    xml-xalan/java/src/org/apache/xalan/trace/TraceManager.java
  
  Index: TraceManager.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/trace/TraceManager.java,v
  retrieving revision 1.7
  retrieving revision 1.7.2.1
  diff -u -r1.7 -r1.7.2.1
  --- TraceManager.java	2000/12/13 22:26:51	1.7
  +++ TraceManager.java	2001/04/10 18:45:00	1.7.2.1
  @@ -162,15 +162,15 @@
      * @param mode Template mode
      * @param styleNode Stylesheet template node
      */
  -  public void fireTraceEvent(Node sourceNode, QName mode,
  -                             ElemTemplateElement styleNode)
  +  public void fireTraceEvent(ElemTemplateElement styleNode)
     {
   
  -    if (hasTraceListeners())
  -    {
  -      fireTraceEvent(new TracerEvent(m_transformer, sourceNode, mode,
  -                                     styleNode));
  -    }
  +  // %TBD%
  +//    if (hasTraceListeners())
  +//    {
  +//      fireTraceEvent(new TracerEvent(m_transformer, sourceNode, mode,
  +//                                     styleNode));
  +//    }
     }
   
     /**
  @@ -206,14 +206,15 @@
      * @throws javax.xml.transform.TransformerException
      */
     public void fireSelectedEvent(
  -          Node sourceNode, ElemTemplateElement styleNode, String attributeName, XPath xpath, XObject selection)
  +          int sourceNode, ElemTemplateElement styleNode, String attributeName, XPath xpath, XObject selection)
               throws javax.xml.transform.TransformerException
     {
   
  -    if (hasTraceListeners())
  -      fireSelectedEvent(new SelectionEvent(m_transformer, sourceNode,
  -                                           styleNode, attributeName, xpath,
  -                                           selection));
  +  // %TBD%
  +//    if (hasTraceListeners())
  +//      fireSelectedEvent(new SelectionEvent(m_transformer, sourceNode,
  +//                                           styleNode, attributeName, xpath,
  +//                                           selection));
     }
   
     /**
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.9.2.1   +36 -120   xml-xalan/java/src/org/apache/xalan/transformer/ClonerToResultTree.java
  
  Index: ClonerToResultTree.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/ClonerToResultTree.java,v
  retrieving revision 1.9
  retrieving revision 1.9.2.1
  diff -u -r1.9 -r1.9.2.1
  --- ClonerToResultTree.java	2001/03/06 05:50:23	1.9
  +++ ClonerToResultTree.java	2001/04/10 18:45:01	1.9.2.1
  @@ -58,13 +58,16 @@
   
   import org.apache.xalan.templates.Stylesheet;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.Text;
  -import org.w3c.dom.Attr;
  -import org.w3c.dom.Comment;
  -import org.w3c.dom.CDATASection;
  -import org.w3c.dom.ProcessingInstruction;
  -import org.w3c.dom.EntityReference;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.Text;
  +//import org.w3c.dom.Attr;
  +//import org.w3c.dom.Comment;
  +//import org.w3c.dom.CDATASection;
  +//import org.w3c.dom.ProcessingInstruction;
  +//import org.w3c.dom.EntityReference;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
  +import org.apache.xml.dtm.DTMFilter;
   
   import javax.xml.transform.TransformerException;
   import org.xml.sax.Attributes;
  @@ -112,153 +115,66 @@
      * 
      * @throws TransformerException
      */
  -  public void cloneToResultTree(Node node, boolean shouldCloneAttributes)
  +  public void cloneToResultTree(int node, boolean shouldCloneAttributes)
       throws TransformerException
     {
   
       try
       {
  -      boolean stripWhiteSpace = false;
         XPathContext xctxt = m_transformer.getXPathContext();
  -      DOMHelper dhelper = xctxt.getDOMHelper();
  +      DTM dtm = xctxt.getDTM(node);
   
  -      switch (node.getNodeType())
  +      switch (dtm.getNodeType(node))
         {
  -      case Node.TEXT_NODE :
  -        {
  -          Text tx = (Text) node;
  -          String data = null;
  -
  -          // System.out.println("stripWhiteSpace = "+stripWhiteSpace+", "+tx.getData());
  -          if (stripWhiteSpace)
  -          {
  -            if (!dhelper.isIgnorableWhitespace(tx))
  -            {
  -              data = tx.getData();
  -
  -              if ((null != data) && (0 == data.trim().length()))
  -              {
  -                data = null;
  -              }
  -            }
  -          }
  -          else
  -          {
  -            Node parent = node.getParentNode();
  -
  -            if (null != parent)
  -            {
  -              if (Node.DOCUMENT_NODE != parent.getNodeType())
  -              {
  -                data = tx.getData();
  -
  -                if ((null != data) && (0 == data.length()))
  -                {
  -                  data = null;
  -                }
  -              }
  -            }
  -            else
  -            {
  -              data = tx.getData();
  -
  -              if ((null != data) && (0 == data.length()))
  -              {
  -                data = null;
  -              }
  -            }
  -          }
  -
  -          if (null != data)
  -          {
  -
  -            // TODO: Hack around the issue of comments next to literals.
  -            // This would be, when a comment is present, the whitespace
  -            // after the comment must be added to the literal.  The
  -            // parser should do this, but XML4J doesn't seem to.
  -            // <foo>some lit text
  -            //     <!-- comment -->
  -            //     </foo>
  -            // Loop through next siblings while they are comments, then,
  -            // if the node after that is a ignorable text node, append
  -            // it to the text node just added.
  -            if (dhelper.isIgnorableWhitespace(tx))
  -            {
  -              m_rth.ignorableWhitespace(data.toCharArray(), 0, data.length());
  -            }
  -            else
  -            {
  -              m_rth.characters(data.toCharArray(), 0, data.length());
  -            }
  -          }
  -        }
  +      case DTM.TEXT_NODE :
  +        dtm.dispatchCharactersEvents(node, m_rth);
           break;
  -      case Node.DOCUMENT_FRAGMENT_NODE :
  -      case Node.DOCUMENT_NODE :
  +      case DTM.DOCUMENT_FRAGMENT_NODE :
  +      case DTM.DOCUMENT_NODE :
   
           // Can't clone a document, but refrain from throwing an error
           // so that copy-of will work
           break;
  -      case Node.ELEMENT_NODE :
  +      case DTM.ELEMENT_NODE :
           {
             Attributes atts;
   
             if (shouldCloneAttributes)
             {
  +            // %TBD%
               m_rth.addAttributes(node);
               m_rth.processNSDecls(node);
             }
   
  -          String ns = dhelper.getNamespaceOfNode(node);
  -          String localName = dhelper.getLocalNameOfNode(node);
  +          String ns = dtm.getNamespaceURI(node);
  +          String localName = dtm.getLocalName(node);
   
  -          m_rth.startElement(ns, localName, node.getNodeName(), null);
  +          m_rth.startElement(ns, localName, dtm.getNodeNameX(node), null);
           }
           break;
  -      case Node.CDATA_SECTION_NODE :
  -        {
  -          m_rth.startCDATA();
  -
  -          String data = ((CDATASection) node).getData();
  -
  -          m_rth.characters(data.toCharArray(), 0, data.length());
  -          m_rth.endCDATA();
  -        }
  +      case DTM.CDATA_SECTION_NODE :
  +        m_rth.startCDATA();          
  +        dtm.dispatchCharactersEvents(node, m_rth);
  +        m_rth.endCDATA();
           break;
  -      case Node.ATTRIBUTE_NODE :
  -        {
  -          if (m_rth.isDefinedNSDecl((Attr) node))
  -            break;
  -
  -          String ns = dhelper.getNamespaceOfNode(node);
  -          String localName = dhelper.getLocalNameOfNode(node);
  -
  -          m_rth.addAttribute(ns, localName, node.getNodeName(), "CDATA",
  -                             ((Attr) node).getValue());
  -        }
  +      case DTM.ATTRIBUTE_NODE :
  +        m_rth.addAttribute(node);
           break;
  -      case Node.COMMENT_NODE :
  -        {
  -          m_rth.comment(((Comment) node).getData());
  -        }
  +      case DTM.COMMENT_NODE :
  +        m_rth.comment(dtm.getStringValue (node));
           break;
  -      case Node.ENTITY_REFERENCE_NODE :
  -        {
  -          EntityReference er = (EntityReference) node;
  -
  -          m_rth.entityReference(er.getNodeName());
  -        }
  +      case DTM.ENTITY_REFERENCE_NODE :
  +        m_rth.entityReference(dtm.getNodeNameX(node));
           break;
  -      case Node.PROCESSING_INSTRUCTION_NODE :
  +      case DTM.PROCESSING_INSTRUCTION_NODE :
           {
  -          ProcessingInstruction pi = (ProcessingInstruction) node;
  -
  -          m_rth.processingInstruction(pi.getTarget(), pi.getData());
  +          // %REVIEW% Is the node name the same as the "target"?
  +          m_rth.processingInstruction(dtm.getNodeNameX(node), dtm.getStringValue(node));
           }
           break;
         default :
           m_transformer.getMsgMgr().error(null, XSLTErrorResources.ER_CANT_CREATE_ITEM,
  -                                        new Object[]{ node.getNodeName() });  //"Can not create item in result tree: "+node.getNodeName());
  +                                        new Object[]{ dtm.getNodeName(node) });  //"Can not create item in result tree: "+node.getNodeName());
         }
       }
       catch(org.xml.sax.SAXException se)
  
  
  
  1.7.2.1   +11 -8     xml-xalan/java/src/org/apache/xalan/transformer/Counter.java
  
  Index: Counter.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/Counter.java,v
  retrieving revision 1.7
  retrieving revision 1.7.2.1
  diff -u -r1.7 -r1.7.2.1
  --- Counter.java	2001/01/12 07:36:45	1.7
  +++ Counter.java	2001/04/10 18:45:02	1.7.2.1
  @@ -56,7 +56,8 @@
    */
   package org.apache.xalan.transformer;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
  +import org.apache.xml.dtm.DTM;
   
   import org.apache.xml.utils.NodeVector;
   import org.apache.xpath.NodeSet;  // for isNodeAfter support
  @@ -102,7 +103,7 @@
      * find a counter if the node being counted is not immediatly
      * found in the m_countNodes vector.
      */
  -  Node m_fromNode = null;
  +  int m_fromNode = DTM.NULL;
   
     /**
      * The owning xsl:number element.
  @@ -151,7 +152,7 @@
      * 
      * @return The count of the node, or -1 if not found.
      */
  -  int getPreviouslyCounted(XPathContext support, Node node)
  +  int getPreviouslyCounted(XPathContext support, int node)
     {
   
       int n = m_countNodes.size();
  @@ -160,9 +161,9 @@
   
       for (int i = n - 1; i >= 0; i--)
       {
  -      Node countedNode = (Node) m_countNodes.elementAt(i);
  +      int countedNode = m_countNodes.elementAt(i);
   
  -      if (node.equals(countedNode))
  +      if (node == countedNode)
         {
   
           // Since the list is in backwards order, the count is 
  @@ -171,10 +172,12 @@
   
           break;
         }
  +      
  +      DTM dtm = support.getDTM(countedNode);
   
         // Try to see if the given node falls after the counted node...
         // if it does, don't keep searching backwards.
  -      if (support.getDOMHelper().isNodeAfter(countedNode, node))
  +      if (dtm.isNodeAfter(countedNode, node))
           break;
       }
   
  @@ -186,11 +189,11 @@
      *
      * @return the last node in the list.
      */
  -  Node getLast()
  +  int getLast()
     {
   
       int size = m_countNodes.size();
   
  -    return (size > 0) ? m_countNodes.elementAt(size - 1) : null;
  +    return (size > 0) ? m_countNodes.elementAt(size - 1) : DTM.NULL;
     }
   }
  
  
  
  1.6.2.1   +8 -7      xml-xalan/java/src/org/apache/xalan/transformer/CountersTable.java
  
  Index: CountersTable.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/CountersTable.java,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- CountersTable.java	2001/01/02 03:36:51	1.6
  +++ CountersTable.java	2001/04/10 18:45:02	1.6.2.1
  @@ -59,7 +59,8 @@
   import java.util.Hashtable;
   import java.util.Vector;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
  +import org.apache.xml.dtm.DTM;
   
   import javax.xml.transform.TransformerException;
   
  @@ -160,7 +161,7 @@
      *
      * @throws TransformerException
      */
  -  public int countNode(XPathContext support, ElemNumber numberElem, Node node)
  +  public int countNode(XPathContext support, ElemNumber numberElem, int node)
             throws TransformerException
     {
   
  @@ -170,9 +171,9 @@
   
       // XPath countMatchPattern = numberElem.getCountMatchPattern(support, node);
       // XPath fromMatchPattern = numberElem.m_fromMatchPattern;
  -    Node target = numberElem.getTargetNode(support, node);
  +    int target = numberElem.getTargetNode(support, node);
   
  -    if (null != target)
  +    if (DTM.NULL != target)
       {
         for (int i = 0; i < nCounters; i++)
         {
  @@ -192,7 +193,7 @@
         // the backwards list (m_newFound) to the forwards list (counter.m_countNodes).
         count = 0;
   
  -      for (; null != target;
  +      for (; DTM.NULL != target;
                 target = numberElem.getPreviousNode(support, target))
         {
   
  @@ -207,8 +208,8 @@
               int cacheLen = counter.m_countNodes.size();
   
               if ((cacheLen > 0)
  -                    && counter.m_countNodes.elementAt(cacheLen
  -                                                      - 1).equals(target))
  +                    && (counter.m_countNodes.elementAt(cacheLen
  +                                                      - 1) == target))
               {
                 count += (cacheLen + counter.m_countNodesStartCount);
   
  
  
  
  1.9.2.1   +13 -14    xml-xalan/java/src/org/apache/xalan/transformer/KeyIterator.java
  
  Index: KeyIterator.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/KeyIterator.java,v
  retrieving revision 1.9
  retrieving revision 1.9.2.1
  diff -u -r1.9 -r1.9.2.1
  --- KeyIterator.java	2001/01/02 03:36:51	1.9
  +++ KeyIterator.java	2001/04/10 18:45:02	1.9.2.1
  @@ -67,11 +67,12 @@
   import org.apache.xpath.objects.XObject;
   import org.apache.xpath.XPath;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.DOMException;
  -import org.w3c.dom.NamedNodeMap;
  -import org.w3c.dom.traversal.NodeFilter;
  -import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.DOMException;
  +//import org.w3c.dom.NamedNodeMap;
  +//import org.w3c.dom.traversal.NodeFilter;
  +//import org.w3c.dom.traversal.NodeIterator;
  +import org.apache.xml.dtm.DTM;
   
   import javax.xml.transform.TransformerException;
   
  @@ -135,7 +136,7 @@
      * @param keyDeclarations The key declarations from the stylesheet 
      * @param xctxt The XPath runtime state
      */
  -  public KeyIterator(Node doc, PrefixResolver nscontext, QName name,
  +  public KeyIterator(int doc, PrefixResolver nscontext, QName name,
                        Vector keyDeclarations, XPathContext xctxt)
     {
   
  @@ -157,15 +158,13 @@
      * 
      * @return  The next <code>Node</code> in the set being iterated over, or
      *   <code>null</code> if there are no more members in that set.
  -   *
  -   * @throws DOMException
      */
  -  public Node nextNode() throws DOMException
  +  public int nextNode()
     {
   
       // If the cache is on, and the node has already been found, then 
       // just return from the list.
  -    Node n = super.nextNode();
  +    int n = super.nextNode();
   
       // System.out.println("--> "+((null == n) ? "null" : n.getNodeName()));
       return n;
  @@ -183,9 +182,9 @@
       // System.out.println("setLookupKey - lookupKey: "+lookupKey);
       ((KeyWalker) m_firstWalker).m_lookupKey = lookupKey;
   
  -    m_firstWalker.setRoot(
  -      (this.getContext().getNodeType() == Node.DOCUMENT_NODE)
  -      ? this.getContext() : this.getContext().getOwnerDocument());
  +    int context = getContext();
  +    DTM dtm = this.getDTM(context);
  +    m_firstWalker.setRoot(dtm.getDocument());
       this.setLastUsedWalker(m_firstWalker);
       this.setNextPosition(0);
     }
  @@ -208,7 +207,7 @@
      * @param ref Key value(ref)(from key use field)
      * @param node Node matching that ref 
      */
  -  void addRefNode(String ref, Node node)
  +  void addRefNode(String ref, int node)
     {
       m_keyTable.addRefNode(ref, node);
     }
  
  
  
  1.10.2.1  +4 -3      xml-xalan/java/src/org/apache/xalan/transformer/KeyManager.java
  
  Index: KeyManager.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/KeyManager.java,v
  retrieving revision 1.10
  retrieving revision 1.10.2.1
  diff -u -r1.10 -r1.10.2.1
  --- KeyManager.java	2001/01/02 03:36:51	1.10
  +++ KeyManager.java	2001/04/10 18:45:02	1.10.2.1
  @@ -58,8 +58,9 @@
   
   import java.util.Vector;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.NodeList;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.NodeList;
  +import org.apache.xml.dtm.DTM;
   
   import org.apache.xalan.templates.ElemTemplateElement;
   import org.apache.xml.utils.QName;
  @@ -93,7 +94,7 @@
      * @throws javax.xml.transform.TransformerException
      */
     public LocPathIterator getNodeSetByKey(
  -          XPathContext xctxt, Node doc, QName name, String ref, PrefixResolver nscontext)
  +          XPathContext xctxt, int doc, QName name, String ref, PrefixResolver nscontext)
               throws javax.xml.transform.TransformerException
     {
   
  
  
  
  1.6.2.1   +13 -15    xml-xalan/java/src/org/apache/xalan/transformer/KeyRefIterator.java
  
  Index: KeyRefIterator.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/KeyRefIterator.java,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- KeyRefIterator.java	2001/01/02 03:36:51	1.6
  +++ KeyRefIterator.java	2001/04/10 18:45:02	1.6.2.1
  @@ -63,9 +63,11 @@
   import org.apache.xalan.templates.KeyDeclaration;
   import org.apache.xpath.NodeSet;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.DOMException;
  -import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.DOMException;
  +//import org.w3c.dom.traversal.NodeIterator;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
   
   /**
    * <meta name="usage" content="internal"/>
  @@ -128,16 +130,12 @@
      * 
      * @return  The next <code>Node</code> in the set being iterated over, or
      *   <code>null</code> if there are no more members in that set.
  -   * 
  -   * @throws DOMException
  -   *    INVALID_STATE_ERR: Raised if this method is called after the
  -   *   <code>detach</code> method was invoked.
      */
  -  public Node nextNode() throws DOMException
  +  public int nextNode()
     {
   
      if (m_foundLast)
  -      return null;
  +      return DTM.NULL;
       
       // If the cache is on, and the node has already been found, then 
       // just return from the list.
  @@ -150,21 +148,21 @@
       if ((null != m_cachedNodes)
               && (m_next < m_cachedNodes.size()))        
       {
  -      Node next = m_cachedNodes.elementAt(m_next); 
  +      int next = m_cachedNodes.elementAt(m_next); 
         this.setCurrentPos(++m_next); 
         m_lastFetched = next;
         
         return next;
       }    
   
  -    Node next = null;       
  +    int next = DTM.NULL;       
       if ( m_ki.getLookForMoreNodes()) 
       {
         ((KeyWalker)m_ki.getFirstWalker()).m_lookupKey = m_lookupKey;
         next = m_ki.nextNode();        
       }
       
  -    if (null != next)
  +    if (DTM.NULL != next)
       {  
         m_lastFetched = next;
         this.setCurrentPos(++m_next);
  @@ -173,8 +171,8 @@
       else
         m_foundLast = true;                      
       
  -    m_lastFetched = null;
  -    return null;
  +    m_lastFetched = DTM.NULL;
  +    return DTM.NULL;
     }
     
     /**
  @@ -225,7 +223,7 @@
      *
      * @param node Node to add to cached nodes
      */
  -  public void addNode(Node node) 
  +  public void addNode(int node) 
     {
       NodeSet m_cachedNodes = getCachedNodes();
       if (null != m_cachedNodes)
  
  
  
  1.8.2.1   +11 -10    xml-xalan/java/src/org/apache/xalan/transformer/KeyTable.java
  
  Index: KeyTable.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/KeyTable.java,v
  retrieving revision 1.8
  retrieving revision 1.8.2.1
  diff -u -r1.8 -r1.8.2.1
  --- KeyTable.java	2000/11/30 18:28:20	1.8
  +++ KeyTable.java	2001/04/10 18:45:02	1.8.2.1
  @@ -56,10 +56,11 @@
    */
   package org.apache.xalan.transformer;
   
  -import org.w3c.dom.Element;
  -import org.w3c.dom.NamedNodeMap;
  -import org.w3c.dom.Node;
  -import org.w3c.dom.NodeList;
  +//import org.w3c.dom.Element;
  +//import org.w3c.dom.NamedNodeMap;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.NodeList;
  +import org.apache.xml.dtm.DTM;
   
   import java.util.Hashtable;
   import java.util.Vector;
  @@ -69,7 +70,7 @@
   import org.apache.xpath.objects.XObject;
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPathContext;
  -import org.apache.xpath.DOMHelper;
  +//import org.apache.xpath.DOMHelper;
   import org.apache.xml.utils.QName;
   import org.apache.xalan.templates.KeyDeclaration;
   import org.apache.xpath.XPathContext;
  @@ -92,7 +93,7 @@
      * The document key.  This table should only be used with contexts
      * whose Document roots match this key.
      */
  -  private Node m_docKey;
  +  private int m_docKey;
   
     /**
      * Get the document root matching this key.  
  @@ -100,7 +101,7 @@
      *
      * @return the document root matching this key
      */
  -  public Node getDocKey()
  +  public int getDocKey()
     {
       return m_docKey;
     }
  @@ -131,7 +132,7 @@
      * @throws javax.xml.transform.TransformerException
      */
     public KeyTable(
  -          Node doc, PrefixResolver nscontext, QName name, Vector keyDeclarations, XPathContext xmlLiaison)
  +          int doc, PrefixResolver nscontext, QName name, Vector keyDeclarations, XPathContext xmlLiaison)
               throws javax.xml.transform.TransformerException
     {
   
  @@ -190,7 +191,7 @@
           refsTable = new Hashtable();
         
         // initialize walker only once!
  -      if (m_keyIter.getFirstWalker().getRoot() == null)
  +      if (m_keyIter.getFirstWalker().getRoot() == DTM.NULL)
           m_keyIter.setLookupKey(ref);
         else
           ((KeyWalker)m_keyIter.getFirstWalker()).m_lookupKey = ref;
  @@ -220,7 +221,7 @@
      * @param ref Key ref(from key use field)
      * @param node Node matching that ref 
      */
  -  void addRefNode(String ref, Node node)
  +  void addRefNode(String ref, int node)
     {
       KeyRefIterator kiRef = null;
       Hashtable refsTable = null;
  
  
  
  1.12.2.1  +42 -44    xml-xalan/java/src/org/apache/xalan/transformer/KeyWalker.java
  
  Index: KeyWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/KeyWalker.java,v
  retrieving revision 1.12
  retrieving revision 1.12.2.1
  diff -u -r1.12 -r1.12.2.1
  --- KeyWalker.java	2001/03/19 22:05:13	1.12
  +++ KeyWalker.java	2001/04/10 18:45:02	1.12.2.1
  @@ -69,11 +69,14 @@
   import org.apache.xpath.objects.XObject;
   import org.apache.xpath.XPath;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.DOMException;
  -import org.w3c.dom.NamedNodeMap;
  -import org.w3c.dom.traversal.NodeFilter;
  -import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.DOMException;
  +//import org.w3c.dom.NamedNodeMap;
  +//import org.w3c.dom.traversal.NodeFilter;
  +//import org.w3c.dom.traversal.NodeIterator;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
  +import org.apache.xml.dtm.DTMFilter;
   
   import javax.xml.transform.TransformerException;
   
  @@ -99,25 +102,21 @@
      *
      * @param root Document root node
      */
  -  public void setRoot(Node root)
  +  public void setRoot(int root)
     {
   
  -    m_attrs = null;
  +    m_nextAttr = DTM.NULL;
       m_foundAttrs = false;
  -    m_attrPos = 0;
   
       super.setRoot(root);
     }
   
  -  /** List of attribute nodes of the current node      */
  -  transient NamedNodeMap m_attrs;
  +  /** First attribute of the current node.      */
  +  transient int m_nextAttr;
   
     /** Flag indicating that attibute nodes were found for the current node    */
     transient boolean m_foundAttrs;
   
  -  /** Current position in the attribute nodes list         */
  -  transient int m_attrPos;
  -
     /** Key value that this is looking for.
      *  @serial           */
     String m_lookupKey;
  @@ -127,30 +126,28 @@
      *
      * @return The next node found or null.
      */
  -  protected Node getNextNode()
  +  protected int getNextNode()
     {
   
  +    int currentNode = getCurrentNode();
  +    DTM dtm = this.m_lpi.getXPathContext().getDTM(currentNode);
       if (!m_foundAttrs)
       {
  -      m_attrs = getCurrentNode().getAttributes();
  +      m_nextAttr = dtm.getFirstAttribute(currentNode);
         m_foundAttrs = true;
  +      if (DTM.NULL != m_nextAttr)
  +        return m_nextAttr;
       }
  -
  -    if (null != m_attrs)
  +    else if (DTM.NULL != m_nextAttr)
       {
  -      if (m_attrPos < m_attrs.getLength())
  -      {
  -        return m_attrs.item(m_attrPos++);
  -      }
  -      else
  -      {
  -        m_attrs = null;
  -      }
  +      m_nextAttr = dtm.getNextAttribute(m_nextAttr);
  +      if (DTM.NULL != m_nextAttr)
  +        return m_nextAttr;
       }
   
  -    Node next = super.getNextNode();
  +    int next = super.getNextNode();
   
  -    if (null != next)
  +    if (DTM.NULL != next)
         m_foundAttrs = false;
   
       return next;
  @@ -167,9 +164,9 @@
      * @return  a constant to determine whether the node is accepted,
      *   rejected, or skipped, as defined  above .
      */
  -  public short acceptNode(Node testNode)
  +  public short acceptNode(int testNode)
     {
  -		boolean foundKey = false;
  +    boolean foundKey = false;
       KeyIterator ki = (KeyIterator) m_lpi;
       Vector keys = ki.getKeyDeclarations();
   
  @@ -191,7 +188,7 @@
           if(!kd.getName().equals(name)) 
             continue;
           
  -				foundKey = true;
  +                                foundKey = true;
           ki.getXPathContext().setNamespaceContext(ki.getPrefixResolver());
   
           // See if our node matches the given key declaration according to 
  @@ -213,12 +210,12 @@
             ((KeyIterator)m_lpi).addRefNode(exprResult, testNode);
             
             if (lookupKey.equals(exprResult))
  -            return this.FILTER_ACCEPT;
  +            return DTMIterator.FILTER_ACCEPT;
           }
           else
           {
  -          NodeIterator nl = xuse.nodeset();
  -          Node useNode;
  +          DTMIterator nl = xuse.nodeset();
  +          int useNode;
             short result = -1;
             /*
             We are walking through all the nodes in this nodeset
  @@ -232,14 +229,15 @@
             matches. What if the next call is for the same match+use 
             combination??
             */
  -          while (null != (useNode = nl.nextNode()))
  +          while (DTM.NULL != (useNode = nl.nextNode()))
             {
  -            String exprResult = m_lpi.getDOMHelper().getNodeData(useNode);
  +            DTM dtm = getDTM(useNode);
  +            String exprResult = dtm.getStringValue(useNode);
               ((KeyIterator)m_lpi).addRefNode(exprResult, testNode); 
               
               if ((null != exprResult) && lookupKey.equals(exprResult))
  -              result = this.FILTER_ACCEPT;
  -              //return this.FILTER_ACCEPT;
  +              result = DTMIterator.FILTER_ACCEPT;
  +              //return DTMIterator.FILTER_ACCEPT;
             }
             if (-1 != result)
               return result;
  @@ -253,10 +251,10 @@
         // TODO: What to do?
       }
   
  -		if (!foundKey)
  -			throw new RuntimeException
  -				(XSLMessages.createMessage(XSLTErrorResources.ER_NO_XSLKEY_DECLARATION, new Object[]{name.getLocalName()}));
  -    return this.FILTER_REJECT;
  +                if (!foundKey)
  +                        throw new RuntimeException
  +                                (XSLMessages.createMessage(XSLTErrorResources.ER_NO_XSLKEY_DECLARATION, new Object[]{name.getLocalName()}));
  +    return DTMIterator.FILTER_REJECT;
     }
     
      /**
  @@ -269,13 +267,13 @@
      * @return  The new node, or <code>null</code> if the current node has no
      *   next node  in the TreeWalker's logical view.
      */
  -  public Node nextNode()
  +  public int nextNode()
     {
  -    Node node = super.nextNode();
  +    int node = super.nextNode();
       // If there is no next node, we have walked the whole source tree.
       // Notify the iterator of that so that its callers know that there
       // are no more nodes to be found.
  -    if (node == null)
  +    if (node == DTM.NULL)
         ((KeyIterator)m_lpi).setLookForMoreNodes(false);
       return node;
     }
  
  
  
  1.9.2.1   +28 -26    xml-xalan/java/src/org/apache/xalan/transformer/NodeSorter.java
  
  Index: NodeSorter.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/NodeSorter.java,v
  retrieving revision 1.9
  retrieving revision 1.9.2.1
  diff -u -r1.9 -r1.9.2.1
  --- NodeSorter.java	2000/12/12 21:32:56	1.9
  +++ NodeSorter.java	2001/04/10 18:45:03	1.9.2.1
  @@ -61,8 +61,10 @@
   import java.text.NumberFormat;
   import java.text.CollationKey;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.traversal.NodeIterator;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
   
   import org.apache.xpath.axes.ContextNodeList;
   import org.apache.xpath.XPathContext;
  @@ -127,7 +129,7 @@
   
       for (int i = 0; i < n; i++)
       {
  -      NodeCompareElem elem = new NodeCompareElem((Node) v.elementAt(i));
  +      NodeCompareElem elem = new NodeCompareElem(v.elementAt(i));
   
         nodes.addElement(elem);
       }
  @@ -294,8 +296,8 @@
         // be a glitch in the mergesort
         // if(r1.getType() == r1.CLASS_NODESET)
         // {
  -      result = support.getDOMHelper().isNodeAfter(n1.m_node, n2.m_node)
  -               ? -1 : 1;
  +      DTM dtm = support.getDTM(n1.m_node); // %OPT%
  +      result = dtm.isNodeAfter(n1.m_node, n2.m_node) ? -1 : 1;
   
         // }
       }
  @@ -462,22 +464,22 @@
         }
       } // end QuickSort2  */
   
  -  /**
  -   * Simple function to swap two elements in
  -   * a vector.
  -   * 
  -   * @param v Vector of nodes to swap
  -   * @param i Index of first node to swap
  -   * @param i Index of second node to swap
  -   */
  -  private void swap(Vector v, int i, int j)
  -  {
  -
  -    Node node = (Node) v.elementAt(i);
  -
  -    v.setElementAt(v.elementAt(j), i);
  -    v.setElementAt(node, j);
  -  }
  +//  /**
  +//   * Simple function to swap two elements in
  +//   * a vector.
  +//   * 
  +//   * @param v Vector of nodes to swap
  +//   * @param i Index of first node to swap
  +//   * @param i Index of second node to swap
  +//   */
  +//  private void swap(Vector v, int i, int j)
  +//  {
  +//
  +//    int node = (Node) v.elementAt(i);
  +//
  +//    v.setElementAt(v.elementAt(j), i);
  +//    v.setElementAt(node, j);
  +//  }
   
     /**
      * <meta name="usage" content="internal"/>
  @@ -488,7 +490,7 @@
     {
   
       /** Current node          */
  -    Node m_node;
  +    int m_node;
   
       /** This maxkey value was chosen arbitrarily. We are assuming that the    
       // maxkey + 1 keys will only hit fairly rarely and therefore, we
  @@ -514,7 +516,7 @@
        *
        * @throws javax.xml.transform.TransformerException
        */
  -    NodeCompareElem(Node node) throws javax.xml.transform.TransformerException
  +    NodeCompareElem(int node) throws javax.xml.transform.TransformerException
       {
   
         boolean tryNextKey = true;
  @@ -546,10 +548,10 @@
   
           if (r.getType() == XObject.CLASS_NODESET)
           {
  -          NodeIterator ni = (NodeIterator) r.object();
  +          DTMIterator ni = r.nodeset();
   
  -          if (ni instanceof ContextNodeList)
  -            tryNextKey = (((ContextNodeList) ni).getCurrentNode() != null);
  +          // if (ni instanceof ContextNodeList) // %REVIEW%
  +          tryNextKey = (ni.getCurrentNode() != DTM.NULL);
   
             // else abdicate... should never happen, but... -sb
           }
  
  
  
  1.9.2.1   +16 -13    xml-xalan/java/src/org/apache/xalan/transformer/QueuedStartElement.java
  
  Index: QueuedStartElement.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/QueuedStartElement.java,v
  retrieving revision 1.9
  retrieving revision 1.9.2.1
  diff -u -r1.9 -r1.9.2.1
  --- QueuedStartElement.java	2001/03/11 21:58:47	1.9
  +++ QueuedStartElement.java	2001/04/10 18:45:03	1.9.2.1
  @@ -72,13 +72,16 @@
   import org.apache.xalan.templates.ElemTemplateElement;
   import org.apache.xalan.templates.ElemTemplate;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.traversal.NodeIterator;
   
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
  +
   /**
    * Tracks the state of a queued element event.
    */
  -public class QueuedStartElement extends QueuedSAXEvent implements TransformState
  +public class QueuedStartElement extends QueuedSAXEvent
   {
   
     /**
  @@ -124,7 +127,7 @@
     /**
      * The current context node in the source tree.
      */
  -  private Node m_currentNode;
  +  private int m_currentNode;
     
     /**
      * The xsl:template that is in effect, which may be a matched template
  @@ -141,12 +144,12 @@
      * The node in the source tree that matched
      * the template obtained via getMatchedTemplate().
      */
  -  private Node m_matchedNode;
  +  private int m_matchedNode;
     
     /**
      * The current context node list.
      */
  -  private NodeIterator m_contextNodeList;
  +  private DTMIterator m_contextNodeList;
     
     /**
      * Clear the pending event.
  @@ -158,10 +161,10 @@
       if(m_isTransformClient)
       {
         m_currentElement = null;
  -      m_currentNode = null;
  +      m_currentNode = DTM.NULL;
         m_currentTemplate = null;
         m_matchedTemplate = null;
  -      m_matchedNode = null;
  +      m_matchedNode = DTM.NULL;
         m_contextNodeList = null; // TODO: Need to clone
       }
     }
  @@ -190,9 +193,9 @@
       if(m_isTransformClient && (null != m_transformer))
       {
         m_currentElement = m_transformer.getCurrentElement();
  -      m_currentNode = m_transformer.getCurrentNode();
         m_currentTemplate = m_transformer.getCurrentTemplate();
         m_matchedTemplate = m_transformer.getMatchedTemplate();
  +      m_currentNode = m_transformer.getCurrentNode();
         m_matchedNode = m_transformer.getMatchedNode();
         m_contextNodeList = m_transformer.getContextNodeList(); // TODO: Need to clone
       }
  @@ -390,9 +393,9 @@
      *
      * @return the current context node in the source tree.
      */
  -  public Node getCurrentNode()
  +  public int getCurrentNode()
     {
  -    return m_currentTemplate;
  +    return m_currentNode;
     }
     
     /**
  @@ -436,7 +439,7 @@
      * @return the node in the source tree that matched
      * the template obtained via getMatchedTemplate().
      */
  -  public Node getMatchedNode()
  +  public int getMatchedNode()
     {
       return m_matchedNode;
     }
  @@ -446,7 +449,7 @@
      *
      * @return the current context node list.
      */
  -  public NodeIterator getContextNodeList()
  +  public DTMIterator getContextNodeList()
     {
       return m_contextNodeList;
     }
  
  
  
  1.37.2.1  +94 -72    xml-xalan/java/src/org/apache/xalan/transformer/ResultTreeHandler.java
  
  Index: ResultTreeHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/ResultTreeHandler.java,v
  retrieving revision 1.37
  retrieving revision 1.37.2.1
  diff -u -r1.37 -r1.37.2.1
  --- ResultTreeHandler.java	2001/03/28 04:41:04	1.37
  +++ ResultTreeHandler.java	2001/04/10 18:45:03	1.37.2.1
  @@ -73,12 +73,15 @@
   import org.apache.xpath.objects.XObject;
   import org.apache.xpath.XPathContext;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.traversal.NodeIterator;
  -import org.w3c.dom.Attr;
  -import org.w3c.dom.DocumentFragment;
  -import org.w3c.dom.NodeList;
  -import org.w3c.dom.NamedNodeMap;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.Attr;
  +//import org.w3c.dom.DocumentFragment;
  +//import org.w3c.dom.NodeList;
  +//import org.w3c.dom.NamedNodeMap;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
  +import org.apache.xml.dtm.DTMFilter;
   
   import org.xml.sax.Attributes;
   import org.xml.sax.ContentHandler;
  @@ -792,14 +795,14 @@
             throws org.xml.sax.SAXException
     {
   
  -    DocumentFragment docFrag = obj.rtree(support);
  -    TreeWalker tw = new TreeWalker(this, support.getDOMHelper());
  +    DTMIterator docFrag = obj.rtree(support);
  +    int doc = docFrag.nextNode();
  +    DTM dtm = docFrag.getDTM(doc);
   
  -    Node n;
  -    for (n = docFrag.getFirstChild(); null != n; n = n.getNextSibling())
  +    for (int n = dtm.getFirstChild(doc); DTM.NULL != n; n = dtm.getNextSibling(n))
       {
         flushPending(EVT_NODE);  // I think.
  -      tw.traverse(n);
  +      dtm.dispatchToEvents(n, this);
       }
     }
   
  @@ -811,7 +814,7 @@
      *
      * @throws org.xml.sax.SAXException
      */
  -  public void cloneToResultTree(Node node, boolean shouldCloneAttributes)
  +  public void cloneToResultTree(int node, boolean shouldCloneAttributes)
             throws org.xml.sax.SAXException
     {
       try
  @@ -974,43 +977,38 @@
      *
      * @throws TransformerException
      */
  -  public void processNSDecls(Node src) throws TransformerException
  +  public void processNSDecls(int src) throws TransformerException
     {
   
       try
       {
         int type;
  +      DTM dtm = m_transformer.getXPathContext().getDTM(src);
   
         // Vector nameValues = null;
         // Vector alreadyProcessedPrefixes = null;
  -      Node parent;
  +      int parent;
   
  -      if (((type = src.getNodeType()) == Node.ELEMENT_NODE || (type == Node.ENTITY_REFERENCE_NODE))
  -          && (parent = src.getParentNode()) != null)
  +      if (((type = dtm.getNodeType(src)) == DTM.ELEMENT_NODE || 
  +           (type == DTM.ENTITY_REFERENCE_NODE))
  +          && (parent = dtm.getParent(src)) != DTM.NULL)
         {
           processNSDecls(parent);
         }
   
  -      if (type == Node.ELEMENT_NODE)
  +      if (type == DTM.ELEMENT_NODE)
         {
  -        NamedNodeMap nnm = src.getAttributes();
  -        int nAttrs = nnm.getLength();
   
  -        for (int i = 0; i < nAttrs; i++)
  +        for (int namespace = dtm.getFirstNamespaceNode(src, true);
  +             DTM.NULL != namespace; namespace = dtm.getNextNamespaceNode(namespace, true))
           {
  -          Node attr = nnm.item(i);
  -          String aname = attr.getNodeName();
  +          String prefix = dtm.getPrefix(namespace);
  +          String desturi = getURI(prefix);
  +          String srcURI = dtm.getStringValue(namespace);
   
  -          if (QName.isXMLNSDecl(aname))
  +          if (!srcURI.equalsIgnoreCase(desturi))
             {
  -            String prefix = QName.getPrefixFromXMLNSDecl(aname);
  -            String desturi = getURI(prefix);
  -            String srcURI = attr.getNodeValue();
  -
  -            if (!srcURI.equalsIgnoreCase(desturi))
  -            {
  -              this.startPrefixMapping(prefix, srcURI, false);
  -            }
  +            this.startPrefixMapping(prefix, srcURI, false);
             }
           }
         }
  @@ -1243,25 +1241,46 @@
      * @return True if the namespace is already defined in 
      * list of namespaces
      */
  -  public boolean isDefinedNSDecl(Attr attr)
  +  public boolean isDefinedNSDecl(int attr)
     {
  -
  -    String rawName = attr.getNodeName();
  -
  -    if (rawName.equals("xmlns") || rawName.startsWith("xmlns:"))
  +    DTM dtm = m_transformer.getXPathContext().getDTM(attr);
  +    if(DTM.NAMESPACE_NODE == dtm.getNodeType(attr))
       {
  -      int index;
  -      String prefix = (index = rawName.indexOf(":")) < 0
  -                      ? "" : rawName.substring(0, index);
  +      String prefix = dtm.getPrefix(attr);
         String uri = getURI(prefix);
  +  
  +      if ((null != uri) && uri.equals(dtm.getStringValue(attr)))
  +        return true;
  +    }
   
  -      if ((null != uri) && uri.equals(attr.getValue()))
  +    return false;
  +  }
  +  
  +  /**
  +   * Returns whether a namespace is defined 
  +   *
  +   *
  +   * @param attr Namespace attribute node
  +   * @param dtm The DTM that owns attr.
  +   *
  +   * @return True if the namespace is already defined in 
  +   * list of namespaces
  +   */
  +  public boolean isDefinedNSDecl(int attr, DTM dtm)
  +  {
  +    if(DTM.NAMESPACE_NODE == dtm.getNodeType(attr))
  +    {
  +      String prefix = dtm.getPrefix(attr);
  +      String uri = getURI(prefix);
  +  
  +      if ((null != uri) && uri.equals(dtm.getStringValue(attr)))
           return true;
       }
   
       return false;
     }
   
  +
     /**
      * Copy an DOM attribute to the created output element, executing
      * attribute templates as need be, and processing the xsl:use
  @@ -1271,21 +1290,21 @@
      *
      * @throws TransformerException
      */
  -  public void addAttribute(Attr attr) throws TransformerException
  +  public void addAttribute(int attr) throws TransformerException
     {
  +    DTM dtm = m_transformer.getXPathContext().getDTM(attr);
   
  -    if (isDefinedNSDecl(attr))
  +    if (isDefinedNSDecl(attr, dtm))
         return;
  -
  -    DOMHelper helper = m_transformer.getXPathContext().getDOMHelper();
       
  -    String ns = helper.getNamespaceOfNode(attr);
  +    String ns = dtm.getNamespaceURI(attr);
       if(ns == null)
         ns = "";
   
  +    // %OPT% ...can I just store the node handle?    
       addAttribute(ns,
  -                 helper.getLocalNameOfNode(attr), attr.getNodeName(),
  -                 "CDATA", attr.getValue());
  +                 dtm.getLocalName(attr), dtm.getNodeName(attr),
  +                 "CDATA", dtm.getStringValue(attr));
     }  // end copyAttributeToTarget method
   
     /**
  @@ -1295,16 +1314,13 @@
      *
      * @throws TransformerException
      */
  -  public void addAttributes(Node src) throws TransformerException
  +  public void addAttributes(int src) throws TransformerException
     {
  -
  -    NamedNodeMap nnm = src.getAttributes();
  -    int nAttrs = nnm.getLength();
  +    DTM dtm = m_transformer.getXPathContext().getDTM(src);
   
  -    for (int i = 0; i < nAttrs; i++)
  +    for (int node = dtm.getFirstAttribute(src); DTM.NULL != node; 
  +         node = dtm.getNextAttribute(node))
       {
  -      Attr node = (Attr) nnm.item(i);
  -
         addAttribute(node);
       }
     }
  @@ -1347,13 +1363,15 @@
      *
      * @return the current context node in the source tree.
      */
  -  public Node getCurrentNode()
  +  public org.w3c.dom.Node getCurrentNode()
     {
  -    QueuedStartElement qe = getQueuedElem();
  -    if(null != qe && qe.isPending)
  -      return qe.getCurrentNode();
  -    else
  -      return m_transformer.getCurrentNode();
  +    // %TBD% Need DTM2DOM stuff
  +    return null;
  +//    QueuedStartElement qe = getQueuedElem();
  +//    if(null != qe && qe.isPending)
  +//      return qe.getCurrentNode();
  +//    else
  +//      return m_transformer.getCurrentNode();
     }
   
     /**
  @@ -1405,13 +1423,15 @@
      * @return the node in the source tree that matched
      * the template obtained via getMatchedTemplate().
      */
  -  public Node getMatchedNode()
  +  public org.w3c.dom.Node getMatchedNode()
     {
  -    QueuedStartElement qe = getQueuedElem();
  -    if(null != qe && qe.isPending)
  -      return qe.getMatchedNode();
  -    else
  -      return m_transformer.getMatchedNode();
  +    // %TBD% Need DTM2DOM stuff
  +    return null;
  +//    QueuedStartElement qe = getQueuedElem();
  +//    if(null != qe && qe.isPending)
  +//      return qe.getMatchedNode();
  +//    else
  +//      return m_transformer.getMatchedNode();
     }
   
     /**
  @@ -1419,13 +1439,15 @@
      *
      * @return the current context node list.
      */
  -  public NodeIterator getContextNodeList()
  +  public org.w3c.dom.traversal.NodeIterator getContextNodeList()
     {
  -    QueuedStartElement qe = getQueuedElem();
  -    if(null != qe && qe.isPending)
  -      return qe.getContextNodeList();
  -    else
  -      return m_transformer.getContextNodeList();
  +    // %TBD% Need DTM2DOM stuff
  +    return null;
  +//    QueuedStartElement qe = getQueuedElem();
  +//    if(null != qe && qe.isPending)
  +//      return qe.getContextNodeList();
  +//    else
  +//      return m_transformer.getContextNodeList();
     }
   
     /**
  
  
  
  1.5.2.1   +22 -20    xml-xalan/java/src/org/apache/xalan/transformer/StackGuard.java
  
  Index: StackGuard.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/StackGuard.java,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- StackGuard.java	2000/12/13 17:23:02	1.5
  +++ StackGuard.java	2001/04/10 18:45:03	1.5.2.1
  @@ -56,9 +56,10 @@
    */
   package org.apache.xalan.transformer;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.Text;
  -import org.w3c.dom.Element;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.Text;
  +//import org.w3c.dom.Element;
  +import org.apache.xml.dtm.DTM;
   
   import java.io.PrintWriter;
   import java.io.StringWriter;
  @@ -119,10 +120,10 @@
     }
   
     /** Stylesheet Template node          */
  -  Node m_xslRule;
  +  ElemTemplateElement m_xslRule;
   
     /** Source node          */
  -  Node m_sourceXML;
  +  int m_sourceXML;
   
     /** Stack where ElemTempalteElements will be pushed          */
     java.util.Stack stack = new java.util.Stack();
  @@ -140,7 +141,7 @@
      * @param xslTemplate Current template node
      * @param sourceXML Source Node
      */
  -  public StackGuard(ElemTemplateElement xslTemplate, Node sourceXML)
  +  public StackGuard(ElemTemplateElement xslTemplate, int sourceXML)
     {
       m_xslRule = xslTemplate;
       m_sourceXML = sourceXML;
  @@ -158,7 +159,7 @@
     {
   
       if (((StackGuard) obj).m_xslRule.equals(m_xslRule)
  -            && ((StackGuard) obj).m_sourceXML.equals(m_sourceXML))
  +            && ((StackGuard) obj).m_sourceXML == m_sourceXML)
       {
         return true;
       }
  @@ -176,18 +177,19 @@
     {
   
       // for the moment, these diagnostics are really bad...
  -    if (m_sourceXML instanceof Text)
  -    {
  -      Text tx = (Text) m_sourceXML;
  -
  -      pw.println(tx.getData());
  -    }
  -    else if (m_sourceXML instanceof Element)
  -    {
  -      Element elem = (Element) m_sourceXML;
  -
  -      pw.println(elem.getNodeName());
  -    }
  +    // %TBD% We need an execution context.
  +//    if (m_sourceXML instanceof Text)
  +//    {
  +//      Text tx = (Text) m_sourceXML;
  +//
  +//      pw.println(tx.getData());
  +//    }
  +//    else if (m_sourceXML instanceof Element)
  +//    {
  +//      Element elem = (Element) m_sourceXML;
  +//
  +//      pw.println(elem.getNodeName());
  +//    }
     }
   
     /**
  @@ -249,7 +251,7 @@
      *
      * @throws TransformerException
      */
  -  public void push(ElemTemplateElement xslTemplate, Node sourceXML)
  +  public void push(ElemTemplateElement xslTemplate, int sourceXML)
             throws TransformerException
     {
   
  
  
  
  1.90.2.1  +399 -357  xml-xalan/java/src/org/apache/xalan/transformer/TransformerImpl.java
  
  Index: TransformerImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/TransformerImpl.java,v
  retrieving revision 1.90
  retrieving revision 1.90.2.1
  diff -u -r1.90 -r1.90.2.1
  --- TransformerImpl.java	2001/03/28 04:41:04	1.90
  +++ TransformerImpl.java	2001/04/10 18:45:04	1.90.2.1
  @@ -121,11 +121,13 @@
   import org.apache.xalan.serialize.Method;
   
   // DOM Imports
  -import org.w3c.dom.Attr;
  -import org.w3c.dom.DocumentFragment;
  -import org.w3c.dom.Document;
  -import org.w3c.dom.traversal.NodeIterator;
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Attr;
  +//import org.w3c.dom.DocumentFragment;
  +//import org.w3c.dom.Document;
  +//import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.Node;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
   
   // SAX2 Imports
   import org.xml.sax.ContentHandler;
  @@ -169,7 +171,7 @@
    * representation of the transformation execution.</p>
    */
   public class TransformerImpl extends Transformer
  -        implements Runnable, TransformState
  +        implements Runnable /* %TBD% , TransformState */
   {
     // Synch object to gaurd against setting values from the TrAX interface 
     // or reentry while the transform is going on.
  @@ -347,7 +349,7 @@
     /** This is needed for support of setSourceTreeDocForThread(Node doc),
      * which must be called in order for the transform thread's run 
      * method to obtain the root of the source tree to be transformed.     */
  -  private Node m_doc;
  +  private int m_doc;
   
     /**
      * If the the transform is on the secondary thread, we
  @@ -355,8 +357,12 @@
      */
     private boolean m_isTransformDone = false;
     
  +  // %TODO% Doc
     private boolean m_hasBeenReset = false;
     
  +  // %TODO% Doc
  +  private Stack m_modes = new Stack();
  +  
     //==========================================================
     // SECTION: Constructors
     //==========================================================
  @@ -411,7 +417,7 @@
         m_countersTable = null;
         m_currentTemplateRuleIsNull = new BoolStack();
         m_xmlSource = null;
  -      m_doc = null;
  +      m_doc = DTM.NULL;
         m_isTransformDone = false;
         m_inputContentHandler = null;
         
  @@ -483,22 +489,23 @@
       {
         DOMSource dsource = (DOMSource)source;
         m_urlOfSource = dsource.getSystemId();
  -      Node dNode = dsource.getNode();
  -      if (null != dNode)
  -      {  
  -        if(null != m_urlOfSource)
  -        {
  -          // System.out.println("Putting document in cache: "+m_urlOfSource);
  -          this.getXPathContext().getSourceTreeManager().putDocumentInCache(dNode, dsource);
  -        }
  -        this.transformNode(dsource.getNode());
  -        return;
  -      }
  -      else
  -      {
  -        String messageStr = XSLMessages.createMessage(XSLTErrorResources.ER_ILLEGAL_DOMSOURCE_INPUT, null);
  -        throw new IllegalArgumentException(messageStr);
  -      } 
  +      // %TBD%
  +//      Node dNode = dsource.getNode();
  +//      if (null != dNode)
  +//      {  
  +//        if(null != m_urlOfSource)
  +//        {
  +//          // System.out.println("Putting document in cache: "+m_urlOfSource);
  +//          this.getXPathContext().getSourceTreeManager().putDocumentInCache(dNode, dsource);
  +//        }
  +//        this.transformNode(dsource.getNode());
  +//        return;
  +//      }
  +//      else
  +//      {
  +//        String messageStr = XSLMessages.createMessage(XSLTErrorResources.ER_ILLEGAL_DOMSOURCE_INPUT, null);
  +//        throw new IllegalArgumentException(messageStr);
  +//      } 
       }
       InputSource xmlSource = SAXSource.sourceToInputSource(source);
       if(null == xmlSource)
  @@ -597,31 +604,32 @@
   
           sth.setInputSource(source);
           sth.setUseMultiThreading(true);
  -
  -        Node doc = sth.getRoot();
   
  -        if (null != doc)
  -        {
  -          SourceTreeManager stm = getXPathContext().getSourceTreeManager();
  -          stm.putDocumentInCache(doc, source);
  -
  -          m_xmlSource = source;
  -          m_doc = doc;
  -
  -          if (isParserEventsOnMain())
  -          {
  -            m_isTransformDone = false;
  -
  -            getXPathContext().getPrimaryReader().parse(xmlSource);
  -          }
  -          else
  -          {
  -            Thread t = createTransformThread();
  -//            m_reportInPostExceptionFromThread = false;
  -            t.start();
  -            transformNode(doc);
  -          }
  -        }
  +        // %TBD%
  +//        Node doc = sth.getRoot();
  +//
  +//        if (null != doc)
  +//        {
  +//          SourceTreeManager stm = getXPathContext().getSourceTreeManager();
  +//          stm.putDocumentInCache(doc, source);
  +//
  +//          m_xmlSource = source;
  +//          m_doc = doc;
  +//
  +//          if (isParserEventsOnMain())
  +//          {
  +//            m_isTransformDone = false;
  +//
  +//            getXPathContext().getPrimaryReader().parse(xmlSource);
  +//          }
  +//          else
  +//          {
  +//            Thread t = createTransformThread();
  +//  //            m_reportInPostExceptionFromThread = false;
  +//            t.start();
  +//            transformNode(doc);
  +//          }
  +//        }
         }
         else
         {
  @@ -879,149 +887,150 @@
     {    
       return (Properties)getOutputFormat().getProperties().clone();  
     }
  -
  -  /**
  -   * <meta name="usage" content="internal"/>
  -   * Process the an input source to a DOM node.  FOR INTERNAL USE ONLY.
  -   * 
  -   * @param xmlSource  The input for the source tree.
  -   *
  -   * @return The Node result of the parse, never null.
  -   *
  -   * @throws TransformerException
  -   */
  -  public Node parseToNode(Source source) throws TransformerException
  -  {
  -    if(source instanceof DOMSource)
  -      return ((DOMSource)source).getNode();
  -    
  -    InputSource xmlSource = SAXSource.sourceToInputSource(source);
  -    if(null == xmlSource)
  -    {
  -      throw new TransformerException("Can't transform a Source of type "+
  -        source.getClass().getName()+"!");
  -    }
  -
  -    // Duplicate code from above... but slightly different.  
  -    // TODO: Work on this...
  -    if (null != xmlSource.getSystemId())
  -      m_urlOfSource = xmlSource.getSystemId();
  -
  -    Node doc = null;
  -    try
  -    {
  -      // Get an already set XMLReader, or create one.
  -      XMLReader reader = null;
  -      if(source instanceof SAXSource)
  -        reader = ((SAXSource)source).getXMLReader();
  -
  -      if (null == reader)
  -      {
  -        // Use JAXP1.1 ( if possible )
  -        try {
  -          javax.xml.parsers.SAXParserFactory factory=
  -                                                     javax.xml.parsers.SAXParserFactory.newInstance();
  -          factory.setNamespaceAware( true );
  -          javax.xml.parsers.SAXParser jaxpParser=
  -                                                 factory.newSAXParser();
  -          reader=jaxpParser.getXMLReader();
  -          
  -        } catch( javax.xml.parsers.ParserConfigurationException ex ) {
  -          throw new org.xml.sax.SAXException( ex );
  -        } catch( javax.xml.parsers.FactoryConfigurationError ex1 ) {
  -            throw new org.xml.sax.SAXException( ex1.toString() );
  -        } catch( NoSuchMethodError ex2 ) {
  -        }
  -        catch (AbstractMethodError ame){}
  -      }
  -
  -      if (null == reader)
  -      {
  -        reader = XMLReaderFactory.createXMLReader();
  -      }
  -
  -      try
  -      {
  -        reader.setFeature("http://xml.org/sax/features/namespace-prefixes",
  -                          true);
  -        reader.setFeature(
  -                          "http://apache.org/xml/features/validation/dynamic", true);
  -      }
  -      catch (org.xml.sax.SAXException se)
  -      {
  -
  -        // What can we do?
  -        // TODO: User diagnostics.
  -      }
  -
  -      // TODO: Handle Xerces DOM parser.
  -      // Get the input content handler, which will handle the 
  -      // parse events and create the source tree.
  -      ContentHandler inputHandler = getInputContentHandler();
  -      Class inputHandlerClass = ((Object) inputHandler).getClass();
  -
  -      inputHandler = (ContentHandler) inputHandlerClass.newInstance();
  -
  -      reader.setContentHandler(inputHandler);
  -      if(inputHandler instanceof org.xml.sax.DTDHandler)
  -        reader.setDTDHandler((org.xml.sax.DTDHandler)inputHandler);
  -      try
  -      {
  -        if(inputHandler instanceof org.xml.sax.ext.LexicalHandler)
  -          reader.setProperty("http://xml.org/sax/properties/lexical-handler",
  -                             inputHandler);
  -        if(inputHandler instanceof org.xml.sax.ext.DeclHandler)
  -          reader.setProperty("http://xml.org/sax/properties/declaration-handler",
  -                             inputHandler);
  -      }
  -      catch(SAXNotRecognizedException snre){}
  -      try
  -      {
  -        if(inputHandler instanceof org.xml.sax.ext.LexicalHandler)
  -          reader.setProperty("http://xml.org/sax/handlers/LexicalHandler",
  -                             inputHandler);
  -        if(inputHandler instanceof org.xml.sax.ext.DeclHandler)
  -          reader.setProperty("http://xml.org/sax/handlers/DeclHandler",
  -                             inputHandler);
  -      }
  -      catch(org.xml.sax.SAXNotRecognizedException snre)
  -      {
  -      }
  -      getXPathContext().setPrimaryReader(reader);
  -
  -      // ...and of course I need a standard way to get a node...
  -      if (inputHandler instanceof org.apache.xalan.stree.SourceTreeHandler)
  -      {
  -
  -        // Kick off the parse.  When the ContentHandler gets 
  -        // the startDocument event, it will call transformNode( node ).
  -        reader.parse(xmlSource);
  -
  -        doc =
  -             ((org.apache.xalan.stree.SourceTreeHandler) inputHandler).getRoot();
  -      }
   
  -    }
  -    catch (java.lang.IllegalAccessException iae)
  -    {
  -      throw new TransformerException(iae);
  -    }
  -    catch (InstantiationException ie)
  -    {
  -      throw new TransformerException(ie);
  -    }
  -    catch(org.xml.sax.SAXException se)
  -    {
  -      throw new TransformerException(se);
  -    }
  -    catch (IOException ioe)
  -    {
  -      throw new TransformerException(ioe);
  -    }
  -
  -
  -    return doc;
  -  }
  +  // %REVIEW% OK to delete?  Who needs this?
  +//  /**
  +//   * <meta name="usage" content="internal"/>
  +//   * Process the an input source to a DOM node.  FOR INTERNAL USE ONLY.
  +//   * 
  +//   * @param xmlSource  The input for the source tree.
  +//   *
  +//   * @return The Node result of the parse, never null.
  +//   *
  +//   * @throws TransformerException
  +//   */
  +//  public Node parseToNode(Source source) throws TransformerException
  +//  {
  +//    if(source instanceof DOMSource)
  +//      return ((DOMSource)source).getNode();
  +//    
  +//    InputSource xmlSource = SAXSource.sourceToInputSource(source);
  +//    if(null == xmlSource)
  +//    {
  +//      throw new TransformerException("Can't transform a Source of type "+
  +//        source.getClass().getName()+"!");
  +//    }
  +//
  +//    // Duplicate code from above... but slightly different.  
  +//    // TODO: Work on this...
  +//    if (null != xmlSource.getSystemId())
  +//      m_urlOfSource = xmlSource.getSystemId();
  +//
  +//    Node doc = null;
  +//    try
  +//    {
  +//      // Get an already set XMLReader, or create one.
  +//      XMLReader reader = null;
  +//      if(source instanceof SAXSource)
  +//        reader = ((SAXSource)source).getXMLReader();
  +//
  +//      if (null == reader)
  +//      {
  +//        // Use JAXP1.1 ( if possible )
  +//        try {
  +//          javax.xml.parsers.SAXParserFactory factory=
  +//                                                     javax.xml.parsers.SAXParserFactory.newInstance();
  +//          factory.setNamespaceAware( true );
  +//          javax.xml.parsers.SAXParser jaxpParser=
  +//                                                 factory.newSAXParser();
  +//          reader=jaxpParser.getXMLReader();
  +//          
  +//        } catch( javax.xml.parsers.ParserConfigurationException ex ) {
  +//          throw new org.xml.sax.SAXException( ex );
  +//        } catch( javax.xml.parsers.FactoryConfigurationError ex1 ) {
  +//            throw new org.xml.sax.SAXException( ex1.toString() );
  +//        } catch( NoSuchMethodError ex2 ) {
  +//        }
  +//        catch (AbstractMethodError ame){}
  +//      }
  +//
  +//      if (null == reader)
  +//      {
  +//        reader = XMLReaderFactory.createXMLReader();
  +//      }
  +//
  +//      try
  +//      {
  +//        reader.setFeature("http://xml.org/sax/features/namespace-prefixes",
  +//                          true);
  +//        reader.setFeature(
  +//                          "http://apache.org/xml/features/validation/dynamic", true);
  +//      }
  +//      catch (org.xml.sax.SAXException se)
  +//      {
  +//
  +//        // What can we do?
  +//        // TODO: User diagnostics.
  +//      }
  +//
  +//      // TODO: Handle Xerces DOM parser.
  +//      // Get the input content handler, which will handle the 
  +//      // parse events and create the source tree.
  +//      ContentHandler inputHandler = getInputContentHandler();
  +//      Class inputHandlerClass = ((Object) inputHandler).getClass();
  +//
  +//      inputHandler = (ContentHandler) inputHandlerClass.newInstance();
  +//
  +//      reader.setContentHandler(inputHandler);
  +//      if(inputHandler instanceof org.xml.sax.DTDHandler)
  +//        reader.setDTDHandler((org.xml.sax.DTDHandler)inputHandler);
  +//      try
  +//      {
  +//        if(inputHandler instanceof org.xml.sax.ext.LexicalHandler)
  +//          reader.setProperty("http://xml.org/sax/properties/lexical-handler",
  +//                             inputHandler);
  +//        if(inputHandler instanceof org.xml.sax.ext.DeclHandler)
  +//          reader.setProperty("http://xml.org/sax/properties/declaration-handler",
  +//                             inputHandler);
  +//      }
  +//      catch(SAXNotRecognizedException snre){}
  +//      try
  +//      {
  +//        if(inputHandler instanceof org.xml.sax.ext.LexicalHandler)
  +//          reader.setProperty("http://xml.org/sax/handlers/LexicalHandler",
  +//                             inputHandler);
  +//        if(inputHandler instanceof org.xml.sax.ext.DeclHandler)
  +//          reader.setProperty("http://xml.org/sax/handlers/DeclHandler",
  +//                             inputHandler);
  +//      }
  +//      catch(org.xml.sax.SAXNotRecognizedException snre)
  +//      {
  +//      }
  +//      getXPathContext().setPrimaryReader(reader);
  +//
  +//      // ...and of course I need a standard way to get a node...
  +//      if (inputHandler instanceof org.apache.xalan.stree.SourceTreeHandler)
  +//      {
  +//
  +//        // Kick off the parse.  When the ContentHandler gets 
  +//        // the startDocument event, it will call transformNode( node ).
  +//        reader.parse(xmlSource);
  +//
  +//        doc =
  +//             ((org.apache.xalan.stree.SourceTreeHandler) inputHandler).getRoot();
  +//      }
  +//
  +//    }
  +//    catch (java.lang.IllegalAccessException iae)
  +//    {
  +//      throw new TransformerException(iae);
  +//    }
  +//    catch (InstantiationException ie)
  +//    {
  +//      throw new TransformerException(ie);
  +//    }
  +//    catch(org.xml.sax.SAXException se)
  +//    {
  +//      throw new TransformerException(se);
  +//    }
  +//    catch (IOException ioe)
  +//    {
  +//      throw new TransformerException(ioe);
  +//    }
  +//
  +//
  +//    return doc;
  +//  }
   
     /**
      * Create a result ContentHandler from a Result object, based 
  @@ -1057,34 +1066,36 @@
     public ContentHandler createResultContentHandler(
             Result outputTarget, OutputProperties format) throws TransformerException
     {    
  -    ContentHandler handler;
  +    ContentHandler handler = null;
       
       // If the Result object contains a Node, then create 
       // a ContentHandler that will add nodes to the input node.
  -    Node outputNode = null;
  +    // %TBD%
  +//    Node outputNode = null;
       if(outputTarget instanceof DOMResult)
       {
  -      outputNode = ((DOMResult)outputTarget).getNode();
  -
  -      Document doc;
  -      short type;
  -      if (null != outputNode)
  -      {
  -        type = outputNode.getNodeType();
  -        doc = (Node.DOCUMENT_NODE == type)
  -                       ? (Document) outputNode : outputNode.getOwnerDocument();
  -      }
  -      else
  -      {
  -        doc = getXPathContext().getDOMHelper().createDocument();
  -        outputNode = doc;
  -        type = outputNode.getNodeType();
  -        ((DOMResult)outputTarget).setNode(outputNode);
  -      }
  -      
  -      handler = (Node.DOCUMENT_FRAGMENT_NODE == type)
  -                ? new DOMBuilder(doc, (DocumentFragment) outputNode)
  -                  : new DOMBuilder(doc, outputNode);
  +      // %TBD%
  +//      outputNode = ((DOMResult)outputTarget).getNode();
  +//
  +//      Document doc;
  +//      short type;
  +//      if (null != outputNode)
  +//      {
  +//        type = outputNode.getNodeType();
  +//        doc = (Node.DOCUMENT_NODE == type)
  +//                       ? (Document) outputNode : outputNode.getOwnerDocument();
  +//      }
  +//      else
  +//      {
  +//        doc = getXPathContext().getDOMHelper().createDocument();
  +//        outputNode = doc;
  +//        type = outputNode.getNodeType();
  +//        ((DOMResult)outputTarget).setNode(outputNode);
  +//      }
  +//      
  +//      handler = (Node.DOCUMENT_FRAGMENT_NODE == type)
  +//                ? new DOMBuilder(doc, (DocumentFragment) outputNode)
  +//                  : new DOMBuilder(doc, outputNode);
       }
       else if(outputTarget instanceof SAXResult)
       {
  @@ -1165,12 +1176,13 @@
      * Process the source node to the output result, if the
      * processor supports the "http://xml.org/trax/features/dom/input"
      * feature.
  -   * @param node  The input source node, which can be any valid DOM node.
  +   * %REVIEW% Do we need a Node version of this?
  +   * @param node  The input source node, which can be any valid DTM node.
      * @param outputTarget The output source target.
      *
      * @throws TransformerException
      */
  -  public void transformNode(Node node, Result outputTarget)
  +  public void transformNode(int node, Result outputTarget)
             throws TransformerException
     {
   
  @@ -1185,12 +1197,13 @@
      * Process the source node to the output result, if the
      * processor supports the "http://xml.org/trax/features/dom/input"
      * feature.
  -   * @param node  The input source node, which can be any valid DOM node.
  +   * %REVIEW% Do we need a Node version of this?
  +   * @param node  The input source node, which can be any valid DTM node.
      * @param outputTarget The output source target.
      *
      * @throws TransformerException
      */
  -  public void transformNode(Node node) throws TransformerException
  +  public void transformNode(int node) throws TransformerException
     {
       // Make sure we're not writing to the same output content handler.
       synchronized(m_outputContentHandler)
  @@ -1229,7 +1242,7 @@
     
           // ===========
           // System.out.println("Calling applyTemplateToNode - "+Thread.currentThread().getName());
  -        this.applyTemplateToNode(null, null, node, null);
  +        this.applyTemplateToNode(null, null, node);
           // System.out.println("Done with applyTemplateToNode - "+Thread.currentThread().getName());
     
           if (null != m_resultTreeHandler)
  @@ -1562,7 +1575,7 @@
      * @throws TransformerException
      */
     public void pushParams(
  -          XPathContext xctxt, ElemCallTemplate xslCallTemplateElement, Node sourceNode, QName mode)
  +          XPathContext xctxt, ElemCallTemplate xslCallTemplateElement)
               throws TransformerException
     {
   
  @@ -1587,20 +1600,22 @@
   
         if (null != param)
         {
  +        int sourceNode = xctxt.getCurrentNode();
           var = param.execute(getXPathContext(), sourceNode, xslParamElement);
         }
  -      else if (null == xslParamElement.getFirstChild())
  +      else if (null == xslParamElement.getFirstChildElem())
         {
           var = XString.EMPTYSTRING;
         }
         else
         {
   
  -        // Use result tree fragment
  -        DocumentFragment df = transformToRTF(xslParamElement, sourceNode,
  -                                             mode);
  +         int sourceNode = xctxt.getCurrentNode();
  +       // Use result tree fragment
  +       // %TBD% Make sure current node is pushed.
  +        int df = transformToRTF(xslParamElement);
   
  -        var = new XRTreeFrag(df);
  +        var = new XRTreeFrag(xctxt.createDTMIterator(df));
         }
   
         vars.setSearchStart(paramReferenceContext);
  @@ -1641,7 +1656,7 @@
      *
      * @throws TransformerException
      */
  -  protected void pushGlobalVars(Node contextNode) throws TransformerException
  +  protected void pushGlobalVars(int contextNode) throws TransformerException
     {
   
       // I'm a little unhappy with this, as it seems like 
  @@ -1767,93 +1782,94 @@
      *
      * @throws TransformerException
      */
  -  public DocumentFragment transformToRTF(
  -          ElemTemplateElement templateParent, Node sourceNode, QName mode)
  +  public int transformToRTF(
  +          ElemTemplateElement templateParent)
               throws TransformerException
     {
  -
  -    // XPathContext xctxt = getXPathContext();
  -    // Document docFactory = xctxt.getDOMHelper().getDOMFactory();
  -    ContentHandler rtfHandler;
  -    DocumentFragment resultFragment;
  -    
  -    // If this is an Stree instance, handle it with SourceTreeHandler
  -    // and bypass the whole DOM process.
  -    boolean isSTree = (sourceNode instanceof org.apache.xalan.stree.Child);
  -    if (isSTree)
  -    {      
  -      rtfHandler = new SourceTreeHandler(this, true);
  -      ((SourceTreeHandler)rtfHandler).setUseMultiThreading(false);
  -      ((SourceTreeHandler)rtfHandler).setShouldTransformAtEnd(false);
  -      // Create a ResultTreeFrag object.
  -      resultFragment = (DocumentFragment)((SourceTreeHandler)rtfHandler).getRoot();
  -      // ((org.apache.xalan.stree.DocumentFragmentImpl)resultFragment).setComplete(true);     
  -    }     
  -    else
  -    {
  -      if (null == m_docBuilder)
  -      {
  -        try
  -        {
  -          DocumentBuilderFactory dfactory =
  -                                 DocumentBuilderFactory.newInstance();
  -
  -          dfactory.setNamespaceAware(true);
  -          dfactory.setValidating(true);
  -
  -          m_docBuilder = dfactory.newDocumentBuilder();
  -        }
  -        catch (ParserConfigurationException pce)
  -        {
  -          throw new TransformerException(pce);  //"createDocument() not supported in XPathContext!");
  -
  -          // return null;
  -        }
  -      }     
  -      Document docFactory = m_docBuilder.newDocument();
  -      // Create a ResultTreeFrag object.
  -      resultFragment = docFactory.createDocumentFragment();           
  -      // Create a DOMBuilder object that will handle the SAX events 
  -      // and build the ResultTreeFrag nodes.
  -      rtfHandler = new DOMBuilder(docFactory, resultFragment);
  -    }
  -
  -    // Save the current result tree handler.
  -    ResultTreeHandler savedRTreeHandler = this.m_resultTreeHandler;
  -
  -    // And make a new handler for the RTF.
  -    m_resultTreeHandler = new ResultTreeHandler(this, rtfHandler);
  -    ResultTreeHandler rth = m_resultTreeHandler;
  -
  -    try
  -    {
  -      rth.startDocument();
  -  
  -      try
  -      {
  -        // Do the transformation of the child elements.
  -        executeChildTemplates(templateParent, sourceNode, mode, true);
  -        
  -        // Make sure everything is flushed!
  -        rth.flushPending();
  -      }
  -      finally
  -      {      
  -        rth.endDocument();
  -      }
  -    }
  -    catch(org.xml.sax.SAXException se)
  -    {
  -      throw new TransformerException(se);
  -    }
  -
  -    finally
  -    {
  -    // Restore the previous result tree handler.
  -    this.m_resultTreeHandler = savedRTreeHandler;
  -    }
  -    
  -    return resultFragment;
  +    // %TBD%
  +    return 0;
  +//    // XPathContext xctxt = getXPathContext();
  +//    // Document docFactory = xctxt.getDOMHelper().getDOMFactory();
  +//    ContentHandler rtfHandler;
  +//    DocumentFragment resultFragment;
  +//    
  +//    // If this is an Stree instance, handle it with SourceTreeHandler
  +//    // and bypass the whole DOM process.
  +//    boolean isSTree = (sourceNode instanceof org.apache.xalan.stree.Child);
  +//    if (isSTree)
  +//    {      
  +//      rtfHandler = new SourceTreeHandler(this, true);
  +//      ((SourceTreeHandler)rtfHandler).setUseMultiThreading(false);
  +//      ((SourceTreeHandler)rtfHandler).setShouldTransformAtEnd(false);
  +//      // Create a ResultTreeFrag object.
  +//      resultFragment = (DocumentFragment)((SourceTreeHandler)rtfHandler).getRoot();
  +//      // ((org.apache.xalan.stree.DocumentFragmentImpl)resultFragment).setComplete(true);     
  +//    }     
  +//    else
  +//    {
  +//      if (null == m_docBuilder)
  +//      {
  +//        try
  +//        {
  +//          DocumentBuilderFactory dfactory =
  +//                                 DocumentBuilderFactory.newInstance();
  +//
  +//          dfactory.setNamespaceAware(true);
  +//          dfactory.setValidating(true);
  +//
  +//          m_docBuilder = dfactory.newDocumentBuilder();
  +//        }
  +//        catch (ParserConfigurationException pce)
  +//        {
  +//          throw new TransformerException(pce);  //"createDocument() not supported in XPathContext!");
  +//
  +//          // return null;
  +//        }
  +//      }     
  +//      Document docFactory = m_docBuilder.newDocument();
  +//      // Create a ResultTreeFrag object.
  +//      resultFragment = docFactory.createDocumentFragment();           
  +//      // Create a DOMBuilder object that will handle the SAX events 
  +//      // and build the ResultTreeFrag nodes.
  +//      rtfHandler = new DOMBuilder(docFactory, resultFragment);
  +//    }
  +//
  +//    // Save the current result tree handler.
  +//    ResultTreeHandler savedRTreeHandler = this.m_resultTreeHandler;
  +//
  +//    // And make a new handler for the RTF.
  +//    m_resultTreeHandler = new ResultTreeHandler(this, rtfHandler);
  +//    ResultTreeHandler rth = m_resultTreeHandler;
  +//
  +//    try
  +//    {
  +//      rth.startDocument();
  +//  
  +//      try
  +//      {
  +//        // Do the transformation of the child elements.
  +//        executeChildTemplates(templateParent, sourceNode, mode, true);
  +//        
  +//        // Make sure everything is flushed!
  +//        rth.flushPending();
  +//      }
  +//      finally
  +//      {      
  +//        rth.endDocument();
  +//      }
  +//    }
  +//    catch(org.xml.sax.SAXException se)
  +//    {
  +//      throw new TransformerException(se);
  +//    }
  +//
  +//    finally
  +//    {
  +//    // Restore the previous result tree handler.
  +//    this.m_resultTreeHandler = savedRTreeHandler;
  +//    }
  +//    
  +//    return resultFragment;
     }
   
   
  @@ -1885,7 +1901,7 @@
      * @throws TransformerException
      */
     public String transformToString(
  -          ElemTemplateElement elem, Node sourceNode, QName mode)
  +          ElemTemplateElement elem)
               throws TransformerException
     {
   
  @@ -1935,7 +1951,7 @@
         this.m_resultTreeHandler.startDocument();
   
         // Do the transformation of the child elements.
  -      executeChildTemplates(elem, sourceNode, mode, true);
  +      executeChildTemplates(elem, true);
         this.m_resultTreeHandler.endDocument();
   
         result = sw.toString();
  @@ -1978,12 +1994,11 @@
      * @return true if applied a template, false if not.
      */
     public boolean applyTemplateToNode(ElemTemplateElement xslInstruction,  // xsl:apply-templates or xsl:for-each
  -                                     ElemTemplateElement template,  // may be null
  -                                             Node child, QName mode)
  +                                     ElemTemplateElement template, int child)
                                                        throws TransformerException
     {
  -
  -    short nodeType = child.getNodeType();
  +    DTM dtm = m_xcontext.getDTM(child);
  +    short nodeType =  dtm.getNodeType(child);
       boolean isDefaultTextRule = false;
   
       if (null == template)
  @@ -2011,6 +2026,8 @@
         try
         {
           xctxt.setNamespaceContext(xslInstruction);
  +        // %TBD%
  +        QName mode = this.getMode();
           template = m_stylesheetRoot.getTemplateComposed(xctxt, child, mode, maxImportLevel,
                                     m_quietConflictWarnings);
         }
  @@ -2025,17 +2042,17 @@
         {
           switch (nodeType)
           {
  -        case Node.DOCUMENT_FRAGMENT_NODE :
  -        case Node.ELEMENT_NODE :
  +        case DTM.DOCUMENT_FRAGMENT_NODE :
  +        case DTM.ELEMENT_NODE :
             template = m_stylesheetRoot.getDefaultRule();
             break;
  -        case Node.CDATA_SECTION_NODE :
  -        case Node.TEXT_NODE :
  -        case Node.ATTRIBUTE_NODE :
  +        case DTM.CDATA_SECTION_NODE :
  +        case DTM.TEXT_NODE :
  +        case DTM.ATTRIBUTE_NODE :
             template = m_stylesheetRoot.getDefaultTextRule();
             isDefaultTextRule = true;
             break;
  -        case Node.DOCUMENT_NODE :
  +        case DTM.DOCUMENT_NODE :
             template = m_stylesheetRoot.getDefaultRootRule();
             break;
           default :
  @@ -2058,27 +2075,22 @@
         {
           switch (nodeType)
           {
  -        case Node.CDATA_SECTION_NODE :
  -        case Node.TEXT_NODE :
  +        case DTM.CDATA_SECTION_NODE :
  +        case DTM.TEXT_NODE :
             m_resultTreeHandler.m_cloner.cloneToResultTree(child, false);
             break;
  -        case Node.ATTRIBUTE_NODE :
  -        {
  -          String val = ((Attr) child).getValue();
  -
  -          getResultTreeHandler().characters(val.toCharArray(), 0,
  -                                            val.length());
  -        }
  -        break;
  +        case DTM.ATTRIBUTE_NODE :
  +          dtm.dispatchCharactersEvents(child, getResultTreeHandler());
  +          break;
           }
         }
         else
         {
   
           // Fire a trace event for the template.
  -
  -        if (TransformerImpl.S_DEBUG)
  -          getTraceManager().fireTraceEvent(child, mode, template);
  +        // 
  +//        if (TransformerImpl.S_DEBUG)
  +//          getTraceManager().fireTraceEvent(child, mode, template);
   
           // And execute the child templates.
           // 9/11/00: If template has been compiled, hand off to it
  @@ -2092,10 +2104,11 @@
   
           m_xcontext.setSAXLocator(template);
   
  -        if (template.isCompiledTemplate())
  -          template.execute(this, child, mode);
  -        else
  -          executeChildTemplates(template, child, mode, true);
  +        // %TBD% ??
  +//        if (template.isCompiledTemplate())
  +//          template.execute(this, child, mode);
  +//        else
  +        executeChildTemplates(template, true);
         }
       }
       catch(org.xml.sax.SAXException se)
  @@ -2126,7 +2139,7 @@
      * @throws TransformerException
      */
     public void executeChildTemplates(
  -          ElemTemplateElement elem, Node sourceNode, QName mode, ContentHandler handler)
  +          ElemTemplateElement elem, ContentHandler handler)
               throws TransformerException
     {
   
  @@ -2142,7 +2155,8 @@
       {
         getResultTreeHandler().flushPending();
         this.setContentHandler(handler);
  -      executeChildTemplates(elem, sourceNode, mode, true);
  +      // %REVIEW% Make sure current node is being pushed.
  +      executeChildTemplates(elem, true);
       }
       catch(org.xml.sax.SAXException se)
       {
  @@ -2173,7 +2187,7 @@
      * @throws TransformerException
      */
     public void executeChildTemplates(
  -          ElemTemplateElement elem, Node sourceNode, QName mode, boolean shouldAddAttrs)
  +          ElemTemplateElement elem, boolean shouldAddAttrs)
               throws TransformerException
     {
   
  @@ -2188,8 +2202,9 @@
       // Check for infinite loops if we have to.
       boolean check = (m_stackGuard.m_recursionLimit > -1);
   
  -    if (check)
  -      getStackGuard().push(elem, sourceNode);
  +    // %TBD%
  +//    if (check)
  +//      getStackGuard().push(elem, sourceNode);
   
       // We need to push an element frame in the variables stack, 
       // so all the variables can be popped at once when we're done.
  @@ -2211,8 +2226,9 @@
           if(!shouldAddAttrs && t.getXSLToken() == Constants.ELEMNAME_ATTRIBUTE)
             continue;
           xctxt.setSAXLocator(t);
  -        m_currentTemplateElements.setTail(t);
  -        t.execute(this, sourceNode, mode);
  +        // %TBD% NodeVector may not work for this purpose anymore
  +//        m_currentTemplateElements.setTail(t);
  +        t.execute(this);
         }
       }
       finally
  @@ -2243,7 +2259,7 @@
      * @throws TransformerException
      */
     public Vector processSortKeys(
  -                                ElemForEach foreach, Node sourceNodeContext)
  +                                ElemForEach foreach, int sourceNodeContext)
       throws TransformerException
     {
   
  @@ -2338,7 +2354,8 @@
      */
     public void pushElemTemplateElement(ElemTemplateElement elem)
     {
  -    m_currentTemplateElements.push(elem);
  +        // %TBD% NodeVector may not work for this purpose anymore
  +//    m_currentTemplateElements.push(elem);
     }
   
     /**
  @@ -2358,7 +2375,8 @@
      */
     public void setCurrentElement(ElemTemplateElement e)
     {
  -    m_currentTemplateElements.setTail(e);
  +        // %TBD% NodeVector may not work for this purpose anymore
  +//    m_currentTemplateElements.setTail(e);
     }
   
     /**
  @@ -2370,7 +2388,9 @@
      */
     public ElemTemplateElement getCurrentElement()
     {
  -    return (ElemTemplateElement) m_currentTemplateElements.peepTail();
  +        // %TBD% NodeVector may not work for this purpose anymore
  +      return null;
  +//    return (ElemTemplateElement) m_currentTemplateElements.peepTail();
     }
   
     /**
  @@ -2379,7 +2399,7 @@
      *
      * @return The current context node (should never be null?).
      */
  -  public Node getCurrentNode()
  +  public int getCurrentNode()
     {
       return m_xcontext.getCurrentNode();
     }
  @@ -2416,9 +2436,10 @@
      * @param template xsl:template or xsl:for-each.
      * @param child The child that was matched.
      */
  -  public void pushPairCurrentMatched(ElemTemplateElement template, Node child)
  +  public void pushPairCurrentMatched(ElemTemplateElement template, int child)
     {
  -    m_currentMatchTemplates.pushPair(template, child);
  +        // %TBD% NodeVector may not work for this purpose anymore
  +//    m_currentMatchTemplates.pushPair(template, child);
     }
   
     /**
  @@ -2440,7 +2461,9 @@
      */
     public ElemTemplate getMatchedTemplate()
     {
  -    return (ElemTemplate) m_currentMatchTemplates.peepTailSub1();
  +        // %TBD% NodeVector may not work for this purpose anymore
  +      return null;
  +//    return (ElemTemplate) m_currentMatchTemplates.peepTailSub1();
     }
   
     /**
  @@ -2450,7 +2473,7 @@
      * @return The matched node that corresponds to the 
      * match attribute of the current xsl:template.
      */
  -  public Node getMatchedNode()
  +  public int getMatchedNode()
     {
       return m_currentMatchTemplates.peepTail();
     }
  @@ -2460,7 +2483,7 @@
      *
      * @return A reset clone of the context node list.
      */
  -  public NodeIterator getContextNodeList()
  +  public DTMIterator getContextNodeList()
     {
   
       try
  @@ -2825,6 +2848,25 @@
   
       throw new SAXNotRecognizedException(name);
     }
  +  
  +  // %TODO% Doc
  +  public QName getMode()
  +  {
  +    return m_modes.isEmpty() ? null : (QName)m_modes.peek();
  +  }
  +  
  +  // %TODO% Doc
  +  public void pushMode(QName mode)
  +  {
  +    m_modes.push(mode);
  +  }
  +  
  +  // %TODO% Doc
  +  public void popMode()
  +  {
  +    m_modes.pop();
  +  }
  +
   
     ////////////////////////
     // Implement Runnable //  
  @@ -2862,7 +2904,7 @@
      * @param doc A non-null reference to the root of the 
      * tree to be transformed.
      */
  -  public void setSourceTreeDocForThread(Node doc)
  +  public void setSourceTreeDocForThread(int doc)
     {
       m_doc = doc;
     }
  
  
  
  1.9.2.1   +80 -91    xml-xalan/java/src/org/apache/xalan/transformer/TreeWalker2Result.java
  
  Index: TreeWalker2Result.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/TreeWalker2Result.java,v
  retrieving revision 1.9
  retrieving revision 1.9.2.1
  diff -u -r1.9 -r1.9.2.1
  --- TreeWalker2Result.java	2001/03/12 02:12:53	1.9
  +++ TreeWalker2Result.java	2001/04/10 18:45:04	1.9.2.1
  @@ -56,11 +56,12 @@
    */
   package org.apache.xalan.transformer;
   
  -import org.w3c.dom.*;
  +//import org.w3c.dom.*;
  +import org.apache.xml.dtm.DTM;
   
   import org.xml.sax.*;
   
  -import org.apache.xml.utils.TreeWalker;
  +import org.apache.xml.dtm.DTMTreeWalker;
   import org.apache.xml.utils.MutableAttrListImpl;
   import org.apache.xalan.templates.ElemTemplateElement;
   import org.apache.xpath.DOMHelper;
  @@ -70,7 +71,7 @@
    * Handle a walk of a tree, but screen out attributes for
    * the result tree.
    */
  -public class TreeWalker2Result extends TreeWalker
  +public class TreeWalker2Result extends DTMTreeWalker
   {
   
     /** The transformer instance          */
  @@ -80,7 +81,7 @@
     ResultTreeHandler m_handler;
   
     /** Node where to start the tree walk           */
  -  Node m_startNode;
  +  int m_startNode;
   
     /**
      * Constructor.
  @@ -92,7 +93,7 @@
                              ResultTreeHandler handler)
     {
   
  -    super(handler, transformer.getXPathContext().getDOMHelper());
  +    super(handler, null);
   
       m_transformer = transformer;
       m_handler = handler;
  @@ -105,9 +106,9 @@
      *
      * @throws TransformerException
      */
  -  public void traverse(Node pos) throws org.xml.sax.SAXException
  +  public void traverse(int pos) throws org.xml.sax.SAXException
     {
  -
  +    m_dtm = m_transformer.getXPathContext().getDTM(pos);
       m_startNode = pos;
   
       super.traverse(pos);
  @@ -121,93 +122,81 @@
      *
      * @throws TransformerException
      */
  -  protected void startNode(Node node) throws org.xml.sax.SAXException
  +  protected void startNode(int node) throws org.xml.sax.SAXException
     {
   
  -    try
  +//    try
       {
  -      if ((Node.ELEMENT_NODE == node.getNodeType()) && (m_startNode == node))
  +      
  +      if ((DTM.ELEMENT_NODE == m_dtm.getNodeType(node)) && (m_startNode == node))
         {
  -        DOMHelper dhelper = m_transformer.getXPathContext().getDOMHelper();
  -        String elemName = node.getNodeName();
  -        String localName = dhelper.getLocalNameOfNode(node);
  -        String namespace = dhelper.getNamespaceOfNode(node);
  +        String elemName = m_dtm.getNodeName(node);
  +        String localName = m_dtm.getLocalName(node);
  +        String namespace = m_dtm.getNamespaceURI(node);
   
           m_handler.startElement(namespace, localName, elemName, null);
   
  -        for (Node parent = node; parent != null;
  -             parent = parent.getParentNode())
  -        {
  -          if (Node.ELEMENT_NODE != parent.getNodeType())
  -            continue;
  -
  -          NamedNodeMap atts = ((Element) parent).getAttributes();
  -          int n = atts.getLength();
  -
  -          for (int i = 0; i < n; i++)
  -          {
  -            String nsDeclPrefix = null;
  -            Attr attr = (Attr) atts.item(i);
  -            String name = attr.getName();
  -            String value = attr.getValue();
  -
  -            if (name.startsWith("xmlns:"))
  -            {
  -
  -              // get the namespace prefix 
  -              nsDeclPrefix = name.substring(name.indexOf(":") + 1);
  -            }
  -            else if (name.equals("xmlns"))
  -            {
  -              nsDeclPrefix = "";
  -            }
  -
  -            if ((nsDeclPrefix == null) && (node != parent))
  -              continue;
  -
  -            /*
  -            else if(nsDeclPrefix != null)
  -            {
  -            String desturi = m_processor.getURI(nsDeclPrefix);
  -            // Look for an alias for this URI. If one is found, use it as the result URI
  -            String aliasURI = m_elem.m_stylesheet.lookForAlias(value);
  -            if(aliasURI.equals(desturi)) // TODO: Check for extension namespaces
  -            {
  -            continue;
  -            }
  -            }
  -            */
  -            m_handler.addAttribute(dhelper.getNamespaceOfNode(attr),
  -                                   dhelper.getLocalNameOfNode(attr), name,
  -                                   "CDATA", value);
  -
  -            // Make sure namespace is not in the excluded list then
  -            // add to result tree
  -
  -            /*
  -            if(!m_handler.getPendingAttributes().contains(name))
  -            {
  -            if(nsDeclPrefix == null)
  -            {
  -            m_handler.addAttribute(name, "CDATA", value);
  -            }
  -            else
  -            {
  -            String desturi
  -            = m_handler.getURI(nsDeclPrefix);
  -            if(null == desturi)
  -            {
  -            m_handler.addAttribute(name, "CDATA", value);
  -            }
  -            else if(!desturi.equals(value))
  -            {
  -            m_handler.addAttribute(name, "CDATA", value);
  -            }
  -            }
  -            }
  -            */
  -          }
  -        }
  +        // %TBD% But, the code below is strange...
  +//        for (int parent = node; parent != null;
  +//             parent = m_dtm.getParentNode(parent))
  +//        {
  +//          if (Node.ELEMENT_NODE != parent.getNodeType())
  +//            continue;
  +//
  +//          NamedNodeMap atts = ((Element) parent).getAttributes();
  +//          int n = atts.getLength();
  +//
  +//          for (int attr = m_dtm.getFirstAttribute(parent); 
  +//               DTM.NULL != attr; attr = m_dtm.getNextAttribute(attr))
  +//          {
  +//            String nsDeclPrefix = null;
  +//            
  +//            String name = m_dtm.getNodeName(attr);
  +//            String value = m_dtm.getStringValue(attr);
  +//
  +//            /*
  +//            else if(nsDeclPrefix != null)
  +//            {
  +//            String desturi = m_processor.getURI(nsDeclPrefix);
  +//            // Look for an alias for this URI. If one is found, use it as the result URI
  +//            String aliasURI = m_elem.m_stylesheet.lookForAlias(value);
  +//            if(aliasURI.equals(desturi)) // TODO: Check for extension namespaces
  +//            {
  +//            continue;
  +//            }
  +//            }
  +//            */
  +//            m_handler.addAttribute(dhelper.getNamespaceOfNode(attr),
  +//                                   dhelper.getLocalNameOfNode(attr), name,
  +//                                   "CDATA", value);
  +//
  +//            // Make sure namespace is not in the excluded list then
  +//            // add to result tree
  +//
  +//            /*
  +//            if(!m_handler.getPendingAttributes().contains(name))
  +//            {
  +//            if(nsDeclPrefix == null)
  +//            {
  +//            m_handler.addAttribute(name, "CDATA", value);
  +//            }
  +//            else
  +//            {
  +//            String desturi
  +//            = m_handler.getURI(nsDeclPrefix);
  +//            if(null == desturi)
  +//            {
  +//            m_handler.addAttribute(name, "CDATA", value);
  +//            }
  +//            else if(!desturi.equals(value))
  +//            {
  +//            m_handler.addAttribute(name, "CDATA", value);
  +//            }
  +//            }
  +//            }
  +//            */
  +//          }
  +//        }
   
           // m_handler.processResultNS(m_elem);           
         }
  @@ -215,10 +204,10 @@
         {
           super.startNode(node);
         }
  -    }
  -    catch(javax.xml.transform.TransformerException te)
  -    {
  -      throw new org.xml.sax.SAXException(te);
       }
  +//    catch(javax.xml.transform.TransformerException te)
  +//    {
  +//      throw new org.xml.sax.SAXException(te);
  +//    }
     }
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +775 -0    xml-xalan/java/src/org/apache/xml/dtm/Attic/DTM.java
  
  
  
  
  1.1.2.1   +189 -0    xml-xalan/java/src/org/apache/xml/dtm/Attic/DTMFilter.java
  
  
  
  
  1.1.2.1   +310 -0    xml-xalan/java/src/org/apache/xml/dtm/Attic/DTMIterator.java
  
  
  
  
  1.1.2.1   +193 -0    xml-xalan/java/src/org/apache/xml/dtm/Attic/DTMManager.java
  
  
  
  
  1.1.2.1   +387 -0    xml-xalan/java/src/org/apache/xml/dtm/Attic/DTMTreeWalker.java
  
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.8.2.1   +4 -2      xml-xalan/java/src/org/apache/xml/utils/DOMBuilder.java
  
  Index: DOMBuilder.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/utils/DOMBuilder.java,v
  retrieving revision 1.8
  retrieving revision 1.8.2.1
  diff -u -r1.8 -r1.8.2.1
  --- DOMBuilder.java	2001/01/29 21:18:34	1.8
  +++ DOMBuilder.java	2001/04/10 18:45:09	1.8.2.1
  @@ -342,7 +342,8 @@
         
         // append(elem);
     
  -      m_elemStack.push(elem);
  +      // %TBD%
  +//      m_elemStack.push(elem);
     
         m_currentNode = elem;
         
  @@ -375,7 +376,8 @@
     public void endElement(String ns, String localName, String name)
             throws org.xml.sax.SAXException
     {
  -    m_currentNode = m_elemStack.popAndTop();
  +    // %TBD%
  +//    m_currentNode = m_elemStack.popAndTop();
     }
   
     /**
  
  
  
  1.3.2.1   +51 -52    xml-xalan/java/src/org/apache/xml/utils/NodeVector.java
  
  Index: NodeVector.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/utils/NodeVector.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- NodeVector.java	2001/01/02 03:42:50	1.3
  +++ NodeVector.java	2001/04/10 18:45:09	1.3.2.1
  @@ -57,9 +57,8 @@
   package org.apache.xml.utils;
   
   import java.io.Serializable;
  +import org.apache.xml.dtm.DTM;
   
  -import org.w3c.dom.Node;
  -
   /**
    * <meta name="usage" content="internal"/>
    * A very simple table that stores a list of Nodes.
  @@ -73,7 +72,7 @@
   
     /** Array of nodes this points to.
      *  @serial          */
  -  private Node m_map[];
  +  private int m_map[];
   
     /** Number of nodes in this NodeVector.
      *  @serial          */
  @@ -117,7 +116,7 @@
   
       if ((null != this.m_map) && (this.m_map == clone.m_map))
       {
  -      clone.m_map = new Node[this.m_map.length];
  +      clone.m_map = new int[this.m_map.length];
   
         System.arraycopy(this.m_map, 0, clone.m_map, 0, this.m_map.length);
       }
  @@ -140,21 +139,21 @@
      *
      * @param value Node to add to the vector
      */
  -  public void addElement(Node value)
  +  public void addElement(int value)
     {
   
       if ((m_firstFree + 1) >= m_mapSize)
       {
         if (null == m_map)
         {
  -        m_map = new Node[m_blocksize];
  +        m_map = new int[m_blocksize];
           m_mapSize = m_blocksize;
         }
         else
         {
           m_mapSize += m_blocksize;
   
  -        Node newMap[] = new Node[m_mapSize];
  +        int newMap[] = new int[m_mapSize];
   
           System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1);
   
  @@ -172,7 +171,7 @@
      *
      * @param value Node to add to the vector
      */
  -  public final void push(Node value)
  +  public final void push(int value)
     {
   
       int ff = m_firstFree;
  @@ -181,14 +180,14 @@
       {
         if (null == m_map)
         {
  -        m_map = new Node[m_blocksize];
  +        m_map = new int[m_blocksize];
           m_mapSize = m_blocksize;
         }
         else
         {
           m_mapSize += m_blocksize;
   
  -        Node newMap[] = new Node[m_mapSize];
  +        int newMap[] = new int[m_mapSize];
   
           System.arraycopy(m_map, 0, newMap, 0, ff + 1);
   
  @@ -208,14 +207,14 @@
      *
      * @return the node at the tail of the vector
      */
  -  public final Node pop()
  +  public final int pop()
     {
   
       m_firstFree--;
   
  -    Node n = m_map[m_firstFree];
  +    int n = m_map[m_firstFree];
   
  -    m_map[m_firstFree] = null;
  +    m_map[m_firstFree] = DTM.NULL;
   
       return n;
     }
  @@ -226,14 +225,14 @@
      *
      * @return The top of the stack after it's been popped 
      */
  -  public final Node popAndTop()
  +  public final int popAndTop()
     {
   
       m_firstFree--;
   
  -    m_map[m_firstFree] = null;
  +    m_map[m_firstFree] = DTM.NULL;
   
  -    return (m_firstFree == 0) ? null : m_map[m_firstFree - 1];
  +    return (m_firstFree == 0) ? DTM.NULL : m_map[m_firstFree - 1];
     }
   
     /**
  @@ -244,7 +243,7 @@
   
       m_firstFree--;
   
  -    m_map[m_firstFree] = null;
  +    m_map[m_firstFree] = DTM.NULL;
     }
   
     /**
  @@ -254,10 +253,10 @@
      *
      * @return Node at the top of the stack or null if stack is empty.  
      */
  -  public final Node peepOrNull()
  +  public final int peepOrNull()
     {
       return ((null != m_map) && (m_firstFree > 0))
  -           ? m_map[m_firstFree - 1] : null;
  +           ? m_map[m_firstFree - 1] : DTM.NULL;
     }
   
     /**
  @@ -268,12 +267,12 @@
      * @param v1 First node to add to vector
      * @param v2 Second node to add to vector
      */
  -  public final void pushPair(Node v1, Node v2)
  +  public final void pushPair(int v1, int v2)
     {
   
       if (null == m_map)
       {
  -      m_map = new Node[m_blocksize];
  +      m_map = new int[m_blocksize];
         m_mapSize = m_blocksize;
       }
       else
  @@ -282,7 +281,7 @@
         {
           m_mapSize += m_blocksize;
   
  -        Node newMap[] = new Node[m_mapSize];
  +        int newMap[] = new int[m_mapSize];
   
           System.arraycopy(m_map, 0, newMap, 0, m_firstFree);
   
  @@ -304,8 +303,8 @@
     {
   
       m_firstFree -= 2;
  -    m_map[m_firstFree] = null;
  -    m_map[m_firstFree + 1] = null;
  +    m_map[m_firstFree] = DTM.NULL;
  +    m_map[m_firstFree + 1] = DTM.NULL;
     }
   
     /**
  @@ -315,7 +314,7 @@
      *
      * @param n Node to set at the tail of vector
      */
  -  public final void setTail(Node n)
  +  public final void setTail(int n)
     {
       m_map[m_firstFree - 1] = n;
     }
  @@ -327,7 +326,7 @@
      *
      * @param n Node to set
      */
  -  public final void setTailSub1(Node n)
  +  public final void setTailSub1(int n)
     {
       m_map[m_firstFree - 2] = n;
     }
  @@ -339,7 +338,7 @@
      *
      * @return Node at the tail of the vector
      */
  -  public final Node peepTail()
  +  public final int peepTail()
     {
       return m_map[m_firstFree - 1];
     }
  @@ -351,7 +350,7 @@
      *
      * @return Node one away from the tail
      */
  -  public final Node peepTailSub1()
  +  public final int peepTailSub1()
     {
       return m_map[m_firstFree - 2];
     }
  @@ -365,19 +364,19 @@
      * @param value Node to insert
      * @param at Position where to insert
      */
  -  public void insertElementAt(Node value, int at)
  +  public void insertElementAt(int value, int at)
     {
   
       if (null == m_map)
       {
  -      m_map = new Node[m_blocksize];
  +      m_map = new int[m_blocksize];
         m_mapSize = m_blocksize;
       }
       else if ((m_firstFree + 1) >= m_mapSize)
       {
         m_mapSize += m_blocksize;
   
  -      Node newMap[] = new Node[m_mapSize];
  +      int newMap[] = new int[m_mapSize];
   
         System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1);
   
  @@ -407,13 +406,13 @@
       if (null == m_map)
       {
         m_mapSize = nNodes + m_blocksize;
  -      m_map = new Node[m_mapSize];
  +      m_map = new int[m_mapSize];
       }
       else if ((m_firstFree + nNodes) >= m_mapSize)
       {
         m_mapSize += (nNodes + m_blocksize);
   
  -      Node newMap[] = new Node[m_mapSize];
  +      int newMap[] = new int[m_mapSize];
   
         System.arraycopy(m_map, 0, newMap, 0, m_firstFree + nNodes);
   
  @@ -439,7 +438,7 @@
   
       for (int i = 0; i < m_firstFree; i++)
       {
  -      m_map[i] = null;
  +      m_map[i] = DTM.NULL;
       }
   
       m_firstFree = 0;
  @@ -456,7 +455,7 @@
      *
      * @return True if the node was successfully removed
      */
  -  public boolean removeElement(Node s)
  +  public boolean removeElement(int s)
     {
   
       if (null == m_map)
  @@ -464,14 +463,14 @@
   
       for (int i = 0; i < m_firstFree; i++)
       {
  -      Node node = m_map[i];
  +      int node = m_map[i];
   
  -      if ((null != node) && node.equals(s))
  +      if ( node == s )
         {
           if (i > m_firstFree)
             System.arraycopy(m_map, i + 1, m_map, i - 1, m_firstFree - i);
           else
  -          m_map[i] = null;
  +          m_map[i] = DTM.NULL;
   
           m_firstFree--;
   
  @@ -499,7 +498,7 @@
       if (i > m_firstFree)
         System.arraycopy(m_map, i + 1, m_map, i - 1, m_firstFree - i);
       else
  -      m_map[i] = null;
  +      m_map[i] = DTM.NULL;
     }
   
     /**
  @@ -512,12 +511,12 @@
      * @param node Node to set
      * @param index Index of where to set the node
      */
  -  public void setElementAt(Node node, int index)
  +  public void setElementAt(int node, int index)
     {
   
       if (null == m_map)
       {
  -      m_map = new Node[m_blocksize];
  +      m_map = new int[m_blocksize];
         m_mapSize = m_blocksize;
       }
   
  @@ -531,11 +530,11 @@
      *
      * @return Node at specified index
      */
  -  public Node elementAt(int i)
  +  public int elementAt(int i)
     {
   
       if (null == m_map)
  -      return null;
  +      return DTM.NULL;
   
       return m_map[i];
     }
  @@ -547,7 +546,7 @@
      *
      * @return True if the given node was found.
      */
  -  public boolean contains(Node s)
  +  public boolean contains(int s)
     {
   
       if (null == m_map)
  @@ -555,9 +554,9 @@
   
       for (int i = 0; i < m_firstFree; i++)
       {
  -      Node node = m_map[i];
  +      int node = m_map[i];
   
  -      if ((null != node) && node.equals(s))
  +      if (node == s)
           return true;
       }
   
  @@ -575,7 +574,7 @@
      * argument in this vector at position index or later in the
      * vector; returns -1 if the object is not found.
      */
  -  public int indexOf(Node elem, int index)
  +  public int indexOf(int elem, int index)
     {
   
       if (null == m_map)
  @@ -583,9 +582,9 @@
   
       for (int i = index; i < m_firstFree; i++)
       {
  -      Node node = m_map[i];
  +      int node = m_map[i];
   
  -      if ((null != node) && node.equals(elem))
  +      if ( node == elem )
           return i;
       }
   
  @@ -602,7 +601,7 @@
      * argument in this vector at position index or later in the
      * vector; returns -1 if the object is not found.
      */
  -  public int indexOf(Node elem)
  +  public int indexOf(int elem)
     {
   
       if (null == m_map)
  @@ -610,9 +609,9 @@
   
       for (int i = 0; i < m_firstFree; i++)
       {
  -      Node node = m_map[i];
  +      int node = m_map[i];
   
  -      if ((null != node) && node.equals(elem))
  +      if (node == elem)
           return i;
       }
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.14.2.1  +1 -1      xml-xalan/java/src/org/apache/xpath/Expression.java
  
  Index: Expression.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/Expression.java,v
  retrieving revision 1.14
  retrieving revision 1.14.2.1
  diff -u -r1.14 -r1.14.2.1
  --- Expression.java	2001/03/16 22:17:27	1.14
  +++ Expression.java	2001/04/10 18:45:10	1.14.2.1
  @@ -56,7 +56,7 @@
    */
   package org.apache.xpath;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
   
   import org.apache.xpath.objects.XObject;
   import org.apache.xpath.res.XPATHErrorResources;
  
  
  
  1.10.2.1  +290 -215  xml-xalan/java/src/org/apache/xpath/NodeSet.java
  
  Index: NodeSet.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/NodeSet.java,v
  retrieving revision 1.10
  retrieving revision 1.10.2.1
  diff -u -r1.10 -r1.10.2.1
  --- NodeSet.java	2001/01/02 03:47:13	1.10
  +++ NodeSet.java	2001/04/10 18:45:10	1.10.2.1
  @@ -56,12 +56,17 @@
    */
   package org.apache.xpath;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.NodeList;
  -import org.w3c.dom.NamedNodeMap;
  -import org.w3c.dom.traversal.NodeIterator;
  -import org.w3c.dom.traversal.NodeFilter;
  -import org.w3c.dom.DOMException;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.NodeList;
  +//import org.w3c.dom.NamedNodeMap;
  +//import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.traversal.NodeFilter;
  +//import org.w3c.dom.DOMException;
  +
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMFilter;
  +import org.apache.xml.dtm.DTMIterator;
  +import org.apache.xml.dtm.DTMManager;
   
   import org.apache.xml.utils.NodeVector;
   import org.apache.xpath.axes.ContextNodeList;
  @@ -91,7 +96,8 @@
    * less-than-enlightening results when you do so.</p>
    */
   public class NodeSet extends NodeVector
  -        implements NodeList, NodeIterator, Cloneable, ContextNodeList
  +        implements /* NodeList, NodeIterator, */ DTMIterator, 
  +        Cloneable
   {
   
     /**
  @@ -106,25 +112,27 @@
      * Create an empty, using the given block size.
      *
      * @param blocksize Size of blocks to allocate 
  +   * @param dummy pass zero for right now...
      */
  -  public NodeSet(int blocksize)
  +  public NodeSet(int blocksize, int dummy)
     {
       super(blocksize);
     }
   
  -  /**
  -   * Create a NodeSet, and copy the members of the
  -   * given nodelist into it.
  -   *
  -   * @param nodelist List of Nodes to be made members of the new set.
  -   */
  -  public NodeSet(NodeList nodelist)
  -  {
  -
  -    super();
  -
  -    addNodes(nodelist);
  -  }
  +  // %TBD%
  +//  /**
  +//   * Create a NodeSet, and copy the members of the
  +//   * given nodelist into it.
  +//   *
  +//   * @param nodelist List of Nodes to be made members of the new set.
  +//   */
  +//  public NodeSet(NodeList nodelist)
  +//  {
  +//
  +//    super();
  +//
  +//    addNodes(nodelist);
  +//  }
   
     /**
      * Create a NodeSet, and copy the members of the
  @@ -137,16 +145,16 @@
   
       super();
   
  -    addNodes((NodeIterator) nodelist);
  +    addNodes((DTMIterator) nodelist);
     }
   
     /**
      * Create a NodeSet, and copy the members of the
  -   * given NodeIterator into it.
  +   * given DTMIterator into it.
      *
      * @param ni Iterator which yields Nodes to be made members of the new set.
      */
  -  public NodeSet(NodeIterator ni)
  +  public NodeSet(DTMIterator ni)
     {
   
       super();
  @@ -159,23 +167,57 @@
      *
      * @param node Single node to be added to the new set.
      */
  -  public NodeSet(Node node)
  +  public NodeSet(int node)
     {
   
       super();
   
       addNode(node);
     }
  +  
  +  /**
  +   * Set the environment in which this iterator operates, which should provide:
  +   * a node (the context node... same value as "root" defined below) 
  +   * a pair of non-zero positive integers (the context position and the context size) 
  +   * a set of variable bindings 
  +   * a function library 
  +   * the set of namespace declarations in scope for the expression.
  +   * 
  +   * <p>At this time the exact implementation of this environment is application 
  +   * dependent.  Probably a proper interface will be created fairly soon.</p>
  +   * 
  +   * @param environment The environment object.
  +   */
  +  public void setEnvironment(Object environment)
  +  {
  +    // %TBD%
  +  }
  +
   
     /**
      * @return The root node of the Iterator, as specified when it was created.
      * For non-Iterator NodeSets, this will be null.
      */
  -  public Node getRoot()
  +  public int getRoot()
     {
  -    return null;
  +    // %TBD%?
  +    return DTM.NULL;
  +  }
  +  
  +  /**
  +   * The root node of the <code>DTMIterator</code>, as specified when it
  +   * was created.  Note the root node is not the root node of the 
  +   * document tree, but the context node from where the itteration 
  +   * begins.
  +   *
  +   * @param nodeHandle int Handle of the context node.
  +   */
  +  public void setRoot(int nodeHandle)
  +  {
  +  // %TBD%
     }
   
  +
     /**
      * Clone this NodeSet.
      * At this time, we only expect this to be used with LocPathIterators;
  @@ -206,7 +248,7 @@
      * @throws CloneNotSupportedException if this subclass of NodeSet
      * does not support the clone() operation.
      */
  -  public NodeIterator cloneWithReset() throws CloneNotSupportedException
  +  public DTMIterator cloneWithReset() throws CloneNotSupportedException
     {
   
       NodeSet clone = (NodeSet) clone();
  @@ -227,26 +269,26 @@
     /**
      *  This attribute determines which node types are presented via the
      * iterator. The available set of constants is defined in the
  -   * <code>NodeFilter</code> interface. For NodeSets, the mask has been
  +   * <code>DTMFilter</code> interface. For NodeSets, the mask has been
      * hardcoded to show all nodes except EntityReference nodes, which have
      * no equivalent in the XPath data model.
      *
      * @return integer used as a bit-array, containing flags defined in
  -   * the DOM's NodeFilter class. The value will be 
  +   * the DOM's DTMFilter class. The value will be 
      * <code>SHOW_ALL & ~SHOW_ENTITY_REFERENCE</code>, meaning that
      * only entity references are suppressed.
      */
     public int getWhatToShow()
     {
  -    return NodeFilter.SHOW_ALL & ~NodeFilter.SHOW_ENTITY_REFERENCE;
  +    return DTMFilter.SHOW_ALL & ~DTMFilter.SHOW_ENTITY_REFERENCE;
     }
   
     /**
      * The filter object used to screen nodes. Filters are applied to
  -   * further reduce (and restructure) the NodeIterator's view of the
  +   * further reduce (and restructure) the DTMIterator's view of the
      * document. In our case, we will be using hardcoded filters built
      * into our iterators... but getFilter() is part of the DOM's 
  -   * NodeIterator interface, so we have to support it.
  +   * DTMIterator interface, so we have to support it.
      *
      * @return null, which is slightly misleading. True, there is no
      * user-written filter object, but in fact we are doing some very
  @@ -254,7 +296,7 @@
      * returning a placeholder object just to indicate that this is
      * not going to return all nodes selected by whatToShow.
      */
  -  public NodeFilter getFilter()
  +  public DTMFilter getFilter()
     {
       return null;
     }
  @@ -279,10 +321,38 @@
     {
       return true;
     }
  +  
  +  /**
  +   * Get an instance of a DTM that "owns" a node handle.  Since a node 
  +   * iterator may be passed without a DTMManager, this allows the 
  +   * caller to easily get the DTM using just the iterator.
  +   *
  +   * @param nodeHandle the nodeHandle.
  +   *
  +   * @return a non-null DTM reference.
  +   */
  +  public DTM getDTM(int nodeHandle)
  +  {
  +    // %TBD%
  +    return null;
  +  }
  +  
  +  /**
  +   * Get an instance of the DTMManager.  Since a node 
  +   * iterator may be passed without a DTMManager, this allows the 
  +   * caller to easily get the DTMManager using just the iterator.
  +   *
  +   * @return a non-null DTMManager reference.
  +   */
  +  public DTMManager getDTMManager()
  +  {
  +    // %TBD%
  +    return null;
  +  }
   
     /**
      *  Returns the next node in the set and advances the position of the
  -   * iterator in the set. After a NodeIterator is created, the first call
  +   * iterator in the set. After a DTMIterator is created, the first call
      * to nextNode() returns the first node in the set.
      * @return  The next <code>Node</code> in the set being iterated over, or
      *   <code>null</code> if there are no more members in that set.
  @@ -290,19 +360,19 @@
      *    INVALID_STATE_ERR: Raised if this method is called after the
      *   <code>detach</code> method was invoked.
      */
  -  public Node nextNode() throws DOMException
  +  public int nextNode()
     {
   
       if ((m_next) < this.size())
       {
  -      Node next = this.elementAt(m_next);
  +      int next = this.elementAt(m_next);
   
         m_next++;
   
         return next;
       }
       else
  -      return null;
  +      return DTM.NULL;
     }
   
     /**
  @@ -316,7 +386,7 @@
      * @throws RuntimeException thrown if this NodeSet is not of 
      * a cached type, and hence doesn't know what the previous node was.
      */
  -  public Node previousNode() throws DOMException
  +  public int previousNode()
     {
   
       if (!m_cacheNodes)
  @@ -330,7 +400,7 @@
         return this.elementAt(m_next);
       }
       else
  -      return null;
  +      return DTM.NULL;
     }
   
     /**
  @@ -396,12 +466,12 @@
      *   <code>NodeList</code>, or <code>null</code> if that is not a valid
      *   index.
      */
  -  public Node item(int index)
  +  public int item(int index)
     {
   
       runTo(index);
   
  -    return (Node) this.elementAt(index);
  +    return this.elementAt(index);
     }
   
     /**
  @@ -428,7 +498,7 @@
      * @throws RuntimeException thrown if this NodeSet is not of 
      * a mutable type.
      */
  -  public void addNode(Node n)
  +  public void addNode(int n)
     {
   
       if (!m_mutable)
  @@ -446,7 +516,7 @@
      * @throws RuntimeException thrown if this NodeSet is not of 
      * a mutable type.
      */
  -  public void insertNode(Node n, int pos)
  +  public void insertNode(int n, int pos)
     {
   
       if (!m_mutable)
  @@ -462,7 +532,7 @@
      * @throws RuntimeException thrown if this NodeSet is not of 
      * a mutable type.
      */
  -  public void removeNode(Node n)
  +  public void removeNode(int n)
     {
   
       if (!m_mutable)
  @@ -470,74 +540,76 @@
   
       this.removeElement(n);
     }
  -
  -  /**
  -   * Copy NodeList members into this nodelist, adding in
  -   * document order.  If a node is null, don't add it.
  -   *
  -   * @param nodelist List of nodes which should now be referenced by
  -   * this NodeSet.
  -   * @throws RuntimeException thrown if this NodeSet is not of 
  -   * a mutable type.
  -   */
  -  public void addNodes(NodeList nodelist)
  -  {
   
  -    if (!m_mutable)
  -      throw new RuntimeException("This NodeSet is not mutable!");
  +  // %TBD%
  +//  /**
  +//   * Copy NodeList members into this nodelist, adding in
  +//   * document order.  If a node is null, don't add it.
  +//   *
  +//   * @param nodelist List of nodes which should now be referenced by
  +//   * this NodeSet.
  +//   * @throws RuntimeException thrown if this NodeSet is not of 
  +//   * a mutable type.
  +//   */
  +//  public void addNodes(NodeList nodelist)
  +//  {
  +//
  +//    if (!m_mutable)
  +//      throw new RuntimeException("This NodeSet is not mutable!");
  +//
  +//    if (null != nodelist)  // defensive to fix a bug that Sanjiva reported.
  +//    {
  +//      int nChildren = nodelist.getLength();
  +//
  +//      for (int i = 0; i < nChildren; i++)
  +//      {
  +//        int obj = nodelist.item(i);
  +//
  +//        if (null != obj)
  +//        {
  +//          addElement(obj);
  +//        }
  +//      }
  +//    }
  +//
  +//    // checkDups();
  +//  }
  +
  +  // %TBD%
  +//  /**
  +//   * <p>Copy NodeList members into this nodelist, adding in
  +//   * document order.  Only genuine node references will be copied;
  +//   * nulls appearing in the source NodeSet will
  +//   * not be added to this one. </p>
  +//   * 
  +//   * <p> In case you're wondering why this function is needed: NodeSet
  +//   * implements both DTMIterator and NodeList. If this method isn't
  +//   * provided, Java can't decide which of those to use when addNodes()
  +//   * is invoked. Providing the more-explicit match avoids that
  +//   * ambiguity.)</p>
  +//   *
  +//   * @param ns NodeSet whose members should be merged into this NodeSet.
  +//   * @throws RuntimeException thrown if this NodeSet is not of 
  +//   * a mutable type.
  +//   */
  +//  public void addNodes(NodeSet ns)
  +//  {
  +//
  +//    if (!m_mutable)
  +//      throw new RuntimeException("This NodeSet is not mutable!");
  +//
  +//    addNodes((DTMIterator) ns);
  +//  }
   
  -    if (null != nodelist)  // defensive to fix a bug that Sanjiva reported.
  -    {
  -      int nChildren = nodelist.getLength();
  -
  -      for (int i = 0; i < nChildren; i++)
  -      {
  -        Node obj = nodelist.item(i);
  -
  -        if (null != obj)
  -        {
  -          addElement(obj);
  -        }
  -      }
  -    }
  -
  -    // checkDups();
  -  }
  -
     /**
  -   * <p>Copy NodeList members into this nodelist, adding in
  -   * document order.  Only genuine node references will be copied;
  -   * nulls appearing in the source NodeSet will
  -   * not be added to this one. </p>
  -   * 
  -   * <p> In case you're wondering why this function is needed: NodeSet
  -   * implements both NodeIterator and NodeList. If this method isn't
  -   * provided, Java can't decide which of those to use when addNodes()
  -   * is invoked. Providing the more-explicit match avoids that
  -   * ambiguity.)</p>
  -   *
  -   * @param ns NodeSet whose members should be merged into this NodeSet.
  -   * @throws RuntimeException thrown if this NodeSet is not of 
  -   * a mutable type.
  -   */
  -  public void addNodes(NodeSet ns)
  -  {
  -
  -    if (!m_mutable)
  -      throw new RuntimeException("This NodeSet is not mutable!");
  -
  -    addNodes((NodeIterator) ns);
  -  }
  -
  -  /**
      * Copy NodeList members into this nodelist, adding in
      * document order.  Null references are not added.
      *
  -   * @param iterator NodeIterator which yields the nodes to be added.
  +   * @param iterator DTMIterator which yields the nodes to be added.
      * @throws RuntimeException thrown if this NodeSet is not of 
      * a mutable type.
      */
  -  public void addNodes(NodeIterator iterator)
  +  public void addNodes(DTMIterator iterator)
     {
   
       if (!m_mutable)
  @@ -545,9 +617,9 @@
   
       if (null != iterator)  // defensive to fix a bug that Sanjiva reported.
       {
  -      Node obj;
  +      int obj;
   
  -      while (null != (obj = iterator.nextNode()))
  +      while (DTM.NULL != (obj = iterator.nextNode()))
         {
           addElement(obj);
         }
  @@ -556,120 +628,122 @@
       // checkDups();
     }
   
  -  /**
  -   * Copy NodeList members into this nodelist, adding in
  -   * document order.  If a node is null, don't add it.
  -   *
  -   * @param nodelist List of nodes to be added
  -   * @param support The XPath runtime context.
  -   * @throws RuntimeException thrown if this NodeSet is not of 
  -   * a mutable type.
  -   */
  -  public void addNodesInDocOrder(NodeList nodelist, XPathContext support)
  -  {
  -
  -    if (!m_mutable)
  -      throw new RuntimeException("This NodeSet is not mutable!");
  -
  -    int nChildren = nodelist.getLength();
  -
  -    for (int i = 0; i < nChildren; i++)
  -    {
  -      Node node = nodelist.item(i);
  +  // %TBD%
  +//  /**
  +//   * Copy NodeList members into this nodelist, adding in
  +//   * document order.  If a node is null, don't add it.
  +//   *
  +//   * @param nodelist List of nodes to be added
  +//   * @param support The XPath runtime context.
  +//   * @throws RuntimeException thrown if this NodeSet is not of 
  +//   * a mutable type.
  +//   */
  +//  public void addNodesInDocOrder(NodeList nodelist, XPathContext support)
  +//  {
  +//
  +//    if (!m_mutable)
  +//      throw new RuntimeException("This NodeSet is not mutable!");
  +//
  +//    int nChildren = nodelist.getLength();
  +//
  +//    for (int i = 0; i < nChildren; i++)
  +//    {
  +//      int node = nodelist.item(i);
  +//
  +//      if (null != node)
  +//      {
  +//        addNodeInDocOrder(node, support);
  +//      }
  +//    }
  +//  }
   
  -      if (null != node)
  -      {
  -        addNodeInDocOrder(node, support);
  -      }
  -    }
  -  }
  -
     /**
      * Copy NodeList members into this nodelist, adding in
      * document order.  If a node is null, don't add it.
      *
  -   * @param iterator NodeIterator which yields the nodes to be added.
  +   * @param iterator DTMIterator which yields the nodes to be added.
      * @param support The XPath runtime context.
      * @throws RuntimeException thrown if this NodeSet is not of 
      * a mutable type.
      */
  -  public void addNodesInDocOrder(NodeIterator iterator, XPathContext support)
  +  public void addNodesInDocOrder(DTMIterator iterator, XPathContext support)
     {
   
       if (!m_mutable)
         throw new RuntimeException("This NodeSet is not mutable!");
   
  -    Node node;
  +    int node;
   
  -    while (null != (node = iterator.nextNode()))
  +    while (DTM.NULL != (node = iterator.nextNode()))
       {
         addNodeInDocOrder(node, support);
       }
     }
  -
  -  /**
  -   * Add the node list to this node set in document order.
  -   *
  -   * @param start index.
  -   * @param end index.
  -   * @param testIndex index.
  -   * @param nodelist The nodelist to add.
  -   * @param support The XPath runtime context.
  -   *
  -   * @return false always.
  -   * @throws RuntimeException thrown if this NodeSet is not of 
  -   * a mutable type.
  -   */
  -  private boolean addNodesInDocOrder(int start, int end, int testIndex,
  -                                     NodeList nodelist, XPathContext support)
  -  {
  -
  -    if (!m_mutable)
  -      throw new RuntimeException("This NodeSet is not mutable!");
  -
  -    boolean foundit = false;
  -    int i;
  -    Node node = nodelist.item(testIndex);
  -
  -    for (i = end; i >= start; i--)
  -    {
  -      Node child = (Node) elementAt(i);
  -
  -      if (child == node)
  -      {
  -        i = -2;  // Duplicate, suppress insert
   
  -        break;
  -      }
  -
  -      if (!support.getDOMHelper().isNodeAfter(node, child))
  -      {
  -        insertElementAt(node, i + 1);
  -
  -        testIndex--;
  -
  -        if (testIndex > 0)
  -        {
  -          boolean foundPrev = addNodesInDocOrder(0, i, testIndex, nodelist,
  -                                                 support);
  -
  -          if (!foundPrev)
  -          {
  -            addNodesInDocOrder(i, size() - 1, testIndex, nodelist, support);
  -          }
  -        }
  -
  -        break;
  -      }
  -    }
  -
  -    if (i == -1)
  -    {
  -      insertElementAt(node, 0);
  -    }
  -
  -    return foundit;
  -  }
  +  // %TBD%
  +//  /**
  +//   * Add the node list to this node set in document order.
  +//   *
  +//   * @param start index.
  +//   * @param end index.
  +//   * @param testIndex index.
  +//   * @param nodelist The nodelist to add.
  +//   * @param support The XPath runtime context.
  +//   *
  +//   * @return false always.
  +//   * @throws RuntimeException thrown if this NodeSet is not of 
  +//   * a mutable type.
  +//   */
  +//  private boolean addNodesInDocOrder(int start, int end, int testIndex,
  +//                                     NodeList nodelist, XPathContext support)
  +//  {
  +//
  +//    if (!m_mutable)
  +//      throw new RuntimeException("This NodeSet is not mutable!");
  +//
  +//    boolean foundit = false;
  +//    int i;
  +//    int node = nodelist.item(testIndex);
  +//
  +//    for (i = end; i >= start; i--)
  +//    {
  +//      int child = elementAt(i);
  +//
  +//      if (child == node)
  +//      {
  +//        i = -2;  // Duplicate, suppress insert
  +//
  +//        break;
  +//      }
  +//
  +//      if (!support.getDOMHelper().isNodeAfter(node, child))
  +//      {
  +//        insertElementAt(node, i + 1);
  +//
  +//        testIndex--;
  +//
  +//        if (testIndex > 0)
  +//        {
  +//          boolean foundPrev = addNodesInDocOrder(0, i, testIndex, nodelist,
  +//                                                 support);
  +//
  +//          if (!foundPrev)
  +//          {
  +//            addNodesInDocOrder(i, size() - 1, testIndex, nodelist, support);
  +//          }
  +//        }
  +//
  +//        break;
  +//      }
  +//    }
  +//
  +//    if (i == -1)
  +//    {
  +//      insertElementAt(node, 0);
  +//    }
  +//
  +//    return foundit;
  +//  }
   
     /**
      * Add the node into a vector of nodes where it should occur in
  @@ -684,7 +758,7 @@
      * @throws RuntimeException thrown if this NodeSet is not of 
      * a mutable type.
      */
  -  public int addNodeInDocOrder(Node node, boolean test, XPathContext support)
  +  public int addNodeInDocOrder(int node, boolean test, XPathContext support)
     {
   
       if (!m_mutable)
  @@ -702,7 +776,7 @@
   
         for (i = size - 1; i >= 0; i--)
         {
  -        Node child = (Node) elementAt(i);
  +        int child = elementAt(i);
   
           if (child == node)
           {
  @@ -711,7 +785,8 @@
             break;
           }
   
  -        if (!support.getDOMHelper().isNodeAfter(node, child))
  +        DTM dtm = support.getDTM(node);
  +        if (!dtm.isNodeAfter(node, child))
           {
             break;
           }
  @@ -732,7 +807,7 @@
   
         for (int i = 0; i < insertIndex; i++)
         {
  -        if (this.item(i).equals(node))
  +        if (i == node)
           {
             foundit = true;
   
  @@ -761,7 +836,7 @@
      * @throws RuntimeException thrown if this NodeSet is not of 
      * a mutable type.
      */
  -  public int addNodeInDocOrder(Node node, XPathContext support)
  +  public int addNodeInDocOrder(int node, XPathContext support)
     {
   
       if (!m_mutable)
  @@ -787,7 +862,7 @@
      * @throws RuntimeException thrown if this NodeSet is not of 
      * a mutable type.
      */
  -  public void addElement(Node value)
  +  public void addElement(int value)
     {
   
       if (!m_mutable)
  @@ -807,7 +882,7 @@
      * @throws RuntimeException thrown if this NodeSet is not of 
      * a mutable type.
      */
  -  public void insertElementAt(Node value, int at)
  +  public void insertElementAt(int value, int at)
     {
   
       if (!m_mutable)
  @@ -862,7 +937,7 @@
      * @throws RuntimeException thrown if this NodeSet is not of 
      * a mutable type.
      */
  -  public boolean removeElement(Node s)
  +  public boolean removeElement(int s)
     {
   
       if (!m_mutable)
  @@ -902,7 +977,7 @@
      * @throws RuntimeException thrown if this NodeSet is not of 
      * a mutable type.
      */
  -  public void setElementAt(Node node, int index)
  +  public void setElementAt(int node, int index)
     {
   
       if (!m_mutable)
  @@ -918,7 +993,7 @@
      *
      * @return Node at specified index.
      */
  -  public Node elementAt(int i)
  +  public int elementAt(int i)
     {
   
       runTo(i);
  @@ -933,7 +1008,7 @@
      *
      * @return True if the given node was found.
      */
  -  public boolean contains(Node s)
  +  public boolean contains(int s)
     {
   
       runTo(-1);
  @@ -952,7 +1027,7 @@
      * argument in this vector at position index or later in the
      * vector; returns -1 if the object is not found.
      */
  -  public int indexOf(Node elem, int index)
  +  public int indexOf(int elem, int index)
     {
   
       runTo(-1);
  @@ -970,7 +1045,7 @@
      * argument in this vector at position index or later in the
      * vector; returns -1 if the object is not found.
      */
  -  public int indexOf(Node elem)
  +  public int indexOf(int elem)
     {
   
       runTo(-1);
  @@ -1018,7 +1093,7 @@
      * @throws RuntimeException thrown if this NodeSet is not of 
      * a cached type, and thus doesn't permit indexed access.
      */
  -  public Node getCurrentNode()
  +  public int getCurrentNode()
     {
   
       if (!m_cacheNodes)
  @@ -1026,7 +1101,7 @@
           "This NodeSet can not do indexing or counting functions!");
   
       int saved = m_next;
  -    Node n = elementAt(m_next-1);
  +    int n = elementAt(m_next-1);
       m_next = saved; // HACK: I think this is a bit of a hack.  -sb
       return n;
     }
  
  
  
  1.3.2.1   +3 -3      xml-xalan/java/src/org/apache/xpath/SourceTree.java
  
  Index: SourceTree.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/SourceTree.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- SourceTree.java	2000/12/18 00:04:53	1.3
  +++ SourceTree.java	2001/04/10 18:45:10	1.3.2.1
  @@ -56,7 +56,7 @@
    */
   package org.apache.xpath;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
   
   /**
    * <meta name="usage" content="internal"/>
  @@ -74,7 +74,7 @@
      * {@link org.w3c.dom.Document} node.
      * @param url The URI of the source tree.
      */
  -  public SourceTree(Node root, String url)
  +  public SourceTree(int root, String url)
     {
       m_root = root;
       m_url = url;
  @@ -85,5 +85,5 @@
   
     /** The root of the source tree, which may or may not be a 
      * {@link org.w3c.dom.Document} node.  */
  -  public Node m_root;
  +  public int m_root;
   }
  
  
  
  1.24.2.1  +29 -106   xml-xalan/java/src/org/apache/xpath/SourceTreeManager.java
  
  Index: SourceTreeManager.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/SourceTreeManager.java,v
  retrieving revision 1.24
  retrieving revision 1.24.2.1
  diff -u -r1.24 -r1.24.2.1
  --- SourceTreeManager.java	2001/02/08 04:10:15	1.24
  +++ SourceTreeManager.java	2001/04/10 18:45:11	1.24.2.1
  @@ -64,9 +64,11 @@
   import java.util.StringTokenizer;
   import java.util.Vector;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.Document;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.Document;
   
  +import org.apache.xml.dtm.DTM;
  +
   import javax.xml.transform.URIResolver;
   import javax.xml.transform.TransformerException;
   
  @@ -141,30 +143,19 @@
      *
      * @return The base URI of the owner argument.
      */
  -  public String findURIFromDoc(Document owner)
  +  public String findURIFromDoc(int owner)
     {
  -
  -    Node root = owner.getOwnerDocument();
  -
  -    if (null == root)
  -      root = owner;
  -
  -    String url = null;
       int n = m_sourceTree.size();
   
       for (int i = 0; i < n; i++)
       {
         SourceTree sTree = (SourceTree) m_sourceTree.elementAt(i);
  -
  -      if (root == sTree.m_root)
  -      {
  -        url = sTree.m_url;
   
  -        break;
  -      }
  +      if (owner == sTree.m_root)
  +        return sTree.m_url;
       }
   
  -    return url;
  +    return null;
     }
   
     /**
  @@ -209,14 +200,14 @@
      * @param n The node to cache.
      * @param source The Source object to cache.
      */
  -  public void putDocumentInCache(Node n, Source source)
  +  public void putDocumentInCache(int n, Source source)
     {
   
  -    Node cachedNode = getNode(source);
  +    int cachedNode = getNode(source);
   
  -    if (null != cachedNode)
  +    if (DTM.NULL != cachedNode)
       {
  -      if (!cachedNode.equals(n))
  +      if (!(cachedNode == n))
           throw new RuntimeException(
             "Programmer's Error!  "
             + "putDocumentInCache found reparse of doc: "
  @@ -236,7 +227,7 @@
      *
      * @return The node that is associated with the Source, or null if not found.
      */
  -  public Node getNode(Source source)
  +  public int getNode(Source source)
     {
   
   //    if (source instanceof DOMSource)
  @@ -246,9 +237,8 @@
       String url = source.getSystemId();
   
       if (null == url)
  -      return null;
  +      return DTM.NULL;
   
  -    Node node = null;
       int n = m_sourceTree.size();
       ;
   
  @@ -260,15 +250,11 @@
         // System.out.println("getNode -         url: "+url);
         // System.out.println("getNode - sTree.m_url: "+sTree.m_url);
         if (url.equals(sTree.m_url))
  -      {
  -        node = sTree.m_root;
  -
  -        break;
  -      }
  +        return sTree.m_root;
       }
   
       // System.out.println("getNode - returning: "+node);
  -    return node;
  +    return DTM.NULL;
     }
   
     /**
  @@ -283,8 +269,8 @@
      *
      * @throws TransformerException If the URL can not resolve to a node.
      */
  -  public Node getSourceTree(
  -          String base, String urlString, SourceLocator locator)
  +  public int getSourceTree(
  +          String base, String urlString, SourceLocator locator, XPathContext xctxt)
               throws TransformerException
     {
   
  @@ -294,7 +280,7 @@
         Source source = this.resolveURI(base, urlString, locator);
   
         // System.out.println("getSourceTree - base: "+base+", urlString: "+urlString+", source: "+source.getSystemId());
  -      return getSourceTree(source, locator);
  +      return getSourceTree(source, locator, xctxt);
       }
       catch (IOException ioe)
       {
  @@ -318,18 +304,18 @@
      * @throws TransformerException if the Source argument can't be resolved to 
      *         a node.
      */
  -  public Node getSourceTree(Source source, SourceLocator locator)
  +  public int getSourceTree(Source source, SourceLocator locator, XPathContext xctxt)
             throws TransformerException
     {
   
  -    Node n = getNode(source);
  +    int n = getNode(source);
   
  -    if (null != n)
  +    if (DTM.NULL != n)
         return n;
   
  -    n = getDOMNode(source, locator);
  +    n = parseToNode(source, locator, xctxt);
   
  -    if (null != n)
  +    if (DTM.NULL != n)
         putDocumentInCache(n, source);
   
       return n;
  @@ -346,83 +332,20 @@
      * @throws TransformerException if the source argument can not be resolved 
      *         to a source node.
      */
  -  public Node getDOMNode(Source source, SourceLocator locator)
  +  public int parseToNode(Source source, SourceLocator locator, XPathContext xctxt)
             throws TransformerException
     {
   
  -    if (source instanceof DOMSource)
  -    {
  -      return ((DOMSource) source).getNode();
  -    }
  -
  -    Node doc = null;
  -
       try
  -    {
  -
  -      // System.out.println("reading: "+source.getSystemId());
  -      XMLReader reader = getXMLReader(source, locator);
  -
  -      // TODO: Need to use factory of some kind to create the ContentHandler
  -      // (Also, try using JAXP if need be...)
  -      ContentHandler handler = new SourceTreeHandler();
  -
  -      if (handler instanceof org.apache.xalan.stree.SourceTreeHandler)
  -      {
  -
  -        // temp hack
  -        ((org.apache.xalan.stree.SourceTreeHandler) handler).setUseMultiThreading(
  -          false);
  -      }
  -
  -      reader.setContentHandler(handler);
  -
  -      if (handler instanceof org.xml.sax.DTDHandler)
  -        reader.setDTDHandler((org.xml.sax.DTDHandler) handler);
  -
  -      try
  -      {
  -        if (handler instanceof org.xml.sax.ext.LexicalHandler)
  -          reader.setProperty("http://xml.org/sax/properties/lexical-handler",
  -                             handler);
  -
  -        if (handler instanceof org.xml.sax.ext.DeclHandler)
  -          reader.setProperty(
  -            "http://xml.org/sax/properties/declaration-handler", handler);
  -      }
  -      catch (org.xml.sax.SAXException se){}
  -
  -      try
  -      {
  -        if (handler instanceof org.xml.sax.ext.LexicalHandler)
  -          reader.setProperty("http://xml.org/sax/handlers/LexicalHandler",
  -                             handler);
  -
  -        if (handler instanceof org.xml.sax.ext.DeclHandler)
  -          reader.setProperty("http://xml.org/sax/handlers/DeclHandler",
  -                             handler);
  -      }
  -      catch (org.xml.sax.SAXNotRecognizedException snre){}
  -
  -      InputSource isource = SAXSource.sourceToInputSource(source);
  -
  -      reader.parse(isource);
  -
  -      if (handler instanceof org.apache.xalan.stree.SourceTreeHandler)
  -      {
  -        doc = ((org.apache.xalan.stree.SourceTreeHandler) handler).getRoot();
  -      }
  -    }
  -    catch (IOException ioe)
       {
  -      throw new TransformerException(ioe.getMessage(), locator, ioe);
  +      DTM dtm = xctxt.getDTM(source, false);
  +      return dtm.getDocument();
       }
  -    catch (org.xml.sax.SAXException se)
  +    catch (Exception e)
       {
  -      throw new TransformerException(se.getMessage(), locator, se);
  +      throw new TransformerException(e.getMessage(), locator, e);
       }
   
  -    return doc;
     }
   
     /**
  
  
  
  1.18.2.1  +15 -9     xml-xalan/java/src/org/apache/xpath/XPath.java
  
  Index: XPath.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/XPath.java,v
  retrieving revision 1.18
  retrieving revision 1.18.2.1
  diff -u -r1.18 -r1.18.2.1
  --- XPath.java	2001/03/16 22:17:28	1.18
  +++ XPath.java	2001/04/10 18:45:11	1.18.2.1
  @@ -56,11 +56,14 @@
    */
   package org.apache.xpath;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.Document;
  -import org.w3c.dom.traversal.NodeIterator;
  -import org.w3c.dom.DocumentFragment;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.Document;
  +//import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.DocumentFragment;
   
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
  +
   import java.util.Vector;
   
   import java.io.Serializable;
  @@ -252,7 +255,7 @@
      * @throws javax.xml.transform.TransformerException
      */
     public XObject execute(
  -          XPathContext xctxt, Node contextNode, PrefixResolver namespaceContext)
  +          XPathContext xctxt, int contextNode, PrefixResolver namespaceContext)
               throws javax.xml.transform.TransformerException
     {
   
  @@ -326,7 +329,7 @@
      *
      * @throws javax.xml.transform.TransformerException
      */
  -  public double getMatchScore(XPathContext xctxt, Node context)
  +  public double getMatchScore(XPathContext xctxt, int context)
             throws javax.xml.transform.TransformerException
     {
   
  @@ -338,9 +341,12 @@
         XObject score = m_mainExp.execute(xctxt);
   
         if (DEBUG_MATCHES)
  +      {
  +        DTM dtm = xctxt.getDTM(context);
           System.out.println("score: " + score.num() + " for "
  -                           + context.getNodeName() + " for xpath "
  +                           + dtm.getNodeName(context) + " for xpath "
                              + this.getPatternString());
  +      }
   
         return score.num();
       }
  @@ -380,7 +386,7 @@
      *                              throw an exception.
      */
     public void warn(
  -          XPathContext xctxt, Node sourceNode, int msg, Object[] args)
  +          XPathContext xctxt, int sourceNode, int msg, Object[] args)
               throws javax.xml.transform.TransformerException
     {
   
  @@ -433,7 +439,7 @@
      *                              throw an exception.
      */
     public void error(
  -          XPathContext xctxt, Node sourceNode, int msg, Object[] args)
  +          XPathContext xctxt, int sourceNode, int msg, Object[] args)
               throws javax.xml.transform.TransformerException
     {
   
  
  
  
  1.9.2.1   +9 -3      xml-xalan/java/src/org/apache/xpath/XPathAPI.java
  
  Index: XPathAPI.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/XPathAPI.java,v
  retrieving revision 1.9
  retrieving revision 1.9.2.1
  diff -u -r1.9 -r1.9.2.1
  --- XPathAPI.java	2001/03/11 23:22:59	1.9
  +++ XPathAPI.java	2001/04/10 18:45:11	1.9.2.1
  @@ -159,7 +159,9 @@
       XObject list = eval(contextNode, str, namespaceNode);
   
       // Have the XObject return its result as a NodeSet.
  -    return list.nodeset();
  +    // %TBD% Convert to DOM nodeset
  +//    return list.nodeset();
  +    return null;
     }
   
     /**
  @@ -272,7 +274,9 @@
       XPath xpath = new XPath(str, null, prefixResolver, XPath.SELECT, null);
   
       // Execute the XPath, and have it return the result
  -    return xpath.execute(xpathSupport, contextNode, prefixResolver);
  +    // %TBD% Need to convert contextNode to a DTM node
  +//    return xpath.execute(xpathSupport, contextNode, prefixResolver);
  +    return null;
     }
   
     /**
  @@ -311,6 +315,8 @@
       XPath xpath = new XPath(str, null, prefixResolver, XPath.SELECT, null);
   
       // Execute the XPath, and have it return the result
  -    return xpath.execute(new XPathContext(), contextNode, prefixResolver);
  +    // %TBD% Need to convert contextNode to a DTM node
  +    // return xpath.execute(new XPathContext(), contextNode, prefixResolver);
  +    return null;
     }
   }
  
  
  
  1.20.2.1  +174 -21   xml-xalan/java/src/org/apache/xpath/XPathContext.java
  
  Index: XPathContext.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/XPathContext.java,v
  retrieving revision 1.20
  retrieving revision 1.20.2.1
  diff -u -r1.20 -r1.20.2.1
  --- XPathContext.java	2001/03/28 04:41:07	1.20
  +++ XPathContext.java	2001/04/10 18:45:11	1.20.2.1
  @@ -78,9 +78,9 @@
   import org.apache.xpath.objects.XNodeSet;
   
   // DOM Imports
  -import org.w3c.dom.traversal.NodeIterator;
  -import org.w3c.dom.traversal.TreeWalker;
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.traversal.TreeWalker;
  +//import org.w3c.dom.Node;
   
   import org.apache.xalan.extensions.ExpressionContext;
   
  @@ -103,14 +103,163 @@
   import javax.xml.transform.Source;
   import javax.xml.transform.ErrorListener;
   
  +import org.apache.xml.dtm.DTMManager;
  +import org.apache.xml.dtm.DTMIterator;
  +import org.apache.xml.dtm.DTMFilter;
  +import org.apache.xml.dtm.DTM;
  +
   /**
    * <meta name="usage" content="advanced"/>
    * Default class for the runtime execution context for XPath.
  + * 
  + * <p>This class extends DTMManager but does not directly implement it.</p>
    */
  -public class XPathContext implements ExpressionContext
  +public class XPathContext extends DTMManager // implements ExpressionContext
   {
  +  /**
  +   * Though XPathContext context extends 
  +   * the DTMManager, it really is a proxy for this object, which 
  +   * is the real DTMManager.
  +   */
  +  DTMManager m_dtmManager;
  +  
  +  /**
  +   * Return the DTMManager object.  Though XPathContext context extends 
  +   * the DTMManager, it really is a proxy for the real DTMManager.  If a 
  +   * caller needs to make a lot of calls to the DTMManager, it is faster 
  +   * if it gets the real one from this function.
  +   */
  +   public DTMManager getDTMManager()
  +   {
  +     return m_dtmManager;
  +   }
  +  
  +  /**
  +   * Get an instance of a DTM.  If the unique flag is true, a new instance will
  +   * always be returned.  Otherwise it is up to the DTMManager to return a
  +   * new instance or an instance that it already created and may be being used
  +   * by someone else.
  +   * (I think more parameters will need to be added for error handling, and entity
  +   * resolution).
  +   *
  +   * @param source the specification of the source object.
  +   * @param unique true if the returned DTM must be unique, probably because it
  +   * is going to be mutated.
  +   *
  +   * @return a non-null DTM reference.
  +   */
  +  public DTM getDTM(javax.xml.transform.Source source, boolean unique)
  +  {
  +    return m_dtmManager.getDTM(source, unique);
  +  }
  +                             
  +  /**
  +   * Get an instance of a DTM that "owns" a node handle.
  +   *
  +   * @param nodeHandle the nodeHandle.
  +   *
  +   * @return a non-null DTM reference.
  +   */
  +  public DTM getDTM(int nodeHandle)
  +  {
  +    return m_dtmManager.getDTM(nodeHandle);
  +  }
  +  
  +  /**
  +   * Creates an empty <code>DocumentFragment</code> object. 
  +   * @return A new <code>DocumentFragment handle</code>.
  +   */
  +  public DTM createDocumentFragment()
  +  {
  +    return m_dtmManager.createDocumentFragment();
  +  }
  +  
  +  /**
  +   * Release a DTM either to a lru pool, or completely remove reference.
  +   * DTMs without system IDs are always hard deleted.
  +   * State: experimental.
  +   * 
  +   * @param dtm The DTM to be released.
  +   * @param shouldHardDelete True if the DTM should be removed no matter what.
  +   * @return true if the DTM was removed, false if it was put back in a lru pool.
  +   */
  +  public boolean release(DTM dtm, boolean shouldHardDelete)
  +  {
  +    return m_dtmManager.release(dtm, shouldHardDelete);
  +  }
  +
  +  /**
  +   * Create a new <code>DTMIterator</code> based on an XPath
  +   * <a href="http://www.w3.org/TR/xpath#NT-LocationPath>LocationPath</a> or
  +   * a <a href="http://www.w3.org/TR/xpath#NT-UnionExpr">UnionExpr</a>.
  +   *
  +   * @param xpathCompiler ??? Somehow we need to pass in a subpart of the
  +   * expression.  I hate to do this with strings, since the larger expression
  +   * has already been parsed.
  +   *
  +   * @param pos The position in the expression.
  +   * @return The newly created <code>DTMIterator</code>.
  +   */
  +  public DTMIterator createDTMIterator(Object xpathCompiler, int pos)
  +  {
  +    return m_dtmManager.createDTMIterator(xpathCompiler, pos);
  +  }
  +
  +  /**
  +   * Create a new <code>DTMIterator</code> based on an XPath
  +   * <a href="http://www.w3.org/TR/xpath#NT-LocationPath>LocationPath</a> or
  +   * a <a href="http://www.w3.org/TR/xpath#NT-UnionExpr">UnionExpr</a>.
  +   *
  +   * @param xpathString Must be a valid string expressing a
  +   * <a href="http://www.w3.org/TR/xpath#NT-LocationPath>LocationPath</a> or
  +   * a <a href="http://www.w3.org/TR/xpath#NT-UnionExpr">UnionExpr</a>.
  +   *
  +   * @param presolver An object that can resolve prefixes to namespace URLs.
  +   *
  +   * @return The newly created <code>DTMIterator</code>.
  +   */
  +  public DTMIterator createDTMIterator(String xpathString,
  +          PrefixResolver presolver)
  +  {
  +    return m_dtmManager.createDTMIterator(xpathString, presolver);
  +  }
   
     /**
  +   * Create a new <code>DTMIterator</code> based only on a whatToShow and
  +   * a DTMFilter.  The traversal semantics are defined as the descendant
  +   * access.
  +   *
  +   * @param whatToShow This flag specifies which node types may appear in
  +   *   the logical view of the tree presented by the iterator. See the
  +   *   description of <code>NodeFilter</code> for the set of possible
  +   *   <code>SHOW_</code> values.These flags can be combined using
  +   *   <code>OR</code>.
  +   * @param filter The <code>NodeFilter</code> to be used with this
  +   *   <code>TreeWalker</code>, or <code>null</code> to indicate no filter.
  +   * @param entityReferenceExpansion The value of this flag determines
  +   *   whether entity reference nodes are expanded.
  +   *
  +   * @return The newly created <code>NodeIterator</code>.
  +   */
  +  public DTMIterator createDTMIterator(int whatToShow,
  +          DTMFilter filter, boolean entityReferenceExpansion)
  +  {
  +    return m_dtmManager.createDTMIterator(whatToShow, filter, entityReferenceExpansion);
  +  }
  +  
  +  /**
  +   * Create a new <code>DTMIterator</code> that holds exactly one node.
  +   *
  +   * @param node The node handle that the DTMIterator will iterate to.
  +   *
  +   * @return The newly created <code>DTMIterator</code>.
  +   */
  +  public DTMIterator createDTMIterator(int node)
  +  {
  +    return m_dtmManager.createDTMIterator(node);
  +  }
  +
  +  /**
      * Create an XPathContext instance.
      */
     public XPathContext()
  @@ -450,7 +599,7 @@
     //==========================================================
     // SECTION: Execution context state tracking
     //==========================================================
  -
  +  
     /**
      * The current context node list.
      */
  @@ -465,11 +614,11 @@
      * @return  the <a href="http://www.w3.org/TR/xslt#dt-current-node-list">current node list</a>,
      * also refered to here as a <term>context node list</term>.
      */
  -  public final ContextNodeList getContextNodeList()
  +  public final DTMIterator getContextNodeList()
     {
   
       if (m_contextNodeLists.size() > 0)
  -      return (ContextNodeList) m_contextNodeLists.peek();
  +      return (DTMIterator) m_contextNodeLists.peek();
       else
         return null;
     }
  @@ -481,7 +630,7 @@
      * @param nl the <a href="http://www.w3.org/TR/xslt#dt-current-node-list">current node list</a>,
      * also refered to here as a <term>context node list</term>.
      */
  -  public final void pushContextNodeList(ContextNodeList nl)
  +  public final void pushContextNodeList(DTMIterator nl)
     {
       m_contextNodeLists.push(nl);
     }
  @@ -514,18 +663,18 @@
      *
      * @return the <a href="http://www.w3.org/TR/xslt#dt-current-node">current node</a>.
      */
  -  public final Node getCurrentNode()
  +  public final int getCurrentNode()
     {
       return m_currentNodes.peepOrNull();
     }
  -
  +  
     /**
      * Set the current context node and expression node.
      *
      * @param cn the <a href="http://www.w3.org/TR/xslt#dt-current-node">current node</a>.
      * @param en the sub-expression context node.
      */
  -  public final void pushCurrentNodeAndExpression(Node cn, Node en)
  +  public final void pushCurrentNodeAndExpression(int cn, int en)
     {
       m_currentNodes.push(cn);
       m_currentExpressionNodes.push(en);
  @@ -545,7 +694,7 @@
      *
      * @param n the <a href="http://www.w3.org/TR/xslt#dt-current-node">current node</a>.
      */
  -  public final void pushCurrentNode(Node n)
  +  public final void pushCurrentNode(int n)
     {
       m_currentNodes.push(n);
     }
  @@ -569,7 +718,7 @@
      *
      * @return The current sub-expression node.
      */
  -  public final Node getCurrentExpressionNode()
  +  public final int getCurrentExpressionNode()
     {
       return m_currentExpressionNodes.peepOrNull();
     }
  @@ -579,7 +728,7 @@
      *
      * @param n The sub-expression node to be current.
      */
  -  public final void pushCurrentExpressionNode(Node n)
  +  public final void pushCurrentExpressionNode(int n)
     {
       m_currentExpressionNodes.push(n);
     }
  @@ -666,7 +815,7 @@
      * Get the current context node.
      * @return The current context node.
      */
  -  public final Node getContextNode()
  +  public final int getContextNode()
     {
       return this.getCurrentNode();
     }
  @@ -676,12 +825,12 @@
      * @return An iterator for the current context list, as
      * defined in XSLT.
      */
  -  public final NodeIterator getContextNodes()
  +  public final DTMIterator getContextNodes()
     {
   
       try
       {
  -      ContextNodeList cnl = getContextNodeList();
  +      DTMIterator cnl = getContextNodeList();
   
         if (null != cnl)
           return cnl.cloneWithReset();
  @@ -699,9 +848,11 @@
      * @param n Node to be converted to a number.  May be null.
      * @return value of n as a number.
      */
  -  public final double toNumber(Node n)
  +  public final double toNumber(int n)
     {
  -    return XNodeSet.getNumberFromNode(n);
  +    // %TBD%
  +//    return XNodeSet.getNumberFromNode(n);
  +    return 0;
     }
   
     /**
  @@ -709,8 +860,10 @@
      * @param n Node to be converted to a string.  May be null.
      * @return value of n as a string, or an empty string if n is null.
      */
  -  public final String toString(Node n)
  +  public final String toString(int n)
     {
  -    return XNodeSet.getStringFromNode(n);
  +    // %TBD%
  +//    return XNodeSet.getStringFromNode(n);
  +    return null;
     }
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.4.2.1   +9 -8      xml-xalan/java/src/org/apache/xpath/axes/AncestorOrSelfWalker.java
  
  Index: AncestorOrSelfWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/AncestorOrSelfWalker.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- AncestorOrSelfWalker.java	2000/12/17 17:40:00	1.4
  +++ AncestorOrSelfWalker.java	2001/04/10 18:45:13	1.4.2.1
  @@ -61,9 +61,10 @@
   import org.apache.xpath.axes.LocPathIterator;
   import org.apache.xpath.XPath;
   import org.apache.xpath.XPathContext;
  -import org.apache.xpath.DOMHelper;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.utils.IntStack;
   
   /**
    * Walker for the 'ancestor-or-self' axes.
  @@ -87,21 +88,21 @@
      *
      * @param n The context node.
      */
  -  protected void pushAncestors(Node n)
  +  protected void pushAncestors(int n)
     {
   
  -    m_ancestors = new Stack();
  +    m_ancestors = new IntStack();
   
       m_ancestors.push(n);
   
  -    DOMHelper dh = m_lpi.getDOMHelper();
  +    DTM dtm = getDTM(n);
   
  -    while (null != (n = dh.getParentOfNode(n)))
  +    while (DTM.NULL != (n = dtm.getParent(n)))
       {
         m_ancestors.push(n);
       }
   
  -    m_nextLevelAmount = m_ancestors.isEmpty() ? 0 : 1;
  +    m_nextLevelAmount = m_ancestors.empty() ? 0 : 1;
       m_ancestorsPos = m_ancestors.size() - 1;
     }
   
  @@ -112,6 +113,6 @@
      */
     protected int getLevelMax()
     {
  -    return m_lpi.getDOMHelper().getLevel(m_root);
  +    return getDTM(m_root).getLevel(m_root);
     }
   }
  
  
  
  1.5.2.1   +16 -14    xml-xalan/java/src/org/apache/xpath/axes/AncestorWalker.java
  
  Index: AncestorWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/AncestorWalker.java,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- AncestorWalker.java	2001/01/02 03:47:14	1.5
  +++ AncestorWalker.java	2001/04/10 18:45:14	1.5.2.1
  @@ -61,9 +61,10 @@
   import org.apache.xpath.axes.LocPathIterator;
   import org.apache.xpath.XPath;
   import org.apache.xpath.XPathContext;
  -import org.apache.xpath.DOMHelper;
  +import org.apache.xml.utils.IntStack;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
  +import org.apache.xml.dtm.DTM;
   
   /**
    * Walker for the 'ancestor' axes.
  @@ -103,19 +104,19 @@
      *
      * @param n
      */
  -  protected void pushAncestors(Node n)
  +  protected void pushAncestors(int n)
     {
   
  -    m_ancestors = new Stack();
  +    m_ancestors = new IntStack();
   
  -    DOMHelper dh = m_lpi.getDOMHelper();
  +    DTM dtm = getDTM(n);
   
  -    while (null != (n = dh.getParentOfNode(n)))
  +    while (DTM.NULL != (n = dtm.getParent(n)))
       {
         m_ancestors.push(n);
       }
   
  -    m_nextLevelAmount = m_ancestors.isEmpty() ? 0 : 1;
  +    m_nextLevelAmount = m_ancestors.empty() ? 0 : 1;
       m_ancestorsPos = m_ancestors.size() - 1;
     }
   
  @@ -124,7 +125,7 @@
      *
      * @param root The context node of this step.
      */
  -  public void setRoot(Node root)
  +  public void setRoot(int root)
     {
       pushAncestors(root);
       super.setRoot(root);
  @@ -138,10 +139,11 @@
      * @return  The new node, or <code>null</code> if the current node has no
      *   visible children in the TreeWalker's logical view.
      */
  -  public Node firstChild()
  +  public int firstChild()
     {
   
  -    Node next = (m_ancestorsPos < 0) ? null : (Node) m_ancestors.elementAt(m_ancestorsPos--);
  +    int next = (m_ancestorsPos < 0) ? DTM.NULL 
  +                              : (int) m_ancestors.elementAt(m_ancestorsPos--);
   
       m_nextLevelAmount = (m_ancestorsPos < 0) ? 0 : 1;
   
  @@ -151,7 +153,7 @@
     /** Stack of ancestors.  We have to do this instead of 
      *  just using getParent on the fly, because we have to walk the ancestors 
      *  in document order. */
  -  transient protected Stack m_ancestors;
  +  transient protected IntStack m_ancestors;
     
     /** The position within the stack.
      *  @serial */
  @@ -165,9 +167,9 @@
     protected int getLevelMax()
     {
   
  -    DOMHelper dh = m_lpi.getDOMHelper();
  -    Node p = dh.getParentOfNode(m_root);
  +    DTM dtm = getDTM(m_root);
  +    int p = dtm.getParent(m_root);
   
  -    return (null == p) ? 1 : dh.getLevel(p);
  +    return (DTM.NULL == p) ? 1 : dtm.getLevel(p);
     }
   }
  
  
  
  1.7.2.1   +16 -200   xml-xalan/java/src/org/apache/xpath/axes/AttributeIterator.java
  
  Index: AttributeIterator.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/AttributeIterator.java,v
  retrieving revision 1.7
  retrieving revision 1.7.2.1
  diff -u -r1.7 -r1.7.2.1
  --- AttributeIterator.java	2001/01/02 03:47:14	1.7
  +++ AttributeIterator.java	2001/04/10 18:45:14	1.7.2.1
  @@ -63,11 +63,14 @@
   import org.apache.xpath.patterns.NodeTest;
   import org.apache.xpath.objects.XObject;
   
  -import org.w3c.dom.traversal.NodeIterator;
  -import org.w3c.dom.Node;
  -import org.w3c.dom.NamedNodeMap;
  -import org.w3c.dom.DOMException;
  -import org.w3c.dom.traversal.NodeFilter;
  +//import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.NamedNodeMap;
  +//import org.w3c.dom.DOMException;
  +//import org.w3c.dom.traversal.NodeFilter;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
  +import org.apache.xml.dtm.DTMFilter;
   
   /**
    * <meta name="usage" content="advanced"/>
  @@ -75,7 +78,7 @@
    * attribute axes patterns.
    * @see org.apache.xpath.axes.WalkerFactory#newLocPathIterator
    */
  -public class AttributeIterator extends LocPathIterator
  +public class AttributeIterator extends ChildTestIterator
   {
   
     /**
  @@ -90,205 +93,18 @@
     public AttributeIterator(Compiler compiler, int opPos, int analysis)
             throws javax.xml.transform.TransformerException
     {
  -
  -    super(compiler, opPos, analysis, false);
  -
  -    int firstStepPos = compiler.getFirstChildPos(opPos);
  -    int whatToShow = compiler.getWhatToShow(firstStepPos);
  -
  -    if ((0 == (whatToShow
  -               & (NodeFilter.SHOW_ATTRIBUTE | NodeFilter.SHOW_ELEMENT
  -                  | NodeFilter.SHOW_PROCESSING_INSTRUCTION))) || (whatToShow == NodeFilter.SHOW_ALL))
  -      initNodeTest(whatToShow);
  -    else
  -    {
  -      initNodeTest(whatToShow, compiler.getStepNS(firstStepPos),
  -                              compiler.getStepLocalName(firstStepPos));
  -    }
  -    initPredicateInfo(compiler, firstStepPos);
  +    super(compiler, opPos, analysis);
     }
     
  -  /**
  -   * Get a cloned LocPathIterator that holds the same 
  -   * position as this iterator.
  -   *
  -   * @return A clone of this iterator that holds the same node position.
  -   *
  -   * @throws CloneNotSupportedException
  -   */
  -  public Object clone() throws CloneNotSupportedException
  -  {
  -    LocPathIterator clone = (LocPathIterator) super.clone();
  -    return clone;
  -  }
  -
  -  /**
  -   *  Get a cloned Iterator that is reset to the beginning
  -   *  of the query.
  -   * 
  -   *  @return A cloned NodeIterator set of the start of the query.
  -   * 
  -   *  @throws CloneNotSupportedException
  -   */
  -  public NodeIterator cloneWithReset() throws CloneNotSupportedException
  -  {
  -
  -    AttributeIterator clone = (AttributeIterator) super.cloneWithReset();
  -
  -    clone.m_attrListPos = 0;
  -    
  -    clone.resetProximityPositions();
  -
  -    return clone;
  -  }
  -
     /**
  -   * Initialize the attribute list.
  +   * Get the next node via getFirstAttribute && getNextAttribute.
      */
  -  private void initAttrList()
  +  protected int getNextNode()
     {
  -
  -    if (m_context.getNodeType() == Node.ELEMENT_NODE)
  -    {
  -      m_attrListPos = 0;
  -      m_attributeList = m_context.getAttributes();
  -
  -      if (null != m_attributeList)
  -      {
  -        m_nAttrs = m_attributeList.getLength();
  -      }
  -      else
  -        m_nAttrs = 0;
  -
  -      if (0 == m_nAttrs)
  -      {
  -        m_foundLast = true;
  -      }
  -    }
  +    m_lastFetched = (DTM.NULL == m_lastFetched)
  +                     ? m_cdtm.getFirstAttribute(m_context)
  +                     : m_cdtm.getNextAttribute(m_lastFetched);
  +    return m_lastFetched;
     }
   
  -  /**
  -   *  Returns the next node in the set and advances the position of the
  -   * iterator in the set. After a NodeIterator is created, the first call
  -   * to nextNode() returns the first node in the set.
  -   *
  -   * @return  The next <code>Node</code> in the set being iterated over, or
  -   *   <code>null</code> if there are no more members in that set.
  -   *
  -   * @throws DOMException
  -   *    INVALID_STATE_ERR: Raised if this method is called after the
  -   *   <code>detach</code> method was invoked.
  -   */
  -  public Node nextNode() throws DOMException
  -  {
  -    // If the cache is on, and the node has already been found, then 
  -    // just return from the list.
  -    if ((null != m_cachedNodes)
  -            && (m_cachedNodes.getCurrentPos() < m_cachedNodes.size()))
  -    {
  -      Node next = m_cachedNodes.nextNode();
  -
  -      this.setCurrentPos(m_cachedNodes.getCurrentPos());
  -
  -      return next;
  -    }
  -
  -    if (m_foundLast)
  -      return null;
  -
  -    if (null == m_attributeList)
  -    {
  -      initAttrList();
  -      resetProximityPositions();
  -    }
  -
  -    org.apache.xpath.VariableStack vars;
  -    int savedStart;
  -    if (-1 != m_varStackPos)
  -    {
  -      vars = m_execContext.getVarStack();
  -
  -      // These three statements need to be combined into one operation.
  -      savedStart = vars.getSearchStart();
  -
  -      vars.setSearchStart(m_varStackPos);
  -      vars.pushContextPosition(m_varStackContext);
  -    }
  -    else
  -    {
  -      // Yuck.  Just to shut up the compiler!
  -      vars = null;
  -      savedStart = 0;
  -    }
  -    
  -    try
  -    {
  -      Node next;
  -  
  -      do
  -      {
  -        m_lastFetched = next =
  -          (null == m_attributeList || m_attrListPos >= m_nAttrs)
  -          ? null : m_attributeList.item(m_attrListPos++);
  -  
  -        if (null != next)
  -        {
  -          if(NodeFilter.FILTER_ACCEPT == acceptNode(next))
  -            break;
  -          else
  -            continue;
  -        }
  -        else
  -          break;
  -      }
  -      while (next != null);
  -  
  -      if (null != next)
  -      {
  -        if (null != m_cachedNodes)
  -          m_cachedNodes.addElement(m_lastFetched);
  -  
  -        m_next++;
  -  
  -        return next;
  -      }
  -      else
  -      {
  -        m_foundLast = true;
  -  
  -        return null;
  -      }
  -    }
  -    finally
  -    {
  -      if (-1 != m_varStackPos)
  -      {
  -        // These two statements need to be combined into one operation.
  -        vars.setSearchStart(savedStart);
  -        vars.popContextPosition();
  -      }
  -    }
  -  }
  -  
  -  /**
  -   * Get the index of the last node that can be itterated to.
  -   *
  -   * @param xctxt XPath runtime context.
  -   *
  -   * @return the index of the last node that can be itterated to.
  -   */
  -  public int getLastPos(XPathContext xctxt)
  -  {
  -    return m_nAttrs;
  -  }
  -
  -
  -  /** The attribute list for the given context. */
  -  transient private NamedNodeMap m_attributeList;
  -
  -  /** The position within the attribute list. */
  -  transient private int m_attrListPos = 0;
  -
  -  /** The number of attributes within the list. */
  -  transient private int m_nAttrs = 0;
   }
  
  
  
  1.7.2.1   +25 -45    xml-xalan/java/src/org/apache/xpath/axes/AttributeWalker.java
  
  Index: AttributeWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/AttributeWalker.java,v
  retrieving revision 1.7
  retrieving revision 1.7.2.1
  diff -u -r1.7 -r1.7.2.1
  --- AttributeWalker.java	2001/01/02 03:47:14	1.7
  +++ AttributeWalker.java	2001/04/10 18:45:14	1.7.2.1
  @@ -60,8 +60,9 @@
   import org.apache.xpath.XPath;
   import org.apache.xpath.XPathContext;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.NamedNodeMap;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.NamedNodeMap;
  +import org.apache.xml.dtm.DTM;
   
   /**
    * Walker for the 'attribute' axes.
  @@ -85,42 +86,40 @@
      *
      * @param root The context node of this step.
      */
  -  public void setRoot(Node root)
  +  public void setRoot(int root)
     {
   
  -    m_attrListPos = -1;
  -    m_attributeList = null;
  -    m_nAttrs = -2;
  -    m_nextLevelAmount = 1;
  +    // System.out.println("ChildWalker.setRoot");
  +    m_nextLevelAmount = (getDTM(root).getFirstAttribute(root) != DTM.NULL) ? 1 : 0;
   
  +    // System.out.println("Back from calling hasChildNodes");
       super.setRoot(root);
  +
  +    // System.out.println("Exiting ChildWalker.setRoot");
     }
   
     /**
  -   * Moves the <code>TreeWalker</code> to the first visible child of the
  +   *  Moves the <code>TreeWalker</code> to the first visible child of the
      * current node, and returns the new node. If the current node has no
      * visible children, returns <code>null</code> , and retains the current
      * node.
      * @return  The new node, or <code>null</code> if the current node has no
      *   visible children in the TreeWalker's logical view.
      */
  -  public Node firstChild()
  +  public int firstChild()
     {
  +
  +    // System.out.println("ChildWalker.firstChild");
  +    m_nextLevelAmount = 0;
   
  -    if (m_currentNode.getNodeType() == Node.ELEMENT_NODE)
  +    if (m_root == m_currentNode)
       {
  -      m_attrListPos = -1;
  -      m_attributeList = m_currentNode.getAttributes();
   
  -      if (null != m_attributeList)
  -        m_nAttrs = m_attributeList.getLength();
  -      else
  -        m_nAttrs = -2;
  +      // System.out.println("ChildWalker - Calling getFirstChild");
  +      return setCurrentIfNotNull(getDTM(m_root).getFirstAttribute(m_currentNode));
       }
  -
  -    m_nextLevelAmount = 0;
  -
  -    return nextSibling();
  +    else
  +      return DTM.NULL;
     }
   
     /**
  @@ -130,34 +129,15 @@
      * @return  The new node, or <code>null</code> if the current node has no
      *   next sibling in the TreeWalker's logical view.
      */
  -  public Node nextSibling()
  +  public int nextSibling()
     {
   
  -    // Attributes don't really have siblings, but we'll fake it.
  -    if (null != m_attributeList)
  -    {
  -      m_attrListPos++;
  -
  -      if (m_attrListPos < m_nAttrs)
  -      {
  -        return setCurrentIfNotNull(m_attributeList.item(m_attrListPos));
  -      }
  -      else
  -        m_attributeList = null;
  -    }
  -
  -    return null;
  +    if (m_root != m_currentNode)
  +      return setCurrentIfNotNull(getDTM(m_root).getNextAttribute(m_currentNode));
  +    else
  +      return DTM.NULL;
     }
   
  -  /** The attribute list for the given context.    */
  -  transient NamedNodeMap m_attributeList;
  -
  -  /** The position within the attribute list.  */
  -  transient int m_attrListPos;
  -
  -  /** The number of attributes within the list.  */
  -  transient int m_nAttrs;
  -
     /**
      * Tell what's the maximum level this axes can descend to.
      *
  @@ -165,6 +145,6 @@
      */
     protected int getLevelMax()
     {
  -    return m_lpi.getDOMHelper().getLevel(m_root);
  +    return getDTM(m_root).getLevel(m_root);
     }
   }
  
  
  
  1.7.2.1   +33 -55    xml-xalan/java/src/org/apache/xpath/axes/AttributeWalkerOneStep.java
  
  Index: AttributeWalkerOneStep.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/AttributeWalkerOneStep.java,v
  retrieving revision 1.7
  retrieving revision 1.7.2.1
  diff -u -r1.7 -r1.7.2.1
  --- AttributeWalkerOneStep.java	2001/01/02 03:47:14	1.7
  +++ AttributeWalkerOneStep.java	2001/04/10 18:45:14	1.7.2.1
  @@ -56,9 +56,11 @@
    */
   package org.apache.xpath.axes;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.NamedNodeMap;
  -import org.w3c.dom.traversal.NodeFilter;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.NamedNodeMap;
  +//import org.w3c.dom.traversal.NodeFilter;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
   
   import org.apache.xpath.patterns.NodeTestFilter;
   
  @@ -70,87 +72,63 @@
   public class AttributeWalkerOneStep extends AxesWalker
   {
   
  -  /** The attribute list from the context node.  */
  -  transient NamedNodeMap m_attributeList;
  -
  -  /** The current index into m_attributeList.  -1 to start. */
  -  transient int m_attrListPos;
  -
  -  /** The number of attributes in m_attributeList, or -2 if no attributes. */
  -  transient int m_nAttrs;
  -
     /**
  -   *  The root node of the TreeWalker.
  +   * Construct an AxesWalker using a LocPathIterator.
      *
  -   * @param root The context node of the node step.
  +   * @param locPathIterator The location path iterator that 'owns' this walker.
      */
  -  public void setRoot(Node root)
  +  public AttributeWalkerOneStep(LocPathIterator locPathIterator)
     {
  -
  -    super.setRoot(root);
  -
  -    if (root.getNodeType() == Node.ELEMENT_NODE)
  -    {
  -      m_attrListPos = -1;
  -      m_attributeList = m_currentNode.getAttributes();
  -
  -      if (null != m_attributeList)
  -        m_nAttrs = m_attributeList.getLength();
  -      else
  -        m_nAttrs = -2;
  -    }
  +    super(locPathIterator);
     }
   
     /**
  -   * Construct an AxesWalker using a LocPathIterator.
  +   * Tell what's the maximum level this axes can descend to.
      *
  -   * @param locPathIterator The location path iterator that 'owns' this walker.
  +   * @return An estimation of the maximum level this axes can descend to.
      */
  -  public AttributeWalkerOneStep(LocPathIterator locPathIterator)
  +  protected int getLevelMax()
     {
  -    super(locPathIterator);
  +    return getDTM(m_root).getLevel(m_root);
     }
   
     /**
      * Get the next node in document order on the axes.
      *
  -   * @return The next node in the itteration, or null.
  +   * @return The next node in the walk, or null.
      */
  -  public Node nextNode()
  +  public int nextNode()
     {
  -
  -    if (m_isFresh)
  -      m_isFresh = false;
  -
  -    Node current = this.getCurrentNode();
   
  -    if (current.isSupported(FEATURE_NODETESTFILTER, "1.0"))
  -      ((NodeTestFilter) current).setNodeTest(this);
  +    int next;
   
  -    Node next = null;
  +    if (m_root == m_currentNode)
  +    {
  +      next = getDTM(m_currentNode).getFirstAttribute(m_currentNode);
  +      m_isFresh = false;
  +    }
  +    else
  +      next = getDTM(m_currentNode).getNextAttribute(m_currentNode);
   
  -    while (null != m_attributeList)
  +    if (DTM.NULL != next)
       {
  -      m_attrListPos++;
  +      m_currentNode = next;
   
  -      if (m_attrListPos < m_nAttrs)
  +      while (acceptNode(next) != DTMIterator.FILTER_ACCEPT)
         {
  -        next = m_attributeList.item(m_attrListPos);
  +        next = getDTM(next).getNextAttribute(next);
   
  -        if (null != next)
  +        if (DTM.NULL != next)
             m_currentNode = next;
  +        else
  +        {
  +          this.m_isDone = true;
   
  -        if (acceptNode(next) == NodeFilter.FILTER_ACCEPT)
             break;
  +        }
         }
  -      else
  -      {
  -        next = null;
  -        m_attributeList = null;
  -      }
       }
  -
  -    if (null == next)
  +    else
         this.m_isDone = true;
   
       return next;
  
  
  
  1.18.2.1  +155 -114  xml-xalan/java/src/org/apache/xpath/axes/AxesWalker.java
  
  Index: AxesWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/AxesWalker.java,v
  retrieving revision 1.18
  retrieving revision 1.18.2.1
  diff -u -r1.18 -r1.18.2.1
  --- AxesWalker.java	2001/01/02 03:47:14	1.18
  +++ AxesWalker.java	2001/04/10 18:45:15	1.18.2.1
  @@ -74,18 +74,21 @@
   import org.apache.xpath.XPath;
   
   // DOM2 imports
  -import org.w3c.dom.Node;
  -import org.w3c.dom.NamedNodeMap;
  -import org.w3c.dom.traversal.TreeWalker;
  -import org.w3c.dom.traversal.NodeFilter;
  -import org.w3c.dom.DOMException;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.NamedNodeMap;
  +//import org.w3c.dom.traversal.TreeWalker;
  +//import org.w3c.dom.traversal.NodeFilter;
  +//import org.w3c.dom.DOMException;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
  +import org.apache.xml.dtm.DTMFilter;
   
   /**
    * Serves as common interface for axes Walkers, and stores common
    * state variables.
    */
   public abstract class AxesWalker extends PredicatedNodeTest
  -        implements Cloneable, TreeWalker, NodeFilter
  +        implements Cloneable , DTMFilter
   {
     
     /**
  @@ -271,14 +274,14 @@
      * @return true if n is a parent of the step context, or the step context 
      *              itself.
      */
  -  boolean isAncestorOfRootContext(Node n)
  +  boolean isAncestorOfRootContext(int n)
     {
   
  -    Node parent = m_root;
  +    int parent = m_root;
   
  -    while (null != (parent = parent.getParentNode()))
  +    while (DTM.NULL != (parent = getDTM(parent).getParent(parent)))
       {
  -      if (parent.equals(n))
  +      if (parent == n)
           return true;
       }
   
  @@ -288,12 +291,12 @@
     //=============== TreeWalker Implementation ===============
   
     /**
  -   * The root node of the TreeWalker, as specified in setRoot(Node root).
  +   * The root node of the TreeWalker, as specified in setRoot(int root).
      * Note that this may actually be below the current node.
      *
      * @return The context node of the step.
      */
  -  public Node getRoot()
  +  public int getRoot()
     {
       return m_root;
     }
  @@ -304,16 +307,17 @@
      *
      * @param root The context node of this step.
      */
  -  public void setRoot(Node root)
  +  public void setRoot(int root)
     {
  -
  +    // %OPT% Get this directly from the lpi.
  +    m_dtm = m_lpi.getXPathContext().getDTM(root);
       m_isFresh = true;
       m_isDone = false;
       m_root = root;
       m_currentNode = root;
  -    m_prevReturned = null;
  +    m_prevReturned = DTM.NULL;
   
  -    if (null == root)
  +    if (DTM.NULL == root)
       {
         throw new RuntimeException(
           "\n !!!! Error! Setting the root of a walker to null!!!");
  @@ -335,11 +339,8 @@
      *
      * @return The node at which the TreeWalker is currently positioned, only null 
      * if setRoot has not yet been called.
  -   * @throws DOMException
  -   *    NOT_SUPPORTED_ERR: Raised if the specified <code>currentNode</code>
  -   *   is<code>null</code> .
      */
  -  public final Node getCurrentNode()
  +  public final int getCurrentNode()
     {
       return m_currentNode;
     }
  @@ -348,10 +349,8 @@
      * Set the current node.
      *
      * @param currentNode The current itteration node, should not be null.
  -   *
  -   * @throws DOMException
      */
  -  public void setCurrentNode(Node currentNode) throws DOMException
  +  public void setCurrentNode(int currentNode)
     {
       m_currentNode = currentNode;
     }
  @@ -361,13 +360,11 @@
      *
      * @param currentNode The current node or null.
      * @return The node passed in.
  -   *
  -   * @throws DOMException
      */
  -  protected Node setCurrentIfNotNull(Node currentNode) throws DOMException
  +  protected int setCurrentIfNotNull(int currentNode)
     {
   
  -    if (null != currentNode)
  +    if (DTM.NULL != currentNode)
         m_currentNode = currentNode;
   
       return currentNode;
  @@ -378,7 +375,7 @@
      *
      * @return This AxesWalker.
      */
  -  public NodeFilter getFilter()
  +  public DTMFilter getFilter()
     {
       return this;
     }
  @@ -410,9 +407,9 @@
      * @return  The new parent node, or null if the current node has no parent
      *   in the TreeWalker's logical view.
      */
  -  public Node parentNode()
  +  public int parentNode()
     {
  -    return null;
  +    return DTM.NULL;
     }
   
     /**
  @@ -423,9 +420,9 @@
      * @return  The new node, or <code>null</code> if the current node has no
      *   visible children in the TreeWalker's logical view.
      */
  -  public Node firstChild()
  +  public int firstChild()
     {
  -    return null;
  +    return DTM.NULL;
     }
   
     /**
  @@ -435,9 +432,9 @@
      * @return  The new node, or <code>null</code> if the current node has no
      *   next sibling in the TreeWalker's logical view.
      */
  -  public Node nextSibling()
  +  public int nextSibling()
     {
  -    return null;
  +    return DTM.NULL;
     }
   
     /**
  @@ -448,7 +445,7 @@
      * @return  The new node, or <code>null</code> if the current node has no
      *   children  in the TreeWalker's logical view.
      */
  -  public Node lastChild()
  +  public int lastChild()
     {
   
       // We may need to support this...
  @@ -463,7 +460,7 @@
      * @return  The new node, or <code>null</code> if the current node has no
      *   previous sibling in the TreeWalker's logical view.
      */
  -  public Node previousSibling()
  +  public int previousSibling()
     {
       throw new RuntimeException("previousSibling not supported!");
     }
  @@ -477,7 +474,7 @@
      * @return  The new node, or <code>null</code> if the current node has no
      *   previous node in the TreeWalker's logical view.
      */
  -  public Node previousNode()
  +  public int previousNode()
     {
       throw new RuntimeException("previousNode not supported!");
     }
  @@ -551,21 +548,21 @@
   
       try
       {
  -      rootName = (null == m_root)
  +      rootName = (DTM.NULL == m_root)
                    ? "null"
  -                 : m_root.getNodeName() + "{"
  -                   + ((org.apache.xalan.stree.Child) m_root).getUid() + "}";
  +                 : getDTM(m_root).getNodeName(m_root) + "{"
  +                   + m_root + "}";
         currentNodeName =
  -        (null == m_root)
  +        (DTM.NULL == m_root)
           ? "null"
  -        : m_currentNode.getNodeName() + "{"
  -          + ((org.apache.xalan.stree.Child) m_currentNode).getUid() + "}";
  +        : getDTM(m_currentNode).getNodeName(m_currentNode) + "{"
  +          + m_currentNode + "}";
       }
       catch (ClassCastException cce)
       {
  -      rootName = (null == m_root) ? "null" : m_root.getNodeName();
  -      currentNodeName = (null == m_root)
  -                        ? "null" : m_currentNode.getNodeName();
  +      rootName = (DTM.NULL == m_root) ? "null" : getDTM(m_root).getNodeName(m_root);
  +      currentNodeName = (DTM.NULL == m_root)
  +                        ? "null" : getDTM(m_currentNode).getNodeName(m_currentNode);
       }
   
       return clName + "[" + rootName + "][" + currentNodeName + "]";
  @@ -579,10 +576,10 @@
      *
      * @return The argument.
      */
  -  private Node returnNextNode(Node n)
  +  private int returnNextNode(int n)
     {
   
  -    if (DEBUG_LOCATED && (null != n))
  +    if (DEBUG_LOCATED && (DTM.NULL != n))
       {
         printDebug("RETURN --->" + nodeToString(n));
       }
  @@ -606,13 +603,11 @@
       {
         System.out.print("\n");
   
  -      if (null != m_currentNode)
  +      if (DTM.NULL != m_currentNode)
         {
           try
           {
  -          org.apache.xalan.stree.Child n =
  -            ((org.apache.xalan.stree.Child) m_currentNode);
  -          int depth = n.getLevel();
  +          int depth = getDTM(m_currentNode).getLevel(m_currentNode);
   
             for (int i = 0; i < depth; i++)
             {
  @@ -632,7 +627,7 @@
      * @param node The top of the subtree.
      * @param indent The amount to begin the indenting at.
      */
  -  private void dumpAll(Node node, int indent)
  +  private void dumpAll(int node, int indent)
     {
   
       for (int i = 0; i < indent; i++)
  @@ -642,9 +637,9 @@
   
       System.out.print(nodeToString(node));
   
  -    if (Node.TEXT_NODE == node.getNodeType())
  +    if (DTM.TEXT_NODE == getDTM(node).getNodeType(node))
       {
  -      String value = node.getNodeValue();
  +      String value = getDTM(node).getStringValue(node);
   
         if (null != value)
         {
  @@ -654,40 +649,32 @@
   
       System.out.println("");
   
  -    NamedNodeMap map = node.getAttributes();
  -
  -    if (null != map)
  +    DTM dtm = getDTM(node);
  +    for (int attr = dtm.getFirstAttribute(node); attr != DTM.NULL; 
  +         attr = dtm.getNextAttribute(attr))
       {
  -      int n = map.getLength();
  -
  -      for (int i = 0; i < n; i++)
  +      for (int k = 0; k < indent; k++)
         {
  -        for (int k = 0; k < indent; k++)
  -        {
  -          System.out.print(" ");
  -        }
  -
  -        System.out.print("attr -->");
  -        System.out.print(nodeToString(map.item(i)));
  +        System.out.print(" ");
  +      }
   
  -        String value = map.item(i).getNodeValue();
  +      System.out.print("attr -->");
  +      System.out.print(nodeToString(attr));
   
  -        if (null != value)
  -        {
  -          System.out.print("+= -->" + value.trim());
  -        }
  +      String value = dtm.getStringValue(attr);
   
  -        System.out.println("");
  +      if (null != value)
  +      {
  +        System.out.print("+= -->" + value.trim());
         }
  -    }
   
  -    Node child = node.getFirstChild();
  +      System.out.println("");
  +    }
   
  -    while (null != child)
  +    for (int child = dtm.getFirstChild(node); DTM.NULL != child; 
  +         child = dtm.getNextSibling(child))
       {
         dumpAll(child, indent + 1);
  -
  -      child = child.getNextSibling();
       }
     }
   
  @@ -715,13 +702,11 @@
       {
         System.out.print("\n============================\n");
   
  -      if (null != m_currentNode)
  +      if (DTM.NULL != m_currentNode)
         {
           try
           {
  -          org.apache.xalan.stree.Child n =
  -            ((org.apache.xalan.stree.Child) m_currentNode);
  -          int depth = n.getLevel();
  +          int depth = getDTM(m_currentNode).getLevel(m_currentNode);
   
             for (int i = 0; i < depth; i++)
             {
  @@ -793,15 +778,14 @@
      */
     protected boolean checkOKToTraverse(AxesWalker prevStepWalker,
                                         AxesWalker testWalker,
  -                                      Node currentTestNode,
  +                                      int currentTestNode,
                                         int nextLevelAmount)
     {
   
  -    DOMHelper dh = m_lpi.getDOMHelper();
  -    int level = dh.getLevel(currentTestNode);
  +    int level = getDTM(currentTestNode).getLevel(currentTestNode);
   
       // Is this always the context node of the test walker?
  -    Node prevNode = prevStepWalker.m_currentNode;
  +    int prevNode = prevStepWalker.m_currentNode;
   
       // Can the previous walker go past the one being tested?
       if (DEBUG_WAITING)
  @@ -815,14 +799,14 @@
   
         // Is (prevStepWalker.m_currentNode > the currentTestNode)?
         // (Sorry about the reverse logic).
  -      boolean isNodeAfter = !dh.isNodeAfter(prevNode, currentTestNode);
  +      boolean isNodeAfter = !getDTM(prevNode).isNodeAfter(prevNode, currentTestNode);
   
         if (DEBUG_WAITING)
           printDebug("[isNodeAfter:" + isNodeAfter + "?]");
   
         if (isNodeAfter)
         {
  -        int prevStepLevel = dh.getLevel(prevNode);
  +        int prevStepLevel = getDTM(prevNode).getLevel(prevNode);
   
           // If the previous step walker is below us in the tree, 
           // then we have to wait until it pops back up to our level, 
  @@ -865,7 +849,7 @@
     {
   
       // printDebug("checkWaiting: "+walker.toString()+", "+nodeToString(walker.m_currentNode));
  -    if ((null != walker) && (null == walker.m_currentNode))
  +    if ((null != walker) && (DTM.NULL == walker.m_currentNode))
         return walker;
   
       int nWaiting = m_lpi.getWaitingCount();
  @@ -934,7 +918,7 @@
           first = ws;
         else
         {
  -        if (!dh.isNodeAfter(ws.m_currentNode, first.m_currentNode))
  +        if (!getDTM(ws.m_currentNode).isNodeAfter(ws.m_currentNode, first.m_currentNode))
             first = ws;
         }
       }
  @@ -1040,33 +1024,34 @@
      *
      * @return the next node in document order on the axes, or null.
      */
  -  protected Node getNextNode()
  +  protected int getNextNode()
     {
   
       if (m_isFresh)
         m_isFresh = false;
   
  -    Node current = this.getCurrentNode();
  +    int current = this.getCurrentNode();
   
  -    if (current.isSupported(FEATURE_NODETESTFILTER, "1.0"))
  -      ((NodeTestFilter) current).setNodeTest(this);
  +    // %TBD%
  +//    if (current.isSupported(FEATURE_NODETESTFILTER, "1.0"))
  +//      ((NodeTestFilter) current).setNodeTest(this);
   
  -    Node next = this.firstChild();
  +    int next = this.firstChild();
   
  -    while (null == next)
  +    while (DTM.NULL == next)
       {
         next = this.nextSibling();
   
  -      if (null == next)
  +      if (DTM.NULL == next)
         {
  -        Node p = this.parentNode();
  +        int p = this.parentNode();
   
  -        if (null == p)
  +        if (DTM.NULL == p)
             break;
         }
       }
   
  -    if (null == next)
  +    if (DTM.NULL == next)
         this.m_isDone = true;
   
       return next;
  @@ -1081,7 +1066,7 @@
      * @return  The new node, or <code>null</code> if the current node has no
      *   next node  in the TreeWalker's logical view.
      */
  -  public Node nextNode()
  +  public int nextNode()
     {
   
       if (DEBUG_TRAVERSAL &&!m_didDumpAll)
  @@ -1092,7 +1077,7 @@
         // dumpAll(doc, 0);
       }
   
  -    Node nextNode = null;
  +    int nextNode = DTM.NULL;
       AxesWalker walker = m_lpi.getLastUsedWalker();
   
       // DOMHelper dh = m_lpi.getDOMHelper();
  @@ -1140,7 +1125,7 @@
             walker.printDebug(walker.toString() + "--NEXT->"
                               + nodeToString(nextNode) + ")");
   
  -        if (null == nextNode)
  +        if (DTM.NULL == nextNode)
           {
   
             // AxesWalker prev = walker; ?? -sb
  @@ -1162,7 +1147,7 @@
           }
           else
           {
  -          if (walker.acceptNode(nextNode) != NodeFilter.FILTER_ACCEPT)
  +          if (walker.acceptNode(nextNode) != DTMIterator.FILTER_ACCEPT)
             {
               if (DEBUG_TRAVERSAL)
                 printDebugAdd("[FILTER_SKIP]");
  @@ -1182,7 +1167,7 @@
               if (DEBUG_TRAVERSAL)
                 printDebug("May be returning: " + nodeToString(nextNode));
   
  -            if (DEBUG_TRAVERSAL && (null != m_prevReturned))
  +            if (DEBUG_TRAVERSAL && (DTM.NULL != m_prevReturned))
                 printDebugAdd(", m_prevReturned: "
                               + nodeToString(m_prevReturned));
   
  @@ -1237,9 +1222,9 @@
       // the next node in the nodeset because it's coming from a 
       // different document. 
       while (
  -      (null != nextNode) && (null != m_prevReturned)
  -      && nextNode.getOwnerDocument() == m_prevReturned.getOwnerDocument()
  -      && m_lpi.getDOMHelper().isNodeAfter(nextNode, m_prevReturned));
  +      (DTM.NULL != nextNode) && (DTM.NULL != m_prevReturned)
  +      && getDTM(nextNode).getOwnerDocument(nextNode) == getDTM(m_prevReturned).getOwnerDocument(m_prevReturned)
  +      && getDTM(nextNode).isNodeAfter(nextNode, m_prevReturned));
   
       m_prevReturned = nextNode;
   
  @@ -1285,9 +1270,9 @@
       {
         lpi.setLastUsedWalker(walker);
   
  -      Node next;
  +      int next;
   
  -      while (null != (next = walker.nextNode()))
  +      while (DTM.NULL != (next = walker.nextNode()))
         {
           pos++;
         }
  @@ -1312,6 +1297,41 @@
     {
       return false;
     }
  +  
  +  /**
  +   * Test whether a specified node is visible in the logical view of a
  +   * <code>DTMIterator</code>. Normally, this function
  +   * will be called by the implementation of <code>DTMIterator</code>;
  +   * it is not normally called directly from
  +   * user code.
  +   *
  +   * @param nodeHandle int Handle of the node.
  +   * @param whatToShow one of SHOW_XXX values.
  +   * @return one of FILTER_ACCEPT, FILTER_REJECT, or FILTER_SKIP.
  +   */
  +  public short acceptNode(int nodeHandle, int whatToShow)
  +  {
  +    return DTMIterator.FILTER_ACCEPT;  // %TBD%
  +  }
  +
  +  /**
  +   * Test whether a specified node is visible in the logical view of a
  +   * <code>DTMIterator</code>. Normally, this function
  +   * will be called by the implementation of <code>DTMIterator</code>;
  +   * it is not normally called directly from
  +   * user code.
  +   *
  +   * @param nodeHandle int Handle of the node.
  +   * @param whatToShow one of SHOW_XXX values.
  +   * @param expandedName a value defining the exanded name as defined in
  +   *                     the DTM interface.  Wild cards will be defined
  +   *                     by 0xFFFF in the high word and/or in the low word.
  +   * @return one of FILTER_ACCEPT, FILTER_REJECT, or FILTER_SKIP.
  +   */
  +  public short acceptNode(int nodeHandle, int whatToShow, int expandedName)
  +  {
  +    return DTMIterator.FILTER_ACCEPT;  // %TBD%
  +  }
   
     //============= Static Data =============
   
  @@ -1345,19 +1365,40 @@
     public static final String FEATURE_NODETESTFILTER = "NodeTestFilter";
     
     //============= State Data =============
  +  
  +  /**
  +   * The DTM for the root.  This can not be used, or must be changed, 
  +   * for the filter walker, or any walker that can have nodes 
  +   * from multiple documents.
  +   * Never, ever, access this value without going through getDTM(int node).
  +   */
  +  private DTM m_dtm;
  +  
  +  // %TBD% Doc 
  +  public void setDefaultDTM(DTM dtm)
  +  {
  +    m_dtm = dtm;
  +  }
  +  
  +  // %TBD% Doc 
  +  public DTM getDTM(int node)
  +  {
  +    //
  +    return m_lpi.getXPathContext().getDTM(node);
  +  }
   
     /**
      *  The root node of the TreeWalker, as specified when it was created.
      */
  -  transient Node m_root;
  +  transient int m_root;
   
     /**
      *  The node at which the TreeWalker is currently positioned.
      */
  -  transient Node m_currentNode;
  +  transient int m_currentNode;
     
     /** The node last returned from nextNode(). */
  -  transient Node m_prevReturned;
  +  transient int m_prevReturned;
   
     /**
      * The arg length of the XPath step. Does not change after the constructor.
  
  
  
  1.6.2.1   +13 -66    xml-xalan/java/src/org/apache/xpath/axes/ChildIterator.java
  
  Index: ChildIterator.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/ChildIterator.java,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- ChildIterator.java	2001/01/04 08:06:24	1.6
  +++ ChildIterator.java	2001/04/10 18:45:15	1.6.2.1
  @@ -63,8 +63,9 @@
   import org.apache.xpath.WhitespaceStrippingElementMatcher;
   import org.apache.xml.utils.PrefixResolver;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.DOMException;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.DOMException;
  +import org.apache.xml.dtm.DTM;
   
   /**
    * <meta name="usage" content="advanced"/>
  @@ -99,12 +100,8 @@
      *
      * @return  The next <code>Node</code> in the set being iterated over, or
      *   <code>null</code> if there are no more members in that set.
  -   *
  -   * @throws DOMException
  -   *    INVALID_STATE_ERR: Raised if this method is called after the
  -   *   <code>detach</code> method was invoked.
      */
  -  public Node nextNode() throws DOMException
  +  public int nextNode()
     {
   
       // If the cache is on, and the node has already been found, then 
  @@ -112,7 +109,7 @@
       if ((null != m_cachedNodes)
               && (m_cachedNodes.getCurrentPos() < m_cachedNodes.size()))
       {
  -      Node next = m_cachedNodes.nextNode();
  +      int next = m_cachedNodes.nextNode();
   
         this.setCurrentPos(m_cachedNodes.getCurrentPos());
   
  @@ -120,67 +117,17 @@
       }
   
       if (m_foundLast)
  -      return null;
  -
  -    Node next;
  +      return DTM.NULL;
   
  -    while (true)
  -    {
  -      m_lastFetched = next = (null == m_lastFetched)
  -                             ? m_context.getFirstChild()
  -                             : m_lastFetched.getNextSibling();
  -
  -      // Yuck!  Blech!  -sb
  -      if (null != next)
  -      {
  -        int nt = next.getNodeType();
  -        if(Node.DOCUMENT_TYPE_NODE == nt) // bug fix, position14, d2d, xerces DOM
  -          continue;
  -        else if ((Node.TEXT_NODE == nt)
  -                &&!next.isSupported(SUPPORTS_PRE_STRIPPING, null))
  -        {
  -          Node parent = next.getParentNode();
  -
  -          if (null != parent && Node.ELEMENT_NODE == parent.getNodeType())
  -          {
  -            String data = next.getNodeValue();
  -
  -            if (org.apache.xml.utils.XMLCharacterRecognizer.isWhiteSpace(
  -                    data))
  -            {
  -
  -              // Ugly trick for now.
  -              PrefixResolver resolver =
  -                getXPathContext().getNamespaceContext();
  -
  -              if (resolver instanceof WhitespaceStrippingElementMatcher)
  -              {
  -                WhitespaceStrippingElementMatcher wsem =
  -                  (WhitespaceStrippingElementMatcher) resolver;
  -
  -                try
  -                {
  -                  if (wsem.shouldStripWhiteSpace(
  -                          getXPathContext(), (org.w3c.dom.Element) parent))
  -                  {
  -                    continue;
  -                  }
  -                }
  -                catch (javax.xml.transform.TransformerException te)
  -                {
  -                  throw new org.apache.xml.utils.WrappedRuntimeException(te);
  -                }
  -              }
  -            }
  -          }
  -        }
  -      }
  +    int next;
  +    DTM dtm = m_cdtm;
   
  -      break;
  -    }
  +    m_lastFetched = next = (DTM.NULL == m_lastFetched)
  +                           ? dtm.getFirstChild(m_context)
  +                           : dtm.getNextSibling(m_lastFetched);
   
       // m_lastFetched = next;
  -    if (null != next)
  +    if (DTM.NULL != next)
       {
         if (null != m_cachedNodes)
           m_cachedNodes.addElement(m_lastFetched);
  @@ -193,7 +140,7 @@
       {
         m_foundLast = true;
   
  -      return null;
  +      return DTM.NULL;
       }
     }
   }
  
  
  
  1.8.2.1   +34 -24    xml-xalan/java/src/org/apache/xpath/axes/ChildTestIterator.java
  
  Index: ChildTestIterator.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/ChildTestIterator.java,v
  retrieving revision 1.8
  retrieving revision 1.8.2.1
  diff -u -r1.8 -r1.8.2.1
  --- ChildTestIterator.java	2001/01/02 03:47:14	1.8
  +++ ChildTestIterator.java	2001/04/10 18:45:15	1.8.2.1
  @@ -62,10 +62,13 @@
   import org.apache.xpath.patterns.NodeTest;
   import org.apache.xpath.objects.XObject;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.DOMException;
  -import org.w3c.dom.traversal.NodeFilter;
  -import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.DOMException;
  +//import org.w3c.dom.traversal.NodeFilter;
  +//import org.w3c.dom.traversal.NodeIterator;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
  +import org.apache.xml.dtm.DTMFilter;
   
   /**
    * <meta name="usage" content="advanced"/>
  @@ -95,8 +98,9 @@
       int whatToShow = compiler.getWhatToShow(firstStepPos);
   
       if ((0 == (whatToShow
  -               & (NodeFilter.SHOW_ATTRIBUTE | NodeFilter.SHOW_ELEMENT
  -                  | NodeFilter.SHOW_PROCESSING_INSTRUCTION))) || (whatToShow == NodeFilter.SHOW_ALL))
  +               & (DTMFilter.SHOW_ATTRIBUTE | DTMFilter.SHOW_ELEMENT
  +                  | DTMFilter.SHOW_PROCESSING_INSTRUCTION))) 
  +                  || (whatToShow == DTMFilter.SHOW_ALL))
         initNodeTest(whatToShow);
       else
       {
  @@ -114,7 +118,7 @@
      * 
      *  @throws CloneNotSupportedException
      */
  -  public NodeIterator cloneWithReset() throws CloneNotSupportedException
  +  public DTMIterator cloneWithReset() throws CloneNotSupportedException
     {
   
       ChildTestIterator clone = (ChildTestIterator) super.cloneWithReset();
  @@ -123,6 +127,18 @@
   
       return clone;
     }
  +  
  +  /**
  +   * Get the next node via getNextXXX.  Bottlenecked for derived class override.
  +   * @return The next node on the axis, or DTM.NULL.
  +   */
  +  protected int getNextNode()
  +  {
  +    m_lastFetched = (DTM.NULL == m_lastFetched)
  +                     ? m_cdtm.getFirstChild(m_context)
  +                     : m_cdtm.getNextSibling(m_lastFetched);
  +    return m_lastFetched;
  +  }
   
     /**
      *  Returns the next node in the set and advances the position of the
  @@ -131,12 +147,8 @@
      *
      * @return  The next <code>Node</code> in the set being iterated over, or
      *   <code>null</code> if there are no more members in that set.
  -   *
  -   * @throws DOMException
  -   *    INVALID_STATE_ERR: Raised if this method is called after the
  -   *   <code>detach</code> method was invoked.
      */
  -  public Node nextNode() throws DOMException
  +  public int nextNode()
     {
   
       // If the cache is on, and the node has already been found, then 
  @@ -144,7 +156,7 @@
       if ((null != m_cachedNodes)
               && (m_cachedNodes.getCurrentPos() < m_cachedNodes.size()))
       {
  -      Node next = m_cachedNodes.nextNode();
  +      int next = m_cachedNodes.nextNode();
   
         this.setCurrentPos(m_cachedNodes.getCurrentPos());
   
  @@ -152,14 +164,14 @@
       }
   
       if (m_foundLast)
  -      return null;
  +      return DTM.NULL;
         
  -    if(null == m_lastFetched)
  +    if(DTM.NULL == m_lastFetched)
       {
         resetProximityPositions();
       }
   
  -    Node next;
  +    int next;
       
       org.apache.xpath.VariableStack vars;
       int savedStart;
  @@ -184,13 +196,11 @@
       {
         do
         {
  -        m_lastFetched = next = (null == m_lastFetched)
  -                               ? m_context.getFirstChild()
  -                               : m_lastFetched.getNextSibling();
  +        next = getNextNode();
     
  -        if (null != next)
  +        if (DTM.NULL != next)
           {
  -          if(NodeFilter.FILTER_ACCEPT == acceptNode(next))
  +          if(DTMIterator.FILTER_ACCEPT == acceptNode(next))
               break;
             else
               continue;
  @@ -198,9 +208,9 @@
           else
             break;
         }
  -      while (next != null);
  +      while (next != DTM.NULL);
     
  -      if (null != next)
  +      if (DTM.NULL != next)
         {
           if (null != m_cachedNodes)
             m_cachedNodes.addElement(m_lastFetched);
  @@ -213,7 +223,7 @@
         {
           m_foundLast = true;
     
  -        return null;
  +        return DTM.NULL;
         }
       }
       finally
  
  
  
  1.4.2.1   +11 -12    xml-xalan/java/src/org/apache/xpath/axes/ChildWalker.java
  
  Index: ChildWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/ChildWalker.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- ChildWalker.java	2000/12/17 17:40:00	1.4
  +++ ChildWalker.java	2001/04/10 18:45:15	1.4.2.1
  @@ -60,7 +60,8 @@
   import org.apache.xpath.XPath;
   import org.apache.xpath.XPathContext;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
  +import org.apache.xml.dtm.DTM;
   
   /**
    * Walker for the 'child' axes.
  @@ -84,11 +85,11 @@
      *
      * @param root The context node of this step.
      */
  -  public void setRoot(Node root)
  +  public void setRoot(int root)
     {
   
       // System.out.println("ChildWalker.setRoot");
  -    m_nextLevelAmount = root.hasChildNodes() ? 1 : 0;
  +    m_nextLevelAmount = getDTM(root).hasChildNodes(root) ? 1 : 0;
   
       // System.out.println("Back from calling hasChildNodes");
       super.setRoot(root);
  @@ -104,7 +105,7 @@
      * @return  The new node, or <code>null</code> if the current node has no
      *   visible children in the TreeWalker's logical view.
      */
  -  public Node firstChild()
  +  public int firstChild()
     {
   
       // System.out.println("ChildWalker.firstChild");
  @@ -112,12 +113,11 @@
   
       if (m_root == m_currentNode)
       {
  -
         // System.out.println("ChildWalker - Calling getFirstChild");
  -      return setCurrentIfNotNull(this.m_root.getFirstChild());
  +      return setCurrentIfNotNull(getDTM(m_root).getFirstChild(m_root));
       }
       else
  -      return null;
  +      return DTM.NULL;
     }
   
     /**
  @@ -127,13 +127,12 @@
      * @return  The new node, or <code>null</code> if the current node has no
      *   next sibling in the TreeWalker's logical view.
      */
  -  public Node nextSibling()
  +  public int nextSibling()
     {
  -
       if (m_root != m_currentNode)
  -      return setCurrentIfNotNull(m_currentNode.getNextSibling());
  +      return setCurrentIfNotNull(getDTM(m_currentNode).getNextSibling(m_currentNode));
       else
  -      return null;
  +      return DTM.NULL;
     }
   
     /**
  @@ -143,6 +142,6 @@
      */
     protected int getLevelMax()
     {
  -    return m_lpi.getDOMHelper().getLevel(m_root);
  +    return getDTM(m_root).getLevel(m_root);
     }
   }
  
  
  
  1.6.2.1   +26 -21    xml-xalan/java/src/org/apache/xpath/axes/ChildWalkerMultiStep.java
  
  Index: ChildWalkerMultiStep.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/ChildWalkerMultiStep.java,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- ChildWalkerMultiStep.java	2001/02/07 02:06:35	1.6
  +++ ChildWalkerMultiStep.java	2001/04/10 18:45:15	1.6.2.1
  @@ -56,8 +56,11 @@
    */
   package org.apache.xpath.axes;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.traversal.NodeFilter;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.traversal.NodeFilter;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMFilter;
  +import org.apache.xml.dtm.DTMIterator;
   
   import org.apache.xpath.patterns.NodeTestFilter;
   
  @@ -85,39 +88,41 @@
      *
      * @return the next valid child node.
      */
  -  protected Node getNextNode()
  +  protected int getNextNode()
     {
       if (m_isFresh)
         m_isFresh = false;
   
  -    Node current = this.getCurrentNode();
  +    int current = this.getCurrentNode();
       
  -    if (current.isSupported(FEATURE_NODETESTFILTER, "1.0"))
  -      ((NodeTestFilter) current).setNodeTest(this);
  +    // %TBD%
  +//    if (current.isSupported(FEATURE_NODETESTFILTER, "1.0"))
  +//      ((NodeTestFilter) current).setNodeTest(this);
  +    DTM dtm = getDTM(m_root);
  +
  +    int next = (m_root == m_currentNode)
  +                ? dtm.getFirstChild(m_currentNode)
  +                : dtm.getNextSibling(m_currentNode);
   
  -    Node next = (m_root == m_currentNode)
  -                ? m_currentNode.getFirstChild()
  -                : m_currentNode.getNextSibling();
  -
  -    if (null != next)
  +    if (DTM.NULL != next)
       {
         m_currentNode = next;
   
  -      while (acceptNode(next) != NodeFilter.FILTER_ACCEPT)
  +      while (acceptNode(next) != DTMIterator.FILTER_ACCEPT)
         {
  -        next = next.getNextSibling();
  +        next = dtm.getNextSibling(next);
   
  -        if (null == next)
  +        if (DTM.NULL == next)
             break;
           else
             m_currentNode = next;
         }
         
  -      if(null == next)
  +      if(DTM.NULL == next)
           m_currentNode = current; // don't advance the current node.
       }          
   
  -    if (null == next)
  +    if (DTM.NULL == next)
         this.m_isDone = true;
   
       return next;
  @@ -133,7 +138,7 @@
      * @return  The new node, or <code>null</code> if the current node has no
      *   next node  in the TreeWalker's logical view.
      */
  -  public Node nextNode()
  +  public int nextNode()
     {
   
       AxesWalker walker = m_lpi.getLastUsedWalker();
  @@ -141,7 +146,7 @@
   
       while (null != walker)
       {
  -      Node next;
  +      int next;
         if(fast)
         {
           next = walker.getNextNode();
  @@ -150,11 +155,11 @@
         {
           next = walker.nextNode();
           // In this case, nextNode finished the walk, so we just return.
  -        if(null != next)
  +        if(DTM.NULL != next)
             return next;
         }
   
  -      if (null != next)
  +      if (DTM.NULL != next)
         {
           if (null != walker.m_nextWalker)
           {
  @@ -177,7 +182,7 @@
         }
       }
   
  -    return null;
  +    return DTM.NULL;
     }
     
     /**
  
  
  
  1.3.2.1   +14 -11    xml-xalan/java/src/org/apache/xpath/axes/ChildWalkerOneStep.java
  
  Index: ChildWalkerOneStep.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/ChildWalkerOneStep.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- ChildWalkerOneStep.java	2000/12/17 17:40:00	1.3
  +++ ChildWalkerOneStep.java	2001/04/10 18:45:15	1.3.2.1
  @@ -56,8 +56,11 @@
    */
   package org.apache.xpath.axes;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.traversal.NodeFilter;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.traversal.NodeFilter;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMFilter;
  +import org.apache.xml.dtm.DTMIterator;
   
   import org.apache.xpath.patterns.NodeTestFilter;
   
  @@ -85,7 +88,7 @@
      */
     protected int getLevelMax()
     {
  -    return m_lpi.getDOMHelper().getLevel(m_root);
  +    return getDTM(m_root).getLevel(m_root);
     }
   
     /**
  @@ -93,28 +96,28 @@
      *
      * @return The next node in the walk, or null.
      */
  -  public Node nextNode()
  +  public int nextNode()
     {
   
  -    Node next;
  +    int next;
   
       if (m_root == m_currentNode)
       {
  -      next = m_currentNode.getFirstChild();
  +      next = getDTM(m_currentNode).getFirstChild(m_currentNode);
         m_isFresh = false;
       }
       else
  -      next = m_currentNode.getNextSibling();
  +      next = getDTM(m_currentNode).getNextSibling(m_currentNode);
   
  -    if (null != next)
  +    if (DTM.NULL != next)
       {
         m_currentNode = next;
   
  -      while (acceptNode(next) != NodeFilter.FILTER_ACCEPT)
  +      while (acceptNode(next) != DTMIterator.FILTER_ACCEPT)
         {
  -        next = next.getNextSibling();
  +        next = getDTM(next).getNextSibling(next);
   
  -        if (null != next)
  +        if (DTM.NULL != next)
             m_currentNode = next;
           else
           {
  
  
  
  1.8.2.1   +35 -31    xml-xalan/java/src/org/apache/xpath/axes/DescendantIterator.java
  
  Index: DescendantIterator.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/DescendantIterator.java,v
  retrieving revision 1.8
  retrieving revision 1.8.2.1
  diff -u -r1.8 -r1.8.2.1
  --- DescendantIterator.java	2001/02/01 04:25:41	1.8
  +++ DescendantIterator.java	2001/04/10 18:45:16	1.8.2.1
  @@ -63,11 +63,14 @@
   import org.apache.xpath.objects.XObject;
   import org.apache.xpath.compiler.OpCodes;
   
  -import org.w3c.dom.traversal.NodeIterator;
  -import org.w3c.dom.Node;
  -import org.w3c.dom.NamedNodeMap;
  -import org.w3c.dom.DOMException;
  -import org.w3c.dom.traversal.NodeFilter;
  +//import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.NamedNodeMap;
  +//import org.w3c.dom.DOMException;
  +//import org.w3c.dom.traversal.NodeFilter;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
  +import org.apache.xml.dtm.DTMFilter;
   
   /**
    * <meta name="usage" content="advanced"/>
  @@ -116,8 +119,9 @@
       int whatToShow = compiler.getWhatToShow(firstStepPos);
   
       if ((0 == (whatToShow
  -               & (NodeFilter.SHOW_ATTRIBUTE | NodeFilter.SHOW_ELEMENT
  -                  | NodeFilter.SHOW_PROCESSING_INSTRUCTION))) || (whatToShow == NodeFilter.SHOW_ALL))
  +               & (DTMFilter.SHOW_ATTRIBUTE | DTMFilter.SHOW_ELEMENT
  +                  | DTMFilter.SHOW_PROCESSING_INSTRUCTION))) || 
  +                   (whatToShow == DTMFilter.SHOW_ALL))
         initNodeTest(whatToShow);
       else
       {
  @@ -135,7 +139,7 @@
      * 
      *  @throws CloneNotSupportedException
      */
  -  public NodeIterator cloneWithReset() throws CloneNotSupportedException
  +  public DTMIterator cloneWithReset() throws CloneNotSupportedException
     {
   
       DescendantIterator clone = (DescendantIterator) super.cloneWithReset();
  @@ -157,7 +161,7 @@
      *    INVALID_STATE_ERR: Raised if this method is called after the
      *   <code>detach</code> method was invoked.
      */
  -  public Node nextNode() throws DOMException
  +  public int nextNode()
     {
   
       // If the cache is on, and the node has already been found, then 
  @@ -165,7 +169,7 @@
       if ((null != m_cachedNodes)
               && (m_cachedNodes.getCurrentPos() < m_cachedNodes.size()))
       {
  -      Node next = m_cachedNodes.nextNode();
  +      int next = m_cachedNodes.nextNode();
   
         this.setCurrentPos(m_cachedNodes.getCurrentPos());
   
  @@ -173,15 +177,15 @@
       }
   
       if (m_foundLast)
  -      return null;
  +      return DTM.NULL;
   
  -    Node pos;  // our main itteration node.  
  +    int pos;  // our main itteration node.  
       boolean getSelf;
   
       // Figure out what the start context should be.
       // If the m_lastFetched is null at this point we're at the start 
       // of a fresh iteration.
  -    if (null == m_lastFetched)
  +    if (DTM.NULL == m_lastFetched)
       {
         getSelf = m_orSelf; // true if descendants-or-self.
         
  @@ -189,10 +193,10 @@
         // or the root node.
         if (getSelf && m_fromRoot)
         {
  -        if(m_context.getNodeType() == Node.DOCUMENT_NODE)
  +        if(m_cdtm.getNodeType(m_context) == DTM.DOCUMENT_NODE)
             pos = m_context;
           else
  -          pos = m_context.getOwnerDocument();
  +          pos = m_cdtm.getDocument();
         }
         else
           pos = m_context;
  @@ -227,16 +231,16 @@
       
       try
       {
  -      Node top = m_startContext; // tells us when to stop.
  -      Node next = null;
  +      int top = m_startContext; // tells us when to stop.
  +      int next = DTM.NULL;
     
         // non-recursive depth-first traversal.
  -      while (null != pos)
  +      while (DTM.NULL != pos)
         {
           if(getSelf)
           {
             m_lastFetched = pos; // we have to do this for a clone in a predicate to work correctly.
  -          if(NodeFilter.FILTER_ACCEPT == acceptNode(pos))
  +          if(DTMIterator.FILTER_ACCEPT == acceptNode(pos))
             {
               next = pos;
               break;
  @@ -245,22 +249,22 @@
           else
             getSelf = true;
            
  -        Node nextNode = pos.getFirstChild();
  +        int nextNode = m_cdtm.getFirstChild(pos);
     
  -        while (null == nextNode)
  +        while (DTM.NULL == nextNode)
           {
  -          if (top.equals(pos))
  +          if (top == pos)
               break;
     
  -          nextNode = pos.getNextSibling();
  +          nextNode = m_cdtm.getNextSibling(pos);
     
  -          if (null == nextNode)
  +          if (DTM.NULL == nextNode)
             {
  -            pos = pos.getParentNode();
  +            pos = m_cdtm.getParent(pos);
     
  -            if ((null == pos) || (top.equals(pos)))
  +            if ((DTM.NULL == pos) || (top == pos))
               {
  -              nextNode = null;
  +              nextNode = DTM.NULL;
     
                 break;
               }
  @@ -272,7 +276,7 @@
         
         m_lastFetched = next;
     
  -      if (null != next)
  +      if (DTM.NULL != next)
         {
           if (null != m_cachedNodes)
             m_cachedNodes.addElement(next);
  @@ -284,9 +288,9 @@
         else
         {
           m_foundLast = true;
  -        m_startContext = null;
  +        m_startContext = DTM.NULL;
     
  -        return null;
  +        return DTM.NULL;
         }
       }
       finally
  @@ -301,7 +305,7 @@
     }
     
     /** The top of the subtree, may not be the same as m_context if "//foo" pattern. */ 
  -  transient private Node m_startContext;
  +  transient private int m_startContext;
   
     /** True if this is a descendants-or-self axes.
      *  @serial */
  
  
  
  1.4.2.1   +4 -3      xml-xalan/java/src/org/apache/xpath/axes/DescendantOrSelfWalker.java
  
  Index: DescendantOrSelfWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/DescendantOrSelfWalker.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- DescendantOrSelfWalker.java	2001/01/02 03:47:14	1.4
  +++ DescendantOrSelfWalker.java	2001/04/10 18:45:16	1.4.2.1
  @@ -60,7 +60,8 @@
   import org.apache.xpath.XPath;
   import org.apache.xpath.XPathContext;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
  +import org.apache.xml.dtm.DTM;
   
   /**
    * Walker for the 'descendant-or-self' axes.
  @@ -84,7 +85,7 @@
      *
      * @param root The context node of this step.
      */
  -  public void setRoot(Node root)
  +  public void setRoot(int root)
     {
   
       m_processedSelf = false;
  @@ -100,7 +101,7 @@
      * @return  The new node, or <code>null</code> if the current node has no
      *   visible children in the TreeWalker's logical view.
      */
  -  public Node firstChild()
  +  public int firstChild()
     {
   
       // Follow my made-up rule about returning the self node as a child.
  
  
  
  1.5.2.1   +20 -20    xml-xalan/java/src/org/apache/xpath/axes/DescendantWalker.java
  
  Index: DescendantWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/DescendantWalker.java,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- DescendantWalker.java	2001/01/03 10:14:59	1.5
  +++ DescendantWalker.java	2001/04/10 18:45:16	1.5.2.1
  @@ -60,7 +60,8 @@
   import org.apache.xpath.XPath;
   import org.apache.xpath.XPathContext;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
  +import org.apache.xml.dtm.DTM;
   
   /**
    * Walker for the 'descendant' axes.
  @@ -84,11 +85,10 @@
      *
      * @param root The context node of this step.
      */
  -  public void setRoot(Node root)
  +  public void setRoot(int root)
     {
  +    m_nextLevelAmount = getDTM(root).hasChildNodes(root) ? 1 : 0;
   
  -    m_nextLevelAmount = root.hasChildNodes() ? 1 : 0;
  -
       super.setRoot(root);
     }
   
  @@ -100,20 +100,20 @@
      * @return  The new parent node, or null if the current node has no parent
      *   in the TreeWalker's logical view.
      */
  -  public Node parentNode()
  +  public int parentNode()
     {
   
  -    Node n;
  +    int n;
   
  -    if (m_root.equals(m_currentNode)) // why not == ?  -sb
  +    if (m_root == m_currentNode) // why not == ?  -sb
       {
  -      n = null;
  +      n = DTM.NULL;
       }
       else
       {
  -      Node p = m_currentNode.getParentNode();
  +      int p = getDTM(m_currentNode).getParent(m_currentNode);
   
  -      n = m_root.equals(p) ? null : p;
  +      n = (m_root == p) ? DTM.NULL : p;
       }
   
       m_nextLevelAmount = 0;
  @@ -129,13 +129,13 @@
      * @return  The new node, or <code>null</code> if the current node has no
      *   visible children in the TreeWalker's logical view.
      */
  -  public Node firstChild()
  +  public int firstChild()
     {
  -    
  -    Node next = (m_currentNode.getNodeType() != Node.ATTRIBUTE_NODE) ?
  -                m_currentNode.getFirstChild() : null;
  +    DTM dtm = getDTM(m_currentNode);
  +    int next = (dtm.getNodeType(m_currentNode) != DTM.ATTRIBUTE_NODE) ?
  +                dtm.getFirstChild(m_currentNode) : DTM.NULL;
   
  -    m_nextLevelAmount = (null == next) ? 0 : (next.hasChildNodes() ? 1 : 0);
  +    m_nextLevelAmount = (DTM.NULL == next) ? 0 : (dtm.hasChildNodes(next) ? 1 : 0);
   
       return setCurrentIfNotNull(next);
     }
  @@ -147,13 +147,13 @@
      * @return  The new node, or <code>null</code> if the current node has no
      *   next sibling in the TreeWalker's logical view.
      */
  -  public Node nextSibling()
  +  public int nextSibling()
     {
  -
  -    Node next = m_root.equals(m_currentNode)
  -                ? null : m_currentNode.getNextSibling();
  +    DTM dtm = getDTM(m_root);
  +    int next = (m_root == m_currentNode)
  +                ? DTM.NULL : dtm.getNextSibling(m_currentNode);
   
  -    m_nextLevelAmount = (null == next) ? 0 : (next.hasChildNodes() ? 1 : 0);
  +    m_nextLevelAmount = (DTM.NULL == next) ? 0 : (dtm.hasChildNodes(next) ? 1 : 0);
   
       return setCurrentIfNotNull(next);
     }
  
  
  
  1.14.2.1  +26 -22    xml-xalan/java/src/org/apache/xpath/axes/FilterExprWalker.java
  
  Index: FilterExprWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/FilterExprWalker.java,v
  retrieving revision 1.14
  retrieving revision 1.14.2.1
  diff -u -r1.14 -r1.14.2.1
  --- FilterExprWalker.java	2001/01/24 14:43:06	1.14
  +++ FilterExprWalker.java	2001/04/10 18:45:16	1.14.2.1
  @@ -70,9 +70,12 @@
   
   import java.util.Vector;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.traversal.NodeIterator;
  -import org.w3c.dom.traversal.NodeFilter;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.traversal.NodeFilter;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
  +import org.apache.xml.dtm.DTMFilter;
   
   /**
    * Walker for the OP_VARIABLE, or OP_EXTFUNCTION, or OP_FUNCTION, or OP_GROUP,
  @@ -127,7 +130,7 @@
      * @param root non-null reference to the root, or starting point of 
      *        the query.
      */
  -  public void setRoot(Node root)
  +  public void setRoot(int root)
     {
   
       // System.out.println("root: "+root);
  @@ -167,7 +170,7 @@
         // System.out.println("Back from m_expr.execute(m_lpi.getXPathContext()): "+obj);
         m_nodeSet = (null != obj) ? obj.nodeset() : null;
         
  -      m_peek = null;
  +      m_peek = DTM.NULL;
       }
       catch (javax.xml.transform.TransformerException se)
       {
  @@ -198,7 +201,7 @@
   
       // clone.m_expr = (Expression)((Expression)m_expr).clone();
       if (null != m_nodeSet)
  -      clone.m_nodeSet = (NodeIterator) ((ContextNodeList) m_nodeSet).clone();
  +      clone.m_nodeSet = (DTMIterator) m_nodeSet.clone();
   
       return clone;
     }
  @@ -210,7 +213,7 @@
      * @return  a constant to determine whether the node is accepted,
      *   rejected, or skipped, as defined  above .
      */
  -  public short acceptNode(Node n)
  +  public short acceptNode(int n)
     {
   
       try
  @@ -220,10 +223,10 @@
           countProximityPosition(0);
   
           if (!executePredicates(n, m_lpi.getXPathContext()))
  -          return NodeFilter.FILTER_SKIP;
  +          return DTMIterator.FILTER_SKIP;
         }
   
  -      return NodeFilter.FILTER_ACCEPT;
  +      return DTMIterator.FILTER_ACCEPT;
       }
       catch (javax.xml.transform.TransformerException se)
       {
  @@ -240,34 +243,35 @@
      * @return  The new node, or <code>null</code> if the current node has no
      *   next node  in the TreeWalker's logical view.
      */
  -  public Node getNextNode()
  +  public int getNextNode()
     {
   
  -    Node next;
  +    int next;
   
  -    if (null != m_peek)
  +    if (DTM.NULL != m_peek)
       {
         next = m_peek;
  -      m_peek = null;
  +      m_peek = DTM.NULL;
       }
       else
       {
         if (null != m_nodeSet)
         {
  -        Node current = this.getCurrentNode();
  +        int current = this.getCurrentNode();
   
  -        if (current instanceof NodeTestFilter)
  -          ((NodeTestFilter) current).setNodeTest(this);
  +        // %TBD%
  +//        if (current instanceof NodeTestFilter)
  +//          ((NodeTestFilter) current).setNodeTest(this);
   
           next = m_nodeSet.nextNode();
         }
         else
  -        next = null;
  +        next = DTM.NULL;
       }
   
       // Bogus, I think, but probably OK for right now since a filterExpr 
       // can only occur at the head of a location path.
  -    if (null == next)
  +    if (DTM.NULL == next)
       {
         m_nextLevelAmount = 0;
       }
  @@ -275,7 +279,7 @@
       {
   
         // System.out.println("FilterExprWalker.getNextNode");
  -      m_nextLevelAmount = (next.hasChildNodes() ? 1 : 0);
  +      m_nextLevelAmount = ((getDTM(next).getFirstChild(next) != DTM.NULL) ? 1 : 0);
   
         /* ...WAIT TO SEE IF WE REALLY NEED THIS...
         m_peek = m_nodeSet.nextNode();
  @@ -292,16 +296,16 @@
       // System.out.println("FilterExprWalker.getNextNode - Returning: "+next);
       return setCurrentIfNotNull(next);
     }
  -
  +  
     /** The contained expression. Should be non-null.
      *  @serial   */
     private Expression m_expr;
   
     /** The result of executing m_expr.  Needs to be deep cloned on clone op.  */
  -  transient private NodeIterator m_nodeSet;
  +  transient private DTMIterator m_nodeSet;
   
     /** I think this is always null right now.    */
  -  transient private Node m_peek = null;
  +  transient private int m_peek = DTM.NULL;
   
     /**
      * Tell what's the maximum level this axes can descend to (which is actually
  
  
  
  1.3.2.1   +5 -4      xml-xalan/java/src/org/apache/xpath/axes/FollowingSiblingWalker.java
  
  Index: FollowingSiblingWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/FollowingSiblingWalker.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- FollowingSiblingWalker.java	2000/12/17 17:40:01	1.3
  +++ FollowingSiblingWalker.java	2001/04/10 18:45:16	1.3.2.1
  @@ -60,7 +60,8 @@
   import org.apache.xpath.XPath;
   import org.apache.xpath.XPathContext;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
  +import org.apache.xml.dtm.DTM;
   
   /**
    * Walker for the 'following-sibling' axes.
  @@ -89,10 +90,10 @@
      * @return  The new node, or <code>null</code> if the current node has no
      *   next sibling in the TreeWalker's logical view.
      */
  -  public Node nextSibling()
  +  public int nextSibling()
     {
   
  -    Node n = m_currentNode.getNextSibling();
  +    int n = getDTM(m_root).getNextSibling(m_currentNode);
   
       return setCurrentIfNotNull(n);
     }
  @@ -104,6 +105,6 @@
      */
     protected int getLevelMax()
     {
  -    return m_lpi.getDOMHelper().getLevel(m_root);
  +    return getDTM(m_root).getLevel(m_root);
     }
   }
  
  
  
  1.6.2.1   +30 -26    xml-xalan/java/src/org/apache/xpath/axes/FollowingWalker.java
  
  Index: FollowingWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/FollowingWalker.java,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- FollowingWalker.java	2001/02/08 03:45:43	1.6
  +++ FollowingWalker.java	2001/04/10 18:45:16	1.6.2.1
  @@ -63,7 +63,8 @@
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.DOMHelper;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
  +import org.apache.xml.dtm.DTM;
   
   /**
    * Walker for the 'following' axes.
  @@ -87,12 +88,13 @@
      *
      * @param root The context node of this step.
      */
  -  public void setRoot(Node root)
  +  public void setRoot(int root)
     {      
   
       super.setRoot(root);
       
  -    if(root.getNodeType() == Node.ATTRIBUTE_NODE)
  +    DTM dtm = getDTM(root);
  +    if(dtm.getNodeType(root) == DTM.ATTRIBUTE_NODE)
       {
         // The current node could be an attribute node, so getNextSibling() will 
         // always return null.  In that case, we want to continue the search 
  @@ -101,15 +103,15 @@
         // don't have to consider following attributes, since they never match 
         // the following axes.
         /*
  -      Node e = m_lpi.getDOMHelper().getParentOfNode(root);
  +      int e = m_lpi.getDOMHelper().getParentOfNode(root);
         root = e.getLastChild();
         if(null == root)
           root = e;
         m_currentAncestor = e.getParentNode();
         */
  -      Node e = m_lpi.getDOMHelper().getParentOfNode(root);
  +      int e = dtm.getParent(root);
         m_currentNode = e;
  -      m_currentAncestor = e.getOwnerDocument(); // Not totally sure why
  +      m_currentAncestor = dtm.getOwnerDocument(root); // Not totally sure why
       } 
       else
         m_currentAncestor = root;
  @@ -130,22 +132,22 @@
      * @return  The new parent node, or null if the current node has no parent
      *   in the TreeWalker's logical view.
      */
  -  public Node parentNode()
  +  public int parentNode()
     {
   
  -    Node n;
  -//    Node nextAncestor = (null != m_currentAncestor)
  +    int n;
  +//    int nextAncestor = (null != m_currentAncestor)
   //                        ? m_currentAncestor.getParentNode() : null;
  -    Node nextParent = m_currentNode.getParentNode();
  +    int nextParent = getDTM(m_root).getParent(m_currentNode);
   
   //    if (nextParent == nextAncestor)
   //    {
   //      n = null;
   //
  -//      Node ancestor = m_currentAncestor;
  +//      int ancestor = m_currentAncestor;
   //
   //      while ((null != ancestor)
  -//             && (null != (ancestor = (Node) ancestor.getParentNode())))
  +//             && (null != (ancestor = (int) ancestor.getParentNode())))
   //      {
   //        n = ancestor.getNextSibling();
   //
  @@ -162,7 +164,7 @@
   
   //    if(null != n)
   //    {
  -//      Node attrNode = n.getAttributes().getNamedItem("id");
  +//      int attrNode = n.getAttributes().getNamedItem("id");
   //      if(null != attrNode)
   //        System.out.println("parentNode: "+attrNode.getNodeValue());
   //      else
  @@ -182,13 +184,14 @@
      * @return  The new node, or <code>null</code> if the current node has no
      *   visible children in the TreeWalker's logical view.
      */
  -  public Node firstChild()
  +  public int firstChild()
     {
   
  -    Node n;
  +    int n;
  +    DTM dtm = getDTM(m_root);
       if(m_currentAncestor == m_currentNode)
       {
  -//      if(m_currentNode.getNodeType() == Node.ATTRIBUTE_NODE)
  +//      if(m_currentNode.getNodeType() == DTM.ATTRIBUTE_NODE)
   //      {
   //        // The current node could be an attribute node, so getNextSibling() will 
   //        // always return null.  In that case, we want to continue the search 
  @@ -199,18 +202,18 @@
   //        n = m_lpi.getDOMHelper().getParentOfNode(m_currentNode).getFirstChild();
   //      } 
   //      else
  -        n = m_currentNode.getNextSibling();
  +        n = dtm.getNextSibling(m_currentNode);
       }
       else
       {
  -      n = m_currentNode.getFirstChild();
  +      n = dtm.getFirstChild(m_currentNode);
       }
   
  -    m_nextLevelAmount = (null == n) ? 0 : (n.hasChildNodes() ? 1 : 0);
  +    m_nextLevelAmount = (DTM.NULL == n) ? 0 : (dtm.hasChildNodes(n) ? 1 : 0);
       
   //    if(null != n)
   //    {
  -//      Node attrNode = n.getAttributes().getNamedItem("id");
  +//      int attrNode = n.getAttributes().getNamedItem("id");
   //      if(null != attrNode)
   //        System.out.println("firstChild: "+attrNode.getNodeValue());
   //      else
  @@ -229,17 +232,18 @@
      * @return  The new node, or <code>null</code> if the current node has no
      *   next sibling in the TreeWalker's logical view.
      */
  -  public Node nextSibling()
  +  public int nextSibling()
     {
   
  -    Node n;    
  -    n = m_currentNode.getNextSibling();
  +    int n;    
  +    DTM dtm = getDTM(m_root);
  +    n = dtm.getNextSibling(m_currentNode);
   
  -    m_nextLevelAmount = (null == n) ? 0 : (n.hasChildNodes() ? 1 : 0);
  +    m_nextLevelAmount = (DTM.NULL == n) ? 0 : (dtm.hasChildNodes(n) ? 1 : 0);
   
   //    if(null != n)
   //    {
  -//      Node attrNode = n.getAttributes().getNamedItem("id");
  +//      int attrNode = n.getAttributes().getNamedItem("id");
   //      if(null != attrNode)
   //        System.out.println("nextSibling: "+attrNode.getNodeValue());
   //      else
  @@ -253,7 +257,7 @@
   
     /** What this is is frankly a little unclear.  It is used in getParent 
      *  to see if we should continue to climb the tree. */
  -  transient Node m_currentAncestor;
  +  transient int m_currentAncestor;
   
     /**
      * Tell what's the maximum level this axes can descend to.
  
  
  
  1.24.2.1  +105 -43   xml-xalan/java/src/org/apache/xpath/axes/LocPathIterator.java
  
  Index: LocPathIterator.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/LocPathIterator.java,v
  retrieving revision 1.24
  retrieving revision 1.24.2.1
  diff -u -r1.24 -r1.24.2.1
  --- LocPathIterator.java	2001/01/24 14:43:07	1.24
  +++ LocPathIterator.java	2001/04/10 18:45:17	1.24.2.1
  @@ -61,13 +61,17 @@
   import java.util.Stack;
   
   // DOM imports
  -import org.w3c.dom.traversal.NodeIterator;
  -import org.w3c.dom.traversal.TreeWalker;
  -import org.w3c.dom.traversal.NodeFilter;
  -import org.w3c.dom.Node;
  -import org.w3c.dom.NamedNodeMap;
  -import org.w3c.dom.DOMException;
  -import org.w3c.dom.NodeList;
  +//import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.traversal.TreeWalker;
  +//import org.w3c.dom.traversal.NodeFilter;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.NamedNodeMap;
  +//import org.w3c.dom.DOMException;
  +//import org.w3c.dom.NodeList;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
  +import org.apache.xml.dtm.DTMFilter;
  +import org.apache.xml.dtm.DTMManager;
   
   // Xalan imports
   import org.apache.xpath.res.XPATHErrorResources;
  @@ -101,8 +105,7 @@
    * in which case the UnionPathIterator will cache the nodes.</p>
    */
   public class LocPathIterator extends PredicatedNodeTest
  -        implements Cloneable, NodeIterator, ContextNodeList, NodeList,
  -                   java.io.Serializable
  +        implements Cloneable, DTMIterator, java.io.Serializable
   {
   
     /**
  @@ -198,6 +201,51 @@
         m_lastUsedWalker = m_firstWalker;
       }
     }
  +  
  +  /**
  +   * Set the environment in which this iterator operates, which should provide:
  +   * a node (the context node... same value as "root" defined below) 
  +   * a pair of non-zero positive integers (the context position and the context size) 
  +   * a set of variable bindings 
  +   * a function library 
  +   * the set of namespace declarations in scope for the expression.
  +   * 
  +   * <p>At this time the exact implementation of this environment is application 
  +   * dependent.  Probably a proper interface will be created fairly soon.</p>
  +   * 
  +   * @param environment The environment object.
  +   */
  +  public void setEnvironment(Object environment)
  +  {
  +    // %TBD% ?
  +  }
  +  
  +  /**
  +   * Get an instance of a DTM that "owns" a node handle.  Since a node 
  +   * iterator may be passed without a DTMManager, this allows the 
  +   * caller to easily get the DTM using just the iterator.
  +   *
  +   * @param nodeHandle the nodeHandle.
  +   *
  +   * @return a non-null DTM reference.
  +   */
  +  public DTM getDTM(int nodeHandle)
  +  {
  +    // %OPT%
  +    return m_execContext.getDTM(nodeHandle);
  +  }
  +  
  +  /**
  +   * Get an instance of the DTMManager.  Since a node 
  +   * iterator may be passed without a DTMManager, this allows the 
  +   * caller to easily get the DTMManager using just the iterator.
  +   *
  +   * @return a non-null DTMManager reference.
  +   */
  +  public DTMManager getDTMManager()
  +  {
  +    return m_execContext.getDTMManager();
  +  }
   
     /**
      * Execute this iterator, meaning create a clone that can
  @@ -269,6 +317,7 @@
     {
   
       this.m_context = execContext.getCurrentNode();
  +    m_cdtm = execContext.getDTM(m_context);
       this.m_currentContextNode = execContext.getCurrentExpressionNode();
       this.m_execContext = execContext;
       this.m_prefixResolver = execContext.getNamespaceContext();
  @@ -389,7 +438,7 @@
      *   <code>NodeList</code> , or <code>null</code> if that is not a valid
      *   index.
      */
  -  public Node item(int index)
  +  public int item(int index)
     {
   
       resetToCachedList();
  @@ -444,11 +493,8 @@
      * iterator backwards in the set.
      * @return  The previous <code>Node</code> in the set being iterated over,
      *   or<code>null</code> if there are no more members in that set.
  -   * @throws DOMException
  -   *    INVALID_STATE_ERR: Raised if this method is called after the
  -   *   <code>detach</code> method was invoked.
      */
  -  public Node previousNode() throws DOMException
  +  public int previousNode()
     {
   
       if (null == m_cachedNodes)
  @@ -475,7 +521,7 @@
     {
   
       // TODO: ??
  -    return NodeFilter.SHOW_ALL & ~NodeFilter.SHOW_ENTITY_REFERENCE;
  +    return DTMFilter.SHOW_ALL & ~DTMFilter.SHOW_ENTITY_REFERENCE;
     }
   
     /**
  @@ -486,7 +532,7 @@
      * @return Always null.
      * @see org.w3c.dom.traversal.NodeIterator
      */
  -  public NodeFilter getFilter()
  +  public DTMFilter getFilter()
     {
       return null;
     }
  @@ -497,7 +543,7 @@
      * @return The "root" of this iterator, which, in XPath terms,
      * is the node context for this iterator.
      */
  -  public Node getRoot()
  +  public int getRoot()
     {
       return m_context;
     }
  @@ -532,7 +578,8 @@
     public void detach()
     {
   
  -    this.m_context = null;
  +    this.m_context = DTM.NULL;
  +    m_cdtm = null;
       this.m_execContext = null;
       this.m_prefixResolver = null;
       this.m_dhelper = null;
  @@ -550,7 +597,7 @@
      *
      * @throws CloneNotSupportedException
      */
  -  public NodeIterator cloneWithReset() throws CloneNotSupportedException
  +  public DTMIterator cloneWithReset() throws CloneNotSupportedException
     {
   
       LocPathIterator clone = (LocPathIterator) clone();
  @@ -608,7 +655,7 @@
   
       // super.reset();
       m_foundLast = false;
  -    m_lastFetched = null;
  +    m_lastFetched = DTM.NULL;
       m_next = 0;
       m_last = 0;
       m_waitingBottom = 0;
  @@ -629,11 +676,8 @@
      * to nextNode() returns the first node in the set.
      * @return  The next <code>Node</code> in the set being iterated over, or
      *   <code>null</code> if there are no more members in that set.
  -   * @throws DOMException
  -   *    INVALID_STATE_ERR: Raised if this method is called after the
  -   *   <code>detach</code> method was invoked.
      */
  -  public Node nextNode() throws DOMException
  +  public int nextNode()
     {
   
       // If the cache is on, and the node has already been found, then 
  @@ -641,7 +685,7 @@
       if ((null != m_cachedNodes)
               && (m_cachedNodes.getCurrentPos() < m_cachedNodes.size()))
       {
  -      Node next = m_cachedNodes.nextNode();
  +      int next = m_cachedNodes.nextNode();
   
         this.setCurrentPos(m_cachedNodes.getCurrentPos());
   
  @@ -658,7 +702,7 @@
       // from the execute method.
       if (-1 == m_varStackPos)
       {
  -      if (null == m_firstWalker.getRoot())
  +      if (DTM.NULL == m_firstWalker.getRoot())
         {
           this.setNextPosition(0);
           m_firstWalker.setRoot(m_context);
  @@ -678,7 +722,7 @@
         vars.setSearchStart(m_varStackPos);
         vars.pushContextPosition(m_varStackContext);
   
  -      if (null == m_firstWalker.getRoot())
  +      if (DTM.NULL == m_firstWalker.getRoot())
         {
           this.setNextPosition(0);
           m_firstWalker.setRoot(m_context);
  @@ -686,7 +730,7 @@
           m_lastUsedWalker = m_firstWalker;
         }
   
  -      Node n = returnNextNode(m_firstWalker.nextNode());
  +      int n = returnNextNode(m_firstWalker.nextNode());
   
         // These two statements need to be combined into one operation.
         vars.setSearchStart(savedStart);
  @@ -704,10 +748,10 @@
      *
      * @return The same node that was passed as an argument.
      */
  -  protected Node returnNextNode(Node nextNode)
  +  protected int returnNextNode(int nextNode)
     {
   
  -    if (null != nextNode)
  +    if (DTM.NULL != nextNode)
       {
         if (null != m_cachedNodes)
           m_cachedNodes.addElement(nextNode);
  @@ -717,7 +761,7 @@
   
       m_lastFetched = nextNode;
   
  -    if (null == nextNode)
  +    if (DTM.NULL == nextNode)
         m_foundLast = true;
   
       return nextNode;
  @@ -728,7 +772,7 @@
      *
      * @return The last fetched node, or null if the last fetch was null.
      */
  -  public Node getCurrentNode()
  +  public int getCurrentNode()
     {
       return m_lastFetched;
     }
  @@ -748,15 +792,15 @@
       if (m_foundLast || ((index >= 0) && (index <= getCurrentPos())))
         return;
   
  -    Node n;
  +    int n;
   
       if (-1 == index)
       {
  -      while (null != (n = nextNode()));
  +      while (DTM.NULL != (n = nextNode()));
       }
       else
       {
  -      while (null != (n = nextNode()))
  +      while (DTM.NULL != (n = nextNode()))
         {
           if (getCurrentPos() >= index)
             break;
  @@ -869,7 +913,7 @@
      *
      * @return The node context, same as getRoot().
      */
  -  public final Node getContext()
  +  public final int getContext()
     {
       return m_context;
     }
  @@ -880,7 +924,7 @@
      *
      * @return The top-level node context of the entire expression.
      */
  -  public final Node getCurrentContextNode()
  +  public final int getCurrentContextNode()
     {
       return m_currentContextNode;
     }
  @@ -890,11 +934,23 @@
      *
      * @param n Must be a non-null reference to the node context.
      */
  -  public final void setCurrentContextNode(Node n)
  +  public final void setCurrentContextNode(int n)
     {
       m_currentContextNode = n;
     }
  +  
  +  /**
  +   * Set the current context node for this iterator.
  +   *
  +   * @param n Must be a non-null reference to the node context.
  +   */
  +  public final void setRoot(int n)
  +  {
  +    m_context = n;
  +    m_cdtm = m_execContext.getDTM(n);
  +  }
   
  +
     /**
      * Return the saved reference to the prefix resolver that
      * was in effect when this iterator was created.
  @@ -952,9 +1008,9 @@
   
       clone.setPredicateCount(clone.getPredicateCount() - 1);
   
  -    Node next;
  +    int next;
   
  -    while (null != (next = clone.nextNode()))
  +    while (DTM.NULL != (next = clone.nextNode()))
       {
         pos++;
       }
  @@ -1007,6 +1063,12 @@
     
     //============= State Data =============
     
  +  /** 
  +   * The dtm of the context node.  Careful about using this... it may not 
  +   * be the dtm of the current node.
  +   */
  +  transient protected DTM m_cdtm;
  +  
     /** The starting point in m_waiting where the waiting step walkers are. */
     transient int m_waitingBottom = 0;
   
  @@ -1042,7 +1104,7 @@
     // ObjectPool m_pool = new ObjectPool(this.getClass());
   
     /** The last node that was fetched, usually by nextNode. */
  -  transient public Node m_lastFetched;
  +  transient public int m_lastFetched;
   
     /**
      * If this iterator needs to cache nodes that are fetched, they
  @@ -1071,7 +1133,7 @@
      * The context node for this iterator, which doesn't change through
      * the course of the iteration.
      */
  -  transient protected Node m_context;
  +  transient protected int m_context;
   
     /**
      * The node context from where the expression is being
  @@ -1079,7 +1141,7 @@
      * from m_context in that this is the context for the entire
      * expression, rather than the context for the subexpression.
      */
  -  transient protected Node m_currentContextNode;
  +  transient protected int m_currentContextNode;
   
     /**
      * Fast access to the current prefix resolver.  It isn't really
  
  
  
  1.4.2.1   +25 -65    xml-xalan/java/src/org/apache/xpath/axes/NamespaceWalker.java
  
  Index: NamespaceWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/NamespaceWalker.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- NamespaceWalker.java	2000/12/17 17:40:01	1.4
  +++ NamespaceWalker.java	2001/04/10 18:45:17	1.4.2.1
  @@ -62,8 +62,9 @@
   import org.apache.xpath.XPath;
   import org.apache.xpath.XPathContext;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.NamedNodeMap;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.NamedNodeMap;
  +import org.apache.xml.dtm.DTM;
   
   /**
    * Walker for the 'namespace' axes.
  @@ -83,66 +84,20 @@
     }
   
     /**
  -   * Get a cloned AxesWalker.
  +   *  The root node of the TreeWalker.
      *
  -   * @return A cloned NamespaceWalker.
  -   *
  -   * @throws CloneNotSupportedException
  -   */
  -  public Object clone() throws CloneNotSupportedException
  -  {
  -
  -    NamespaceWalker clone = (NamespaceWalker) super.clone();
  -
  -    if (null != this.m_namespaces)
  -    {
  -      clone.m_namespaces = (Stack) this.m_namespaces.clone();
  -    }
  -
  -    return clone;
  -  }
  -
  -  /**
  -   *  Set the root node of the TreeWalker.
  -   *
      * @param root The context node of this step.
      */
  -  public void setRoot(Node root)
  +  public void setRoot(int root)
     {
   
  -    m_nextLevelAmount = 1;
  -    m_namespaces = new Stack();
  +    // System.out.println("ChildWalker.setRoot");
  +    m_nextLevelAmount = (getDTM(root).getFirstNamespaceNode(root, true) != DTM.NULL) ? 1 : 0;
   
  -    Node nsContext = root;
  -
  -    while (null != nsContext)
  -    {
  -      NamedNodeMap attributeList = nsContext.getAttributes();
  -
  -      if (null != attributeList)
  -      {
  -        int nAttrs = attributeList.getLength();
  -
  -        // System.out.println("setRoot - nAttrs: "+nAttrs);
  -        for (int i = (nAttrs - 1); i >= 0; i--)
  -        {
  -          Node attr = attributeList.item(i);
  -
  -          if (m_lpi.getDOMHelper().isNamespaceNode(attr))
  -          {
  -
  -            // System.out.println("setRoot - pushing namespace: "+attr.getNodeName());
  -            m_namespaces.push(attr);
  -          }
  -        }
  -      }
  -
  -      nsContext = nsContext.getParentNode();
  -    }
  -
  +    // System.out.println("Back from calling hasChildNodes");
       super.setRoot(root);
   
  -    // System.out.println("============");
  +    // System.out.println("Exiting ChildWalker.setRoot");
     }
   
     /**
  @@ -153,12 +108,20 @@
      * @return  The new node, or <code>null</code> if the current node has no
      *   visible children in the TreeWalker's logical view.
      */
  -  public Node firstChild()
  +  public int firstChild()
     {
   
  +    // System.out.println("ChildWalker.firstChild");
       m_nextLevelAmount = 0;
   
  -    return nextSibling();
  +    if (m_root == m_currentNode)
  +    {
  +
  +      // System.out.println("ChildWalker - Calling getFirstChild");
  +      return setCurrentIfNotNull(getDTM(m_root).getFirstNamespaceNode(m_currentNode, true));
  +    }
  +    else
  +      return DTM.NULL;
     }
   
     /**
  @@ -168,18 +131,15 @@
      * @return  The new node, or <code>null</code> if the current node has no
      *   next sibling in the TreeWalker's logical view.
      */
  -  public Node nextSibling()
  +  public int nextSibling()
     {
   
  -    Node next = m_namespaces.isEmpty() ? null : (Node) m_namespaces.pop();
  -
  -    // System.out.println("nextSibling: "+this.nodeToString(next));
  -    return this.setCurrentIfNotNull(next);
  +    if (m_root != m_currentNode)
  +      return setCurrentIfNotNull(getDTM(m_root).getNextNamespaceNode(m_currentNode, true));
  +    else
  +      return DTM.NULL;
     }
   
  -  /** Stack of namespace decl nodes (xmlns attributes).   */
  -  transient Stack m_namespaces;
  -
     /**
      * Tell what's the maximum level this axes can descend to.
      *
  @@ -187,6 +147,6 @@
      */
     protected int getLevelMax()
     {
  -    return m_lpi.getDOMHelper().getLevel(m_root);
  +    return getDTM(m_root).getLevel(m_root);
     }
   }
  
  
  
  1.5.2.1   +7 -7      xml-xalan/java/src/org/apache/xpath/axes/ParentWalker.java
  
  Index: ParentWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/ParentWalker.java,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- ParentWalker.java	2001/01/02 03:47:15	1.5
  +++ ParentWalker.java	2001/04/10 18:45:17	1.5.2.1
  @@ -60,7 +60,8 @@
   import org.apache.xpath.XPath;
   import org.apache.xpath.XPathContext;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
  +import org.apache.xml.dtm.DTM;
   
   /**
    * Walker for the 'parent' axes.
  @@ -84,7 +85,7 @@
      *
      * @param root The context node of this step.
      */
  -  public void setRoot(Node root)
  +  public void setRoot(int root)
     {
   
       m_gotParent = false;
  @@ -101,7 +102,7 @@
      * @return  The new node, or <code>null</code> if the current node has no
      *   visible children in the TreeWalker's logical view.
      */
  -  public Node firstChild()
  +  public int firstChild()
     {
   
       // Follow rule about returning the first occuring in document order 
  @@ -110,13 +111,12 @@
       {
         m_gotParent = true;
   
  -      // Patch from Merlin
  -      Node n = m_lpi.getDOMHelper().getParentOfNode(m_root);
  +      int n = getDTM(m_root).getParent(m_root);
   
         return setCurrentIfNotNull(n);
       }
   
  -    return null;
  +    return DTM.NULL;
     }
   
     /** True if we already obtained the parent node.  */
  @@ -129,6 +129,6 @@
      */
     protected int getLevelMax()
     {
  -    return m_lpi.getDOMHelper().getLevel(m_root) - 1;
  +    return getDTM(m_root).getLevel(m_root) - 1;
     }
   }
  
  
  
  1.4.2.1   +15 -13    xml-xalan/java/src/org/apache/xpath/axes/PrecedingSiblingWalker.java
  
  Index: PrecedingSiblingWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/PrecedingSiblingWalker.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- PrecedingSiblingWalker.java	2000/12/17 17:40:01	1.4
  +++ PrecedingSiblingWalker.java	2001/04/10 18:45:17	1.4.2.1
  @@ -60,7 +60,8 @@
   import org.apache.xpath.XPath;
   import org.apache.xpath.XPathContext;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
  +import org.apache.xml.dtm.DTM;
   
   /**
    * Walker for the 'preceding-sibling' axes.
  @@ -89,37 +90,38 @@
      * @return  The new node, or <code>null</code> if the current node has no
      *   next sibling in the TreeWalker's logical view.
      */
  -  public Node nextSibling()
  +  public int nextSibling()
     {
   
  -    Node next;
  +    int next;
   
  +    DTM dtm = getDTM(m_root);
       if (m_currentNode == m_root)
       {
  -      if(m_currentNode.getNodeType() == Node.ATTRIBUTE_NODE)
  +      if(dtm.getNodeType(m_currentNode) == DTM.ATTRIBUTE_NODE)
         {
           // then don't bother, since attributes don't have siblings.
           // Otherwise, we would go up to the parent, and get the so-called 
           // first attribute.
  -        next = null;
  +        next = DTM.NULL;
         }
         else
         {
  -        Node parent = m_lpi.getDOMHelper().getParentOfNode(m_currentNode);
  +        int parent = dtm.getParent(m_currentNode);
     
  -        if (null == parent)
  -          return null;
  +        if (DTM.NULL == parent)
  +          return DTM.NULL;
     
  -        next = parent.getFirstChild();
  +        next = dtm.getFirstChild(parent);
         }
       }
       else
       {
  -      next = m_currentNode.getNextSibling();
  +      next = dtm.getNextSibling(m_currentNode);
       }
   
  -    if (null != next && next.equals(m_root))
  -      next = null;
  +    if (DTM.NULL != next && next == m_root)
  +      next = DTM.NULL;
   
       return setCurrentIfNotNull(next);
     }
  @@ -131,6 +133,6 @@
      */
     protected int getLevelMax()
     {
  -    return m_lpi.getDOMHelper().getLevel(m_root);
  +    return getDTM(m_root).getLevel(m_root);
     }
   }
  
  
  
  1.10.2.1  +46 -42    xml-xalan/java/src/org/apache/xpath/axes/PrecedingWalker.java
  
  Index: PrecedingWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/PrecedingWalker.java,v
  retrieving revision 1.10
  retrieving revision 1.10.2.1
  diff -u -r1.10 -r1.10.2.1
  --- PrecedingWalker.java	2001/02/08 03:48:06	1.10
  +++ PrecedingWalker.java	2001/04/10 18:45:17	1.10.2.1
  @@ -61,7 +61,8 @@
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.DOMHelper;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
  +import org.apache.xml.dtm.DTM;
   
   /**
    * Walker for the 'preceding' axes.
  @@ -90,19 +91,19 @@
      *
      * @param root The context node of this step.
      */
  -  public void setRoot(Node root)
  +  public void setRoot(int root)
     {
  -
  -    if (Node.ATTRIBUTE_NODE == root.getNodeType())
  +    DTM dtm = getDTM(root);
  +    if (DTM.ATTRIBUTE_NODE == dtm.getNodeType(root))
       {
  -      root = m_lpi.getDOMHelper().getParentOfNode(root);
  +      root = dtm.getParent(root);
       }
   
       super.setRoot(root);
   
  -    m_doc = m_lpi.getDOMHelper().getRootNode(root);
  +    m_doc = dtm.getDocument();
       m_currentNode = m_doc;
  -    m_nextLevelAmount = root.hasChildNodes() ? 1 : 0;
  +    m_nextLevelAmount = (dtm.getFirstChild(root) != DTM.NULL) ? 1 : 0;
   
       super.resetProximityPositions();
     }
  @@ -120,26 +121,26 @@
      * @return  The new parent node, or null if the current node has no parent
      *   in the TreeWalker's logical view.
      */
  -  public Node parentNode()
  +  public int parentNode()
     {
   
  -    Node next = m_currentNode.getParentNode();
  +    int next = getDTM(m_currentNode).getParent(m_currentNode);
   
       // If we're at the root of the tree, we're done.
  -    if ((null == next) || m_doc.equals(next))
  -      return null;
  +    if ((DTM.NULL == next) || m_doc == next)
  +      return DTM.NULL;
   
       // If the parent vertice is an ancestor of the step 
       // context, then all siblings are to the left of the 
       // ancestor path, so we're done.
       if (isAncestorOfRootContext(next))
  -      return null;
  +      return DTM.NULL;
   
       m_nextLevelAmount = 0;
   
   //    if(null != next)
   //    {
  -//      Node attrNode = next.getAttributes().getNamedItem("id");
  +//      int attrNode = next.getAttributes().getNamedItem("id");
   //      if(null != attrNode)
   //        System.out.println("parentNode: "+attrNode.getNodeValue());
   //      else
  @@ -159,23 +160,25 @@
      * @return  The new node, or <code>null</code> if the current node has no
      *   visible children in the TreeWalker's logical view.
      */
  -  public Node firstChild()
  +  public int firstChild()
     {
   
       // Walk down the left edge of the current sub-tree.
       // Get the next child on the 'preceding' axes. This will 
       // skip any children nodes that are ancestors of the step context,
       // but will return children of those nodes.
  -    if (m_root.equals(m_currentNode))
  -      return null;
  +    if (m_root == m_currentNode)
  +      return DTM.NULL;
   
  -    Node nextNode = m_currentNode;
  +    int nextNode = m_currentNode;
  +    
  +    DTM dtm = getDTM(m_root);
   
  -    while (null != nextNode)
  +    while (DTM.NULL != nextNode)
       {
  -      Node n = nextNode.getFirstChild();
  +      int n = dtm.getFirstChild(nextNode);
   
  -      if (null != n)
  +      if (DTM.NULL != n)
         {
           nextNode = n;
         }
  @@ -185,28 +188,28 @@
           // If the next sibling is an ancestor, then continue 
           // on to get it's first child, otherwise nextSibling() 
           // will get it.
  -        nextNode = nextNode.getNextSibling();
  +        nextNode = dtm.getNextSibling(nextNode);
   
  -        if (null != nextNode)
  +        if (DTM.NULL != nextNode)
           {
  -          if (m_root.equals(nextNode) ||!isAncestorOfRootContext(nextNode))
  -            return null;
  +          if ((m_root == nextNode) ||!isAncestorOfRootContext(nextNode))
  +            return DTM.NULL;
             else
               continue;
           }
         }
   
  -      if (null != nextNode)
  +      if (DTM.NULL != nextNode)
         {
  -        if (m_root.equals(nextNode))
  -          return null;
  +        if (m_root == nextNode)
  +          return DTM.NULL;
           else if (!isAncestorOfRootContext(nextNode))
             break;
         }
       }
   
  -    m_nextLevelAmount = (null == nextNode)
  -                        ? 0 : (nextNode.hasChildNodes() ? 1 : 0);
  +    m_nextLevelAmount = (DTM.NULL == nextNode)
  +                        ? 0 : (dtm.hasChildNodes(nextNode) ? 1 : 0);
   
   //    if(null != nextNode)
   //    {
  @@ -229,32 +232,33 @@
      * @return  The new node, or <code>null</code> if the current node has no
      *   next sibling in the TreeWalker's logical view.
      */
  -  public Node nextSibling()
  +  public int nextSibling()
     {
   
  -    if (m_root.equals(m_currentNode))
  -      return null;
  -
  -    Node next = m_currentNode.getNextSibling();
  +    if (m_root == m_currentNode)
  +      return DTM.NULL;
  +    
  +    DTM dtm = getDTM(m_root);
  +    int next = dtm.getNextSibling(m_currentNode);
       
  -    if ((null == next) || m_root.equals(next)
  +    if ((DTM.NULL == next) || m_root == next
               /* || isAncestorOfRootContext(next) */)
  -      return null;
  +      return DTM.NULL;
         
       if(isAncestorOfRootContext(next))
       {
  -      next = next.getFirstChild();
  +      next = dtm.getFirstChild(next);
         
  -      if ((null == next) || m_root.equals(next)
  +      if ((DTM.NULL == next) || (m_root == next)
                 /* || isAncestorOfRootContext(next) */)
  -        return null;
  +        return DTM.NULL;
       }
   
  -    m_nextLevelAmount = (null == next) ? 0 : (next.hasChildNodes() ? 1 : 0);
  +    m_nextLevelAmount = (DTM.NULL == next) ? 0 : (dtm.hasChildNodes(next) ? 1 : 0);
   
   //    if(null != next)
   //    {
  -//      Node attrNode = next.getAttributes().getNamedItem("id");
  +//      int attrNode = next.getAttributes().getNamedItem("id");
   //      if(null != attrNode)
   //        System.out.println("nextSibling: "+attrNode.getNodeValue());
   //      else
  @@ -267,7 +271,7 @@
     }
   
     /** The document owner node.  */
  -  transient Node m_doc;
  +  transient int m_doc;
   
     /**
      * Tell what's the maximum level this axes can descend to.
  
  
  
  1.3.2.1   +15 -13    xml-xalan/java/src/org/apache/xpath/axes/PredicatedNodeTest.java
  
  Index: PredicatedNodeTest.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/PredicatedNodeTest.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- PredicatedNodeTest.java	2001/01/02 03:47:15	1.3
  +++ PredicatedNodeTest.java	2001/04/10 18:45:18	1.3.2.1
  @@ -9,10 +9,12 @@
   
   import org.apache.xml.utils.PrefixResolver;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.traversal.NodeFilter;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.traversal.NodeFilter;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
  +import org.apache.xml.dtm.DTMFilter;
   
  -
   public abstract class PredicatedNodeTest extends NodeTest implements SubContextList
   {
   
  @@ -257,7 +259,7 @@
      *
      * @throws javax.xml.transform.TransformerException
      */
  -  boolean executePredicates(Node context, XPathContext xctxt)
  +  boolean executePredicates(int context, XPathContext xctxt)
             throws javax.xml.transform.TransformerException
     {
   
  @@ -350,18 +352,18 @@
      *
      * @return Informative string about the argument.
      */
  -  protected String nodeToString(Node n)
  +  protected String nodeToString(int n)
     {
  -
  +    DTM dtm = m_lpi.getXPathContext().getDTM(n);
       try
       {
  -      return (null != n)
  -             ? n.getNodeName() + "{" + ((org.apache.xalan.stree.Child) n).getUid() + "}"
  +      return (DTM.NULL != n)
  +             ? dtm.getNodeName(n) + "{" + n + "}"
                : "null";
       }
       catch (ClassCastException cce)
       {
  -      return (null != n) ? n.getNodeName() : "null";
  +      return (DTM.NULL != n) ? dtm.getNodeName(n) : "null";
       }
     }
     
  @@ -376,7 +378,7 @@
      * @return  a constant to determine whether the node is accepted,
      *   rejected, or skipped, as defined  above .
      */
  -  public short acceptNode(Node n)
  +  public short acceptNode(int n)
     {
   
       XPathContext xctxt = m_lpi.getXPathContext();
  @@ -395,10 +397,10 @@
             countProximityPosition(0);
   
             if (!executePredicates(n, xctxt))
  -            return NodeFilter.FILTER_SKIP;
  +            return DTMIterator.FILTER_SKIP;
           }
   
  -        return NodeFilter.FILTER_ACCEPT;
  +        return DTMIterator.FILTER_ACCEPT;
         }
       }
       catch (javax.xml.transform.TransformerException se)
  @@ -412,7 +414,7 @@
         xctxt.popCurrentNode();
       }
   
  -    return NodeFilter.FILTER_SKIP;
  +    return DTMIterator.FILTER_SKIP;
     }
   
     
  
  
  
  1.6.2.1   +17 -15    xml-xalan/java/src/org/apache/xpath/axes/ReverseAxesWalker.java
  
  Index: ReverseAxesWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/ReverseAxesWalker.java,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- ReverseAxesWalker.java	2000/12/27 22:24:11	1.6
  +++ ReverseAxesWalker.java	2001/04/10 18:45:18	1.6.2.1
  @@ -66,8 +66,10 @@
   
   import javax.xml.transform.TransformerException;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.traversal.NodeFilter;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.traversal.NodeFilter;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
   
   /**
    * Walker for a reverse axes.
  @@ -96,15 +98,15 @@
       return true;
     }
   
  -  /**
  -   *  Set the root node of the TreeWalker.
  -   *
  -   * @param root The context node of this step.
  -   */
  -  public void setRoot(Node root)
  -  {
  -    super.setRoot(root);
  -  }
  +//  /**
  +//   *  Set the root node of the TreeWalker.
  +//   *
  +//   * @param root The context node of this step.
  +//   */
  +//  public void setRoot(int root)
  +//  {
  +//    super.setRoot(root);
  +//  }
   
     /**
      * Get the current sub-context position.  In order to do the
  @@ -143,9 +145,9 @@
   
           // Count 'em all
           int count = 1;
  -        Node next;
  +        int next;
   
  -        while (null != (next = clone.nextNode()))
  +        while (DTM.NULL != (next = clone.nextNode()))
           {
             count++;
           }
  @@ -206,9 +208,9 @@
   
         // Count 'em all
         // count = 1;
  -      Node next;
  +      int next;
   
  -      while (null != (next = clone.nextNode()))
  +      while (DTM.NULL != (next = clone.nextNode()))
         {
           count++;
         }
  
  
  
  1.6.2.1   +6 -5      xml-xalan/java/src/org/apache/xpath/axes/RootWalker.java
  
  Index: RootWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/RootWalker.java,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- RootWalker.java	2001/01/02 03:47:15	1.6
  +++ RootWalker.java	2001/04/10 18:45:18	1.6.2.1
  @@ -60,7 +60,8 @@
   import org.apache.xpath.XPath;
   import org.apache.xpath.XPathContext;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
  +import org.apache.xml.dtm.DTM;
   
   /**
    * Walker for the FROM_ROOT axes.
  @@ -89,7 +90,7 @@
      *
      * @param root The context node of this step.
      */
  -  public void setRoot(Node root)
  +  public void setRoot(int root)
     {      
   
       super.setRoot(root);
  @@ -104,7 +105,7 @@
      * @return  The new node, or <code>null</code> if the current node has no
      *   visible children in the TreeWalker's logical view.
      */
  -  public Node firstChild()
  +  public int firstChild()
     {
   
       // Follow rule about returning the first occuring in document order 
  @@ -113,12 +114,12 @@
       {
         m_processedRoot = true;
   
  -      Node n = m_lpi.getDOMHelper().getRootNode(m_currentNode);
  +      int n = getDTM(m_currentNode).getDocument();
   
         return setCurrentIfNotNull(n);
       }
   
  -    return null;
  +    return DTM.NULL;
     }
   
     /** True if the root node has been processed.   */
  
  
  
  1.2.2.1   +22 -16    xml-xalan/java/src/org/apache/xpath/axes/RootWalkerMultiStep.java
  
  Index: RootWalkerMultiStep.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/RootWalkerMultiStep.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- RootWalkerMultiStep.java	2001/01/02 03:47:15	1.2
  +++ RootWalkerMultiStep.java	2001/04/10 18:45:18	1.2.2.1
  @@ -56,8 +56,10 @@
    */
   package org.apache.xpath.axes;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.traversal.NodeFilter;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.traversal.NodeFilter;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
   
   import org.apache.xpath.patterns.NodeTestFilter;
   
  @@ -84,7 +86,7 @@
      *
      * @param root The context node of this step.
      */
  -  public void setRoot(Node root)
  +  public void setRoot(int root)
     {
   
       super.setRoot(root);
  @@ -97,42 +99,46 @@
      *
      * @return the next valid child node.
      */
  -  protected Node getNextNode()
  +  protected int getNextNode()
     {
   
       if (m_isFresh)
         m_isFresh = false;
   
  -    Node current = this.getCurrentNode();
  +    int current = this.getCurrentNode();
   
  -    if (current.isSupported(FEATURE_NODETESTFILTER, "1.0"))
  -      ((NodeTestFilter) current).setNodeTest(this);
  +    // %TBD%
  +//    if (current.isSupported(FEATURE_NODETESTFILTER, "1.0"))
  +//      ((NodeTestFilter) current).setNodeTest(this);
   
  -    Node next;
  +    int next;
   
       if (!m_processedRoot)
       {
         m_processedRoot = true;
  -      next = m_lpi.getDOMHelper().getRootNode(m_currentNode);
  +      
  +      next = getDTM(m_currentNode).getDocument();
       }
       else
  -      next = null;
  +      next = DTM.NULL;
   
  -    if (null != next)
  +    if (DTM.NULL != next)
       {
         m_currentNode = next;
   
         // doesn't seem like we need to do this!
  -      if (acceptNode(next) != NodeFilter.FILTER_ACCEPT)
  +      if (acceptNode(next) != DTMIterator.FILTER_ACCEPT)
         {
  -        next = null;
  +        next = DTM.NULL;
         }
   
  -      if (null == next)
  +      if (DTM.NULL == next)
  +      {
           m_currentNode = current;  // don't advance the current node.
  +        this.m_isDone = true;
  +      }
       }
  -
  -    if (null == next)
  +    else
         this.m_isDone = true;
   
       return next;
  
  
  
  1.5.2.1   +6 -5      xml-xalan/java/src/org/apache/xpath/axes/SelfWalker.java
  
  Index: SelfWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/SelfWalker.java,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- SelfWalker.java	2001/01/02 03:47:15	1.5
  +++ SelfWalker.java	2001/04/10 18:45:18	1.5.2.1
  @@ -60,7 +60,8 @@
   import org.apache.xpath.XPath;
   import org.apache.xpath.XPathContext;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
  +import org.apache.xml.dtm.DTM;
   
   /**
    * Walker for the 'self' axes.
  @@ -88,7 +89,7 @@
      *
      * @param root The context node of this step.
      */
  -  public void setRoot(Node root)
  +  public void setRoot(int root)
     {
   
       m_processedSelf = false;
  @@ -104,7 +105,7 @@
      * @return  The new node, or <code>null</code> if the current node has no
      *   visible children in the TreeWalker's logical view.
      */
  -  public Node firstChild()
  +  public int firstChild()
     {
   
       // Follow my made-up rule about returning the self node as a child.
  @@ -115,7 +116,7 @@
         return setCurrentIfNotNull(m_root);
       }
   
  -    return null;
  +    return DTM.NULL;
     }
   
     /** True if the self node has been processed.   */
  @@ -128,6 +129,6 @@
      */
     protected int getLevelMax()
     {
  -    return m_lpi.getDOMHelper().getLevel(m_root);
  +    return getDTM(m_root).getLevel(m_root);
     }
   }
  
  
  
  1.3.2.1   +8 -6      xml-xalan/java/src/org/apache/xpath/axes/SelfWalkerOneStep.java
  
  Index: SelfWalkerOneStep.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/SelfWalkerOneStep.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- SelfWalkerOneStep.java	2000/12/17 17:40:01	1.3
  +++ SelfWalkerOneStep.java	2001/04/10 18:45:19	1.3.2.1
  @@ -56,8 +56,10 @@
    */
   package org.apache.xpath.axes;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.traversal.NodeFilter;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.traversal.NodeFilter;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
   
   /**
    * <meta name="usage" content="advanced"/>
  @@ -84,21 +86,21 @@
      *
      * @return The self node or null.
      */
  -  public Node nextNode()
  +  public int nextNode()
     {
   
       if (m_isFresh)
       {
         m_isFresh = false;
   
  -      if (acceptNode(m_root) == NodeFilter.FILTER_ACCEPT)
  +      if (acceptNode(m_root) == DTMIterator.FILTER_ACCEPT)
           return m_root;
         else
  -        return null;
  +        return DTM.NULL;
       }
       else
       {
  -      return null;
  +      return DTM.NULL;
       }
     }
   }
  
  
  
  1.4.2.1   +2 -2      xml-xalan/java/src/org/apache/xpath/axes/SubContextList.java
  
  Index: SubContextList.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/SubContextList.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- SubContextList.java	2000/12/17 17:40:01	1.4
  +++ SubContextList.java	2001/04/10 18:45:19	1.4.2.1
  @@ -58,8 +58,8 @@
   
   import org.apache.xpath.XPathContext;
   
  -import org.w3c.dom.Node;
  -
  +//import org.w3c.dom.Node;
  + 
   /**
    * <meta name="usage" content="advanced"/>
    * A class that implements this interface is a sub context node list, meaning it
  
  
  
  1.15.2.1  +128 -42   xml-xalan/java/src/org/apache/xpath/axes/UnionPathIterator.java
  
  Index: UnionPathIterator.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/UnionPathIterator.java,v
  retrieving revision 1.15
  retrieving revision 1.15.2.1
  diff -u -r1.15 -r1.15.2.1
  --- UnionPathIterator.java	2001/01/12 15:54:55	1.15
  +++ UnionPathIterator.java	2001/04/10 18:45:19	1.15.2.1
  @@ -59,10 +59,14 @@
   import org.apache.xpath.compiler.OpCodes;
   
   // DOM Imports
  -import org.w3c.dom.traversal.NodeIterator;
  -import org.w3c.dom.Node;
  -import org.w3c.dom.DOMException;
  -import org.w3c.dom.traversal.NodeFilter;
  +//import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.DOMException;
  +//import org.w3c.dom.traversal.NodeFilter;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
  +import org.apache.xml.dtm.DTMFilter;
  +import org.apache.xml.dtm.DTMManager;
   
   // Xalan Imports
   import org.apache.xpath.NodeSet;
  @@ -77,14 +81,14 @@
   
   /**
    * <meta name="usage" content="advanced"/>
  - * This class extends NodeSet, which implements NodeIterator,
  + * This class extends NodeSet, which implements DTMIterator,
    * and fetches nodes one at a time in document order based on a XPath
    * <a href="http://www.w3.org/TR/xpath#NT-UnionExpr">UnionExpr</a>.
    * As each node is iterated via nextNode(), the node is also stored
    * in the NodeVector, so that previousNode() can easily be done.
    */
   public class UnionPathIterator extends Expression
  -        implements Cloneable, NodeIterator, ContextNodeList
  +        implements Cloneable, DTMIterator, java.io.Serializable
   {
   
     /**
  @@ -136,9 +140,9 @@
     public void detach()
     {
   
  -    this.m_context = null;
  +    this.m_context = DTM.NULL;
       this.m_execContext = null;
  -    this.m_context = null;
  +    this.m_context = DTM.NULL;
   
       int n = m_iterators.length;
   
  @@ -256,11 +260,8 @@
      * iterator backwards in the set.
      * @return  The previous <code>Node</code> in the set being iterated over,
      *   or<code>null</code> if there are no more members in that set.
  -   * @throws DOMException
  -   *    INVALID_STATE_ERR: Raised if this method is called after the
  -   *   <code>detach</code> method was invoked.
      */
  -  public Node previousNode() throws DOMException
  +  public int previousNode()
     {
   
       if (null == m_cachedNodes)
  @@ -273,16 +274,16 @@
     /**
      *  This attribute determines which node types are presented via the
      * iterator. The available set of constants is defined in the
  -   * <code>NodeFilter</code> interface.
  +   * <code>DTMFilter</code> interface.
      *
  -   * @return A bit set that tells what node types to show (NodeFilter.SHOW_ALL at 
  +   * @return A bit set that tells what node types to show (DTMFilter.SHOW_ALL at 
      * the iterator level).
      */
     public int getWhatToShow()
     {
   
       // TODO: ??
  -    return NodeFilter.SHOW_ALL & ~NodeFilter.SHOW_ENTITY_REFERENCE;
  +    return DTMFilter.SHOW_ALL & ~DTMFilter.SHOW_ENTITY_REFERENCE;
     }
   
     /**
  @@ -290,7 +291,7 @@
      *
      * @return null.
      */
  -  public NodeFilter getFilter()
  +  public DTMFilter getFilter()
     {
       return null;
     }
  @@ -300,7 +301,7 @@
      *
      * @return The context node of this iterator.
      */
  -  public Node getRoot()
  +  public int getRoot()
     {
       return m_context;
     }
  @@ -379,11 +380,11 @@
      * Get a cloned Iterator that is reset to the beginning 
      * of the query.
      *
  -   * @return A cloned NodeIterator set of the start of the query.
  +   * @return A cloned DTMIterator set of the start of the query.
      *
      * @throws CloneNotSupportedException
      */
  -  public NodeIterator cloneWithReset() throws CloneNotSupportedException
  +  public DTMIterator cloneWithReset() throws CloneNotSupportedException
     {
   
       UnionPathIterator clone = (UnionPathIterator) clone();
  @@ -427,7 +428,7 @@
       m_foundLast = false;
       m_next = 0;
       m_last = 0;
  -    m_lastFetched = null;
  +    m_lastFetched = DTM.NULL;
   
       int n = m_iterators.length;
   
  @@ -514,19 +515,16 @@
     }
   
     /** The last node that was fetched, usually by nextNode. */
  -  transient Node m_lastFetched;
  +  transient int m_lastFetched;
   
     /**
      *  Returns the next node in the set and advances the position of the
  -   * iterator in the set. After a NodeIterator is created, the first call
  +   * iterator in the set. After a DTMIterator is created, the first call
      * to nextNode() returns the first node in the set.
      * @return  The next <code>Node</code> in the set being iterated over, or
      *   <code>null</code> if there are no more members in that set.
  -   * @throws DOMException
  -   *    INVALID_STATE_ERR: Raised if this method is called after the
  -   *   <code>detach</code> method was invoked.
      */
  -  public Node nextNode() throws DOMException
  +  public int nextNode()
     {
   
       // If the cache is on, and the node has already been found, then 
  @@ -538,11 +536,11 @@
       }
   
       if (m_foundLast)
  -      return null;
  +      return DTM.NULL;
   
       // Loop through the iterators getting the current fetched 
       // node, and get the earliest occuring in document order
  -    Node earliestNode = null;
  +    int earliestNode = DTM.NULL;
   
       if (null != m_iterators)
       {
  @@ -551,18 +549,18 @@
   
         for (int i = 0; i < n; i++)
         {
  -        Node node = m_iterators[i].getCurrentNode();
  +        int node = m_iterators[i].getCurrentNode();
   
  -        if (null == node)
  +        if (DTM.NULL == node)
             continue;
  -        else if (null == earliestNode)
  +        else if (DTM.NULL == earliestNode)
           {
             iteratorUsed = i;
             earliestNode = node;
           }
           else
           {
  -          if (node.equals(earliestNode))
  +          if (node == earliestNode)
             {
   
               // Found a duplicate, so skip past it.
  @@ -570,9 +568,9 @@
             }
             else
             {
  -            DOMHelper dh = m_execContext.getDOMHelper();
  +            DTM dtm = getDTM(node);
   
  -            if (dh.isNodeAfter(node, earliestNode))
  +            if (dtm.isNodeAfter(node, earliestNode))
               {
                 iteratorUsed = i;
                 earliestNode = node;
  @@ -581,7 +579,7 @@
           }
         }
   
  -      if (null != earliestNode)
  +      if (DTM.NULL != earliestNode)
         {
           m_iterators[iteratorUsed].nextNode();
   
  @@ -614,9 +612,9 @@
       if (m_foundLast || ((index >= 0) && (index <= m_next)))
         return;
   
  -    Node n;
  +    int n;
   
  -    while (null == (n = nextNode()))
  +    while (DTM.NULL == (n = nextNode()))
       {
         if (m_next >= index)
           break;
  @@ -636,13 +634,87 @@
     {
       return m_next;
     }
  +  
  +  /**
  +   *  The number of nodes in the list. The range of valid child node indices
  +   * is 0 to <code>length-1</code> inclusive.
  +   *
  +   * @return The number of nodes in the list, always greater or equal to zero.
  +   */
  +  public int getLength()
  +  {
   
  +    // %TBD%
  +    return 0;
  +//    resetToCachedList();
  +//
  +//    return m_cachedNodes.getLength();
  +  }
  +
  +  /**
  +   *  Returns the <code>index</code> th item in the collection. If
  +   * <code>index</code> is greater than or equal to the number of nodes in
  +   * the list, this returns <code>null</code> .
  +   * @param index  Index into the collection.
  +   * @return  The node at the <code>index</code> th position in the
  +   *   <code>NodeList</code> , or <code>null</code> if that is not a valid
  +   *   index.
  +   */
  +  public int item(int index)
  +  {
  +    // %TBD%
  +    return DTM.NULL;
  +//    resetToCachedList();
  +//
  +//    return m_cachedNodes.item(index);
  +  }
  +  
  +  /**
  +   * Set the current context node for this iterator.
  +   *
  +   * @param n Must be a non-null reference to the node context.
  +   */
  +  public final void setRoot(int n)
  +  {
  +    m_context = n;
  +  }
  +  
     /**
  +   * Set the environment in which this iterator operates, which should provide:
  +   * a node (the context node... same value as "root" defined below) 
  +   * a pair of non-zero positive integers (the context position and the context size) 
  +   * a set of variable bindings 
  +   * a function library 
  +   * the set of namespace declarations in scope for the expression.
  +   * 
  +   * <p>At this time the exact implementation of this environment is application 
  +   * dependent.  Probably a proper interface will be created fairly soon.</p>
  +   * 
  +   * @param environment The environment object.
  +   */
  +  public void setEnvironment(Object environment)
  +  {
  +    // %TBD% ?
  +  }
  +  
  +  /**
  +   * Get an instance of the DTMManager.  Since a node 
  +   * iterator may be passed without a DTMManager, this allows the 
  +   * caller to easily get the DTMManager using just the iterator.
  +   *
  +   * @return a non-null DTMManager reference.
  +   */
  +  public DTMManager getDTMManager()
  +  {
  +    return m_execContext.getDTMManager();
  +  }
  +  
  +  /**
      * Return the last fetched node.
      *
      * @return The last fetched node, or null if the last fetch was null.
      */
  -  public Node getCurrentNode()
  +  public int getCurrentNode()
     {
       return m_lastFetched;
     }
  @@ -660,21 +732,35 @@
     /**
      * The node context for the expression.
      */
  -  transient protected Node m_context;
  +  transient protected int m_context;
   
     /**
      * The node context from where the Location Path is being
      * executed from (i.e. for current() support).
      */
  -  transient protected Node m_currentContextNode;
  -
  +  transient protected int m_currentContextNode;
  +  
  +  /**
  +   * Get an instance of a DTM that "owns" a node handle.  Since a node 
  +   * iterator may be passed without a DTMManager, this allows the 
  +   * caller to easily get the DTM using just the iterator.
  +   *
  +   * @param nodeHandle the nodeHandle.
  +   *
  +   * @return a non-null DTM reference.
  +   */
  +  public DTM getDTM(int nodeHandle)
  +  {
  +    return m_execContext.getDTM(nodeHandle);
  +  }
  +  
     /**
      * The node context from where the expression is being
      * executed from (i.e. for current() support).
      *
      * @return The top-level node context of the entire expression.
      */
  -  public Node getCurrentContextNode()
  +  public int getCurrentContextNode()
     {
       return m_currentContextNode;
     }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.3.2.1   +1 -1      xml-xalan/java/src/org/apache/xpath/functions/FuncBoolean.java
  
  Index: FuncBoolean.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncBoolean.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- FuncBoolean.java	2000/11/13 16:27:33	1.3
  +++ FuncBoolean.java	2001/04/10 18:45:27	1.3.2.1
  @@ -56,7 +56,7 @@
    */
   package org.apache.xpath.functions;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
   
   import java.util.Vector;
   
  
  
  
  1.3.2.1   +1 -1      xml-xalan/java/src/org/apache/xpath/functions/FuncCeiling.java
  
  Index: FuncCeiling.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncCeiling.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- FuncCeiling.java	2000/11/13 16:27:33	1.3
  +++ FuncCeiling.java	2001/04/10 18:45:27	1.3.2.1
  @@ -58,7 +58,7 @@
   
   import java.lang.Math;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
   
   import java.util.Vector;
   
  
  
  
  1.4.2.1   +1 -1      xml-xalan/java/src/org/apache/xpath/functions/FuncConcat.java
  
  Index: FuncConcat.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncConcat.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- FuncConcat.java	2000/12/16 20:01:53	1.4
  +++ FuncConcat.java	2001/04/10 18:45:27	1.4.2.1
  @@ -56,7 +56,7 @@
    */
   package org.apache.xpath.functions;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
   
   import java.util.Vector;
   
  
  
  
  1.3.2.1   +1 -1      xml-xalan/java/src/org/apache/xpath/functions/FuncContains.java
  
  Index: FuncContains.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncContains.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- FuncContains.java	2000/11/13 16:27:33	1.3
  +++ FuncContains.java	2001/04/10 18:45:27	1.3.2.1
  @@ -56,7 +56,7 @@
    */
   package org.apache.xpath.functions;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
   
   import java.util.Vector;
   
  
  
  
  1.4.2.1   +6 -4      xml-xalan/java/src/org/apache/xpath/functions/FuncCount.java
  
  Index: FuncCount.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncCount.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- FuncCount.java	2000/11/16 20:04:51	1.4
  +++ FuncCount.java	2001/04/10 18:45:28	1.4.2.1
  @@ -58,8 +58,10 @@
   
   import org.apache.xpath.res.XPATHErrorResources;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.traversal.NodeIterator;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
   
   import java.util.Vector;
   
  @@ -87,13 +89,13 @@
     public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
     {
   
  -    NodeIterator nl = m_arg0.execute(xctxt).nodeset();
  +    DTMIterator nl = m_arg0.execute(xctxt).nodeset();
   
       // We should probably make a function on the iterator for this, 
       // as a given implementation could optimize.
       int i = 0;
   
  -    while (null != nl.nextNode())
  +    while (DTM.NULL != nl.nextNode())
       {
         i++;
       }
  
  
  
  1.5.2.1   +22 -19    xml-xalan/java/src/org/apache/xpath/functions/FuncCurrent.java
  
  Index: FuncCurrent.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncCurrent.java,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- FuncCurrent.java	2000/12/18 08:50:13	1.5
  +++ FuncCurrent.java	2001/04/10 18:45:28	1.5.2.1
  @@ -58,8 +58,10 @@
   
   import org.apache.xpath.res.XPATHErrorResources;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.traversal.NodeIterator;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
   
   import java.util.Vector;
   
  @@ -78,20 +80,20 @@
   public class FuncCurrent extends Function
   {
   
  -  /**
  -   * Diagnostics to show string output from a node.
  -   *
  -   * @param n The input node, which may be null.
  -   *
  -   * @return A diagnostics string representing the node.
  -   */
  -  protected String nodeToString(Node n)
  -  {
  -
  -    return (null != n)
  -           ? n.getNodeName() + "{" + ((org.apache.xalan.stree.Child) n).getUid() + "}"
  -           : "null";
  -  }
  +//  /**
  +//   * Diagnostics to show string output from a node.
  +//   *
  +//   * @param n The input node, which may be null.
  +//   *
  +//   * @return A diagnostics string representing the node.
  +//   */
  +//  protected String nodeToString(int n)
  +//  {
  +//
  +//    return (null != n)
  +//           ? n.getNodeName() + "{" + ((org.apache.xalan.stree.Child) n).getUid() + "}"
  +//           : "null";
  +//  }
   
     /**
      * Execute the function.  The function must return
  @@ -106,7 +108,7 @@
   
       // If we're in a predicate, then this will return non-null.
       PredicatedNodeTest iter = (PredicatedNodeTest) xctxt.getSubContextList();
  -    Node currentNode;
  +    int currentNode;
   
       if (null != iter)
       {
  @@ -116,14 +118,15 @@
       }
       else
       {
  -      ContextNodeList cnl = xctxt.getContextNodeList();
  +      DTMIterator cnl = xctxt.getContextNodeList();
   
         if (null != cnl)
         {
  +        // %REVIEW% Not so certain that this is doing the right thing?
           currentNode = cnl.getCurrentNode();
         }
         else
  -        currentNode = null;
  +        currentNode = DTM.NULL;
       }
   
       return new XNodeSet(currentNode);
  
  
  
  1.3.2.1   +16 -12    xml-xalan/java/src/org/apache/xpath/functions/FuncDoclocation.java
  
  Index: FuncDoclocation.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncDoclocation.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- FuncDoclocation.java	2000/11/13 16:27:33	1.3
  +++ FuncDoclocation.java	2001/04/10 18:45:28	1.3.2.1
  @@ -56,9 +56,10 @@
    */
   package org.apache.xpath.functions;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.traversal.NodeIterator;
  -import org.w3c.dom.Document;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.traversal.NodeIterator;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
   
   import java.util.Vector;
   
  @@ -86,21 +87,24 @@
     public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
     {
   
  -    Node whereNode = getArg0AsNode(xctxt);
  +    int whereNode = getArg0AsNode(xctxt);
       String fileLocation = null;
   
  -    if (null != whereNode)
  +    if (DTM.NULL != whereNode)
       {
  -      if (Node.DOCUMENT_FRAGMENT_NODE == whereNode.getNodeType())
  +      DTM dtm = xctxt.getDTM(whereNode);
  +      
  +      // %REVIEW%
  +      if (DTM.DOCUMENT_FRAGMENT_NODE ==  dtm.getNodeType(whereNode))
         {
  -        whereNode = whereNode.getFirstChild();
  +        whereNode = dtm.getFirstChild(whereNode);
         }
   
  -      if (null != whereNode)
  -      {
  -        Document owner = whereNode.getOwnerDocument();
  -
  -        fileLocation = xctxt.getSourceTreeManager().findURIFromDoc(owner);
  +      if (DTM.NULL != whereNode)
  +      {        
  +        fileLocation = dtm.getDocumentBaseURI(whereNode);
  +//        int owner = dtm.getDocument();
  +//        fileLocation = xctxt.getSourceTreeManager().findURIFromDoc(owner);
         }
       }
   
  
  
  
  1.6.2.1   +1 -1      xml-xalan/java/src/org/apache/xpath/functions/FuncExtElementAvailable.java
  
  Index: FuncExtElementAvailable.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncExtElementAvailable.java,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- FuncExtElementAvailable.java	2000/12/18 14:08:43	1.6
  +++ FuncExtElementAvailable.java	2001/04/10 18:45:28	1.6.2.1
  @@ -62,7 +62,7 @@
   import org.apache.xalan.templates.Constants;
   import org.apache.xalan.transformer.TransformerImpl;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
   
   import java.util.Vector;
   
  
  
  
  1.7.2.1   +18 -15    xml-xalan/java/src/org/apache/xpath/functions/FuncExtFunction.java
  
  Index: FuncExtFunction.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncExtFunction.java,v
  retrieving revision 1.7
  retrieving revision 1.7.2.1
  diff -u -r1.7 -r1.7.2.1
  --- FuncExtFunction.java	2001/01/02 03:47:16	1.7
  +++ FuncExtFunction.java	2001/04/10 18:45:29	1.7.2.1
  @@ -63,7 +63,7 @@
   import org.apache.xpath.objects.*;
   import org.apache.xalan.extensions.ExtensionsTable;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
   import org.w3c.dom.DocumentFragment;
   import org.w3c.dom.traversal.NodeIterator;
   
  @@ -138,8 +138,10 @@
       }
   
       ExtensionsTable etable = xctxt.getExtensionsTable();
  -    Object val = etable.extFunction(m_namespace, m_extensionName, argVec,
  -                                    m_methodKey, xctxt);
  +    // %TBD% Not sure why this won't compile
  +    Object val = null;
  +//    Object val = etable.extFunction(m_namespace, m_extensionName, argVec,
  +//                                    m_methodKey, xctxt);
   
       if (null != val)
       {
  @@ -168,18 +170,19 @@
         {
           result = new XNumber(((Double) val).doubleValue());
         }
  -      else if (val instanceof DocumentFragment)
  -      {
  -        result = new XRTreeFrag((DocumentFragment) val);
  -      }
  -      else if (val instanceof NodeIterator)
  -      {
  -        result = new XNodeSet((NodeIterator) val);
  -      }
  -      else if (val instanceof Node)
  -      {
  -        result = new XNodeSet((Node) val);
  -      }
  +      // %TBD%
  +//      else if (val instanceof DocumentFragment)
  +//      {
  +//        result = new XRTreeFrag((DocumentFragment) val);
  +//      }
  +//      else if (val instanceof NodeIterator)
  +//      {
  +//        result = new XNodeSet((NodeIterator) val);
  +//      }
  +//      else if (val instanceof Node)
  +//      {
  +//        result = new XNodeSet((Node) val);
  +//      }
         else
         {
           result = new XObject(val);
  
  
  
  1.5.2.1   +1 -1      xml-xalan/java/src/org/apache/xpath/functions/FuncExtFunctionAvailable.java
  
  Index: FuncExtFunctionAvailable.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncExtFunctionAvailable.java,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- FuncExtFunctionAvailable.java	2000/11/28 18:14:24	1.5
  +++ FuncExtFunctionAvailable.java	2001/04/10 18:45:29	1.5.2.1
  @@ -60,7 +60,7 @@
   import org.apache.xalan.templates.Constants;
   import org.apache.xalan.extensions.ExtensionsTable;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
   
   import java.util.Vector;
   
  
  
  
  1.3.2.1   +1 -1      xml-xalan/java/src/org/apache/xpath/functions/FuncFalse.java
  
  Index: FuncFalse.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncFalse.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- FuncFalse.java	2000/11/13 16:27:33	1.3
  +++ FuncFalse.java	2001/04/10 18:45:29	1.3.2.1
  @@ -56,7 +56,7 @@
    */
   package org.apache.xpath.functions;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
   
   import java.util.Vector;
   
  
  
  
  1.3.2.1   +1 -1      xml-xalan/java/src/org/apache/xpath/functions/FuncFloor.java
  
  Index: FuncFloor.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncFloor.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- FuncFloor.java	2000/11/13 16:27:33	1.3
  +++ FuncFloor.java	2001/04/10 18:45:29	1.3.2.1
  @@ -56,7 +56,7 @@
    */
   package org.apache.xpath.functions;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
   
   import java.util.Vector;
   
  
  
  
  1.4.2.1   +6 -5      xml-xalan/java/src/org/apache/xpath/functions/FuncGenerateId.java
  
  Index: FuncGenerateId.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncGenerateId.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- FuncGenerateId.java	2000/11/13 16:27:33	1.4
  +++ FuncGenerateId.java	2001/04/10 18:45:29	1.4.2.1
  @@ -56,8 +56,9 @@
    */
   package org.apache.xpath.functions;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.traversal.NodeIterator;
  +import org.apache.xml.dtm.DTM;
   
   import java.util.Vector;
   
  @@ -84,10 +85,10 @@
     public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
     {
   
  -    Node which = getArg0AsNode(xctxt);
  +    int which = getArg0AsNode(xctxt);
   
  -    if (null != which)
  -      return new XString(xctxt.getDOMHelper().getUniqueID(which));
  +    if (DTM.NULL != which)
  +      return new XString(String.valueOf(which));
       else
         return XString.EMPTYSTRING;
     }
  
  
  
  1.6.2.1   +19 -16    xml-xalan/java/src/org/apache/xpath/functions/FuncId.java
  
  Index: FuncId.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncId.java,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- FuncId.java	2000/12/16 20:01:53	1.6
  +++ FuncId.java	2001/04/10 18:45:30	1.6.2.1
  @@ -61,9 +61,10 @@
   
   import org.apache.xpath.res.XPATHErrorResources;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.traversal.NodeIterator;
  -import org.w3c.dom.Document;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.traversal.NodeIterator;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
   
   import java.util.Vector;
   
  @@ -95,7 +96,7 @@
      *
      * @return The usedrefs value.
      */
  -  private StringVector getNodesByID(XPathContext xctxt, Document docContext,
  +  private StringVector getNodesByID(XPathContext xctxt, int docContext,
                                       String refval, StringVector usedrefs,
                                       NodeSet nodeSet, boolean mayBeMore)
     {
  @@ -103,9 +104,10 @@
       if (null != refval)
       {
         String ref = null;
  -      DOMHelper dh = xctxt.getDOMHelper();
  +//      DOMHelper dh = xctxt.getDOMHelper();
         StringTokenizer tokenizer = new StringTokenizer(refval);
         boolean hasMore = tokenizer.hasMoreTokens();
  +      DTM dtm = xctxt.getDTM(docContext);
   
         while (hasMore)
         {
  @@ -119,9 +121,9 @@
             continue;
           }
   
  -        Node node = dh.getElementByID(ref, docContext);
  +        int node = dtm.getElementById(ref);
   
  -        if (null != node)
  +        if (DTM.NULL != node)
             nodeSet.addNodeInDocOrder(node, xctxt);
   
           if ((null != ref) && (hasMore || mayBeMore))
  @@ -148,11 +150,11 @@
     public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
     {
   
  -    Node context = xctxt.getCurrentNode();
  -    Document docContext = (Node.DOCUMENT_NODE == context.getNodeType())
  -                          ? (Document) context : context.getOwnerDocument();
  +    int context = xctxt.getCurrentNode();
  +    DTM dtm = xctxt.getDTM(context);
  +    int docContext = dtm.getDocument();
   
  -    if (null == docContext)
  +    if (DTM.NULL == docContext)
         error(xctxt, XPATHErrorResources.ER_CONTEXT_HAS_NO_OWNERDOC, null);
   
       XObject arg = m_arg0.execute(xctxt);
  @@ -162,17 +164,18 @@
   
       if (XObject.CLASS_NODESET == argType)
       {
  -      NodeIterator ni = arg.nodeset();
  +      DTMIterator ni = arg.nodeset();
         StringVector usedrefs = null;
  -      Node pos = ni.nextNode();
  +      int pos = ni.nextNode();
   
  -      while (null != pos)
  +      while (DTM.NULL != pos)
         {
  -        String refval = DOMHelper.getNodeData(pos);
  +        DTM ndtm = ni.getDTM(pos);
  +        String refval = ndtm.getStringValue(pos);
   
           pos = ni.nextNode();
           usedrefs = getNodesByID(xctxt, docContext, refval, usedrefs, nodeSet,
  -                                null != pos);
  +                                DTM.NULL != pos);
         }
         // ni.detach();
       }
  
  
  
  1.3.2.1   +12 -8     xml-xalan/java/src/org/apache/xpath/functions/FuncLang.java
  
  Index: FuncLang.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncLang.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- FuncLang.java	2000/11/13 16:27:33	1.3
  +++ FuncLang.java	2001/04/10 18:45:30	1.3.2.1
  @@ -56,8 +56,10 @@
    */
   package org.apache.xpath.functions;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.Element;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.Element;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
   
   import java.util.Vector;
   
  @@ -85,17 +87,19 @@
     {
   
       String lang = m_arg0.execute(xctxt).str();
  -    Node parent = xctxt.getCurrentNode();
  +    int parent = xctxt.getCurrentNode();
       boolean isLang = false;
  +    DTM dtm = xctxt.getDTM(parent);
   
  -    while (null != parent)
  +    while (DTM.NULL != parent)
       {
  -      if (Node.ELEMENT_NODE == parent.getNodeType())
  +      if (DTM.ELEMENT_NODE == dtm.getNodeType(parent))
         {
  -        String langVal = ((Element) parent).getAttribute("xml:lang");
  +        int langAttr = dtm.getAttributeNode("http://www.w3.org/XML/1998/namespace", "lang");
   
  -        if ((null != langVal) && (langVal.length() > 0))
  +        if (DTM.NULL != langAttr)
           {
  +          String langVal = dtm.getStringValue(langAttr);
             if (langVal.toLowerCase().startsWith(lang.toLowerCase()))
             {
               int valLen = lang.length();
  @@ -111,7 +115,7 @@
           }
         }
   
  -      parent = xctxt.getDOMHelper().getParentOfNode(parent);
  +      parent = dtm.getParent(parent);
       }
   
       return isLang ? XBoolean.S_TRUE : XBoolean.S_FALSE;
  
  
  
  1.6.2.1   +14 -8     xml-xalan/java/src/org/apache/xpath/functions/FuncLast.java
  
  Index: FuncLast.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncLast.java,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- FuncLast.java	2000/12/18 08:49:14	1.6
  +++ FuncLast.java	2001/04/10 18:45:30	1.6.2.1
  @@ -56,8 +56,10 @@
    */
   package org.apache.xpath.functions;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.Element;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
   
   import java.util.Vector;
   
  @@ -97,22 +99,26 @@
       if (null != iter)
         return iter.getLastPos(xctxt);
   
  -    ContextNodeList cnl = xctxt.getContextNodeList();
  +    DTMIterator cnl = xctxt.getContextNodeList();
   
  -    if (cnl.size() == 0)
  +    // %TBD%
  +//    if (cnl.size() == 0)
       {
         try
         {
  -        NodeIterator ni = (NodeIterator)cnl.clone();
  +        DTMIterator ni = (DTMIterator)cnl.clone();
           int count = cnl.getCurrentPos();
  -        while(null != ni.nextNode())
  +        while(DTM.NULL != ni.nextNode())
             count++;
  -        cnl.setLast(count);
  +        // %TBD%
  +//        cnl.setLast(count);
           return count;
         }
         catch(CloneNotSupportedException cnse){}
       }
  -    return cnl.size();
  +    // %REVIEW%
  +    return cnl.getLength();
  +//    return cnl.size();
   
       /*
       // The code below has massive problem if inside of a predicate.  -sb
  
  
  
  1.5.2.1   +7 -7      xml-xalan/java/src/org/apache/xpath/functions/FuncLocalPart.java
  
  Index: FuncLocalPart.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncLocalPart.java,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- FuncLocalPart.java	2000/12/02 00:27:32	1.5
  +++ FuncLocalPart.java	2001/04/10 18:45:30	1.5.2.1
  @@ -58,8 +58,10 @@
   
   import org.apache.xpath.res.XPATHErrorResources;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.traversal.NodeIterator;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
   
   import java.util.Vector;
   
  @@ -86,11 +88,9 @@
     public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
     {
   
  -    Node context = getArg0AsNode(xctxt);
  -    
  -    String s = (context != null)
  -                       ? xctxt.getDOMHelper().getLocalNameOfNode(context)
  -                       : "";
  +    int context = getArg0AsNode(xctxt);
  +    DTM dtm = xctxt.getDTM(context);
  +    String s = (context != DTM.NULL) ? dtm.getLocalName(context) : "";
       if(s.startsWith("#") || s.equals("xmlns"))
         s = "";
   
  
  
  
  1.5.2.1   +13 -10    xml-xalan/java/src/org/apache/xpath/functions/FuncNamespace.java
  
  Index: FuncNamespace.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncNamespace.java,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- FuncNamespace.java	2000/11/27 18:21:53	1.5
  +++ FuncNamespace.java	2001/04/10 18:45:30	1.5.2.1
  @@ -58,8 +58,10 @@
   
   import org.apache.xpath.res.XPATHErrorResources;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.traversal.NodeIterator;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
   
   import java.util.Vector;
   
  @@ -86,27 +88,28 @@
     public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
     {
   
  -    Node context = getArg0AsNode(xctxt);
  +    int context = getArg0AsNode(xctxt);
       
       String s;
  -    if(context != null)
  +    if(context != DTM.NULL)
       {
  -      int t = context.getNodeType();
  -      if(t == Node.ELEMENT_NODE)
  +      DTM dtm = xctxt.getDTM(context);
  +      int t = dtm.getNodeType(context);
  +      if(t == DTM.ELEMENT_NODE)
         {
  -        s = xctxt.getDOMHelper().getNamespaceOfNode(context);
  +        s = dtm.getNamespaceURI(context);
         }
  -      else if(t == Node.ATTRIBUTE_NODE)
  +      else if(t == DTM.ATTRIBUTE_NODE)
         {
   
           // This function always returns an empty string for namespace nodes.
           // We check for those here.  Fix inspired by Davanum Srinivas.
   
  -        s = context.getNodeName();
  +        s = dtm.getNodeName(context);
           if(s.startsWith("xmlns:") || s.equals("xmlns"))
             return XString.EMPTYSTRING;
   
  -        s = xctxt.getDOMHelper().getNamespaceOfNode(context);
  +        s = dtm.getNamespaceURI(context);
         }
         else
           return XString.EMPTYSTRING;
  
  
  
  1.6.2.1   +1 -1      xml-xalan/java/src/org/apache/xpath/functions/FuncNormalizeSpace.java
  
  Index: FuncNormalizeSpace.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncNormalizeSpace.java,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- FuncNormalizeSpace.java	2000/12/16 20:01:54	1.6
  +++ FuncNormalizeSpace.java	2001/04/10 18:45:30	1.6.2.1
  @@ -58,7 +58,7 @@
   
   import org.apache.xpath.res.XPATHErrorResources;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
   
   import java.util.Vector;
   
  
  
  
  1.3.2.1   +1 -1      xml-xalan/java/src/org/apache/xpath/functions/FuncNot.java
  
  Index: FuncNot.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncNot.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- FuncNot.java	2000/11/13 16:27:35	1.3
  +++ FuncNot.java	2001/04/10 18:45:31	1.3.2.1
  @@ -56,7 +56,7 @@
    */
   package org.apache.xpath.functions;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
   
   import java.util.Vector;
   
  
  
  
  1.3.2.1   +1 -1      xml-xalan/java/src/org/apache/xpath/functions/FuncNumber.java
  
  Index: FuncNumber.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncNumber.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- FuncNumber.java	2000/11/13 16:27:35	1.3
  +++ FuncNumber.java	2001/04/10 18:45:31	1.3.2.1
  @@ -58,7 +58,7 @@
   
   import org.apache.xpath.res.XPATHErrorResources;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
   
   import java.util.Vector;
   
  
  
  
  1.4.2.1   +5 -3      xml-xalan/java/src/org/apache/xpath/functions/FuncPosition.java
  
  Index: FuncPosition.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncPosition.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- FuncPosition.java	2000/12/16 20:01:54	1.4
  +++ FuncPosition.java	2001/04/10 18:45:31	1.4.2.1
  @@ -56,8 +56,10 @@
    */
   package org.apache.xpath.functions;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.traversal.NodeIterator;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
   
   import java.util.Vector;
   
  @@ -99,7 +101,7 @@
         return prox;
       }
   
  -    ContextNodeList cnl = (ContextNodeList) xctxt.getContextNodeList();
  +    DTMIterator cnl = xctxt.getContextNodeList();
   
       if (null != cnl)
       {
  
  
  
  1.4.2.1   +10 -35    xml-xalan/java/src/org/apache/xpath/functions/FuncQname.java
  
  Index: FuncQname.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncQname.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- FuncQname.java	2000/11/23 04:59:12	1.4
  +++ FuncQname.java	2001/04/10 18:45:31	1.4.2.1
  @@ -58,9 +58,11 @@
   
   import org.apache.xpath.res.XPATHErrorResources;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.traversal.NodeIterator;
  -import org.w3c.dom.Attr;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.Attr;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
   
   import java.util.Vector;
   
  @@ -88,41 +90,14 @@
     public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
     {
   
  -    Node context = getArg0AsNode(xctxt);
  +    int context = getArg0AsNode(xctxt);
       XObject val;
   
  -    if (null != context)
  +    if (DTM.NULL != context)
       {
  -      short ntype = context.getNodeType();
  -
  -      if (ntype == Node.ATTRIBUTE_NODE)
  -      {
  -        String qname = ((Attr) context).getName();
  -
  -        if (xctxt.getDOMHelper().isNamespaceNode(context))
  -        {
  -          if (qname.equals("xmlns"))
  -            val = XString.EMPTYSTRING;
  -          else
  -          {
  -            qname = QName.getLocalPart(qname);
  -            val = (null == qname) ? XString.EMPTYSTRING : new XString(qname);
  -          }
  -        }
  -        else
  -          val = new XString(qname);
  -      }
  -      else if ((ntype == Node.ELEMENT_NODE)
  -               || (ntype == Node.PROCESSING_INSTRUCTION_NODE))
  -      {
  -        String qname = context.getNodeName();
  -
  -        val = new XString(qname);
  -      }
  -      else
  -      {
  -        val = XString.EMPTYSTRING;
  -      }
  +      DTM dtm = xctxt.getDTM(context);
  +      String qname = dtm.getNodeNameX(context);
  +      val = (null == qname) ? XString.EMPTYSTRING : new XString(qname);
       }
       else
       {
  
  
  
  1.4.2.1   +1 -1      xml-xalan/java/src/org/apache/xpath/functions/FuncRound.java
  
  Index: FuncRound.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncRound.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- FuncRound.java	2000/12/16 20:01:54	1.4
  +++ FuncRound.java	2001/04/10 18:45:32	1.4.2.1
  @@ -56,7 +56,7 @@
    */
   package org.apache.xpath.functions;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
   
   import java.util.Vector;
   
  
  
  
  1.3.2.1   +1 -1      xml-xalan/java/src/org/apache/xpath/functions/FuncStartsWith.java
  
  Index: FuncStartsWith.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncStartsWith.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- FuncStartsWith.java	2000/11/13 16:27:35	1.3
  +++ FuncStartsWith.java	2001/04/10 18:45:32	1.3.2.1
  @@ -56,7 +56,7 @@
    */
   package org.apache.xpath.functions;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
   
   import java.util.Vector;
   
  
  
  
  1.3.2.1   +1 -1      xml-xalan/java/src/org/apache/xpath/functions/FuncString.java
  
  Index: FuncString.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncString.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- FuncString.java	2000/11/13 16:27:35	1.3
  +++ FuncString.java	2001/04/10 18:45:32	1.3.2.1
  @@ -58,7 +58,7 @@
   
   import org.apache.xpath.res.XPATHErrorResources;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
   
   import java.util.Vector;
   
  
  
  
  1.3.2.1   +1 -1      xml-xalan/java/src/org/apache/xpath/functions/FuncStringLength.java
  
  Index: FuncStringLength.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncStringLength.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- FuncStringLength.java	2000/11/13 16:27:35	1.3
  +++ FuncStringLength.java	2001/04/10 18:45:32	1.3.2.1
  @@ -58,7 +58,7 @@
   
   import org.apache.xpath.res.XPATHErrorResources;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
   
   import java.util.Vector;
   
  
  
  
  1.5.2.1   +1 -1      xml-xalan/java/src/org/apache/xpath/functions/FuncSubstring.java
  
  Index: FuncSubstring.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncSubstring.java,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- FuncSubstring.java	2001/01/29 12:14:20	1.5
  +++ FuncSubstring.java	2001/04/10 18:45:32	1.5.2.1
  @@ -56,7 +56,7 @@
    */
   package org.apache.xpath.functions;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
   
   import java.util.Vector;
   
  
  
  
  1.3.2.1   +1 -1      xml-xalan/java/src/org/apache/xpath/functions/FuncSubstringAfter.java
  
  Index: FuncSubstringAfter.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncSubstringAfter.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- FuncSubstringAfter.java	2000/11/13 16:27:35	1.3
  +++ FuncSubstringAfter.java	2001/04/10 18:45:33	1.3.2.1
  @@ -56,7 +56,7 @@
    */
   package org.apache.xpath.functions;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
   
   import java.util.Vector;
   
  
  
  
  1.3.2.1   +1 -1      xml-xalan/java/src/org/apache/xpath/functions/FuncSubstringBefore.java
  
  Index: FuncSubstringBefore.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncSubstringBefore.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- FuncSubstringBefore.java	2000/11/13 16:27:35	1.3
  +++ FuncSubstringBefore.java	2001/04/10 18:45:33	1.3.2.1
  @@ -56,7 +56,7 @@
    */
   package org.apache.xpath.functions;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
   
   import java.util.Vector;
   
  
  
  
  1.4.2.1   +9 -6      xml-xalan/java/src/org/apache/xpath/functions/FuncSum.java
  
  Index: FuncSum.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncSum.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- FuncSum.java	2000/11/16 20:04:51	1.4
  +++ FuncSum.java	2001/04/10 18:45:33	1.4.2.1
  @@ -56,8 +56,10 @@
    */
   package org.apache.xpath.functions;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.traversal.NodeIterator;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
   
   import java.util.Vector;
   
  @@ -86,13 +88,14 @@
     public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
     {
   
  -    NodeIterator nodes = m_arg0.execute(xctxt).nodeset();
  +    DTMIterator nodes = m_arg0.execute(xctxt).nodeset();
       double sum = 0.0;
  -    Node pos;
  +    int pos;
   
  -    while (null != (pos = nodes.nextNode()))
  +    while (DTM.NULL != (pos = nodes.nextNode()))
       {
  -      String s = DOMHelper.getNodeData(pos);
  +      DTM dtm = nodes.getDTM(pos);
  +      String s = dtm.getStringValue(pos);
   
         if (null != s)
           sum += XString.castToNum(s);
  
  
  
  1.8.2.1   +1 -1      xml-xalan/java/src/org/apache/xpath/functions/FuncSystemProperty.java
  
  Index: FuncSystemProperty.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncSystemProperty.java,v
  retrieving revision 1.8
  retrieving revision 1.8.2.1
  diff -u -r1.8 -r1.8.2.1
  --- FuncSystemProperty.java	2001/01/02 03:47:16	1.8
  +++ FuncSystemProperty.java	2001/04/10 18:45:33	1.8.2.1
  @@ -66,7 +66,7 @@
   import org.apache.xml.utils.PrefixResolver;
   import org.apache.xpath.res.XPATHErrorResources;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
   
   import java.util.Vector;
   
  
  
  
  1.3.2.1   +1 -1      xml-xalan/java/src/org/apache/xpath/functions/FuncTranslate.java
  
  Index: FuncTranslate.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncTranslate.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- FuncTranslate.java	2000/11/13 16:27:35	1.3
  +++ FuncTranslate.java	2001/04/10 18:45:33	1.3.2.1
  @@ -56,7 +56,7 @@
    */
   package org.apache.xpath.functions;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
   
   import java.util.Vector;
   
  
  
  
  1.3.2.1   +1 -1      xml-xalan/java/src/org/apache/xpath/functions/FuncTrue.java
  
  Index: FuncTrue.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncTrue.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- FuncTrue.java	2000/11/13 16:27:35	1.3
  +++ FuncTrue.java	2001/04/10 18:45:34	1.3.2.1
  @@ -56,7 +56,7 @@
    */
   package org.apache.xpath.functions;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
   
   import java.util.Vector;
   
  
  
  
  1.3.2.1   +9 -6      xml-xalan/java/src/org/apache/xpath/functions/FuncUnparsedEntityURI.java
  
  Index: FuncUnparsedEntityURI.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncUnparsedEntityURI.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- FuncUnparsedEntityURI.java	2000/11/13 16:27:35	1.3
  +++ FuncUnparsedEntityURI.java	2001/04/10 18:45:34	1.3.2.1
  @@ -58,8 +58,10 @@
   
   import org.apache.xpath.res.XPATHErrorResources;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.Document;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.Element;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
   
   import java.util.Vector;
   
  @@ -86,10 +88,11 @@
     {
   
       String name = m_arg0.execute(xctxt).str();
  -    Node context = xctxt.getCurrentNode();
  -    Document doc = (Node.DOCUMENT_NODE == context.getNodeType())
  -                   ? ((Document) context) : context.getOwnerDocument();
  -    String uri = xctxt.getDOMHelper().getUnparsedEntityURI(name, doc);
  +    int context = xctxt.getCurrentNode();
  +    DTM dtm = xctxt.getDTM(context);
  +    int doc = dtm.getDocument();
  +    
  +    String uri = dtm.getUnparsedEntityURI(name);
   
       return new XString(uri);
     }
  
  
  
  1.4.2.1   +1 -1      xml-xalan/java/src/org/apache/xpath/functions/Function.java
  
  Index: Function.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/Function.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- Function.java	2000/12/16 20:01:54	1.4
  +++ Function.java	2001/04/10 18:45:34	1.4.2.1
  @@ -56,7 +56,7 @@
    */
   package org.apache.xpath.functions;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
   
   import java.util.Vector;
   
  
  
  
  1.5.2.1   +2 -2      xml-xalan/java/src/org/apache/xpath/functions/FunctionDef1Arg.java
  
  Index: FunctionDef1Arg.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FunctionDef1Arg.java,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- FunctionDef1Arg.java	2000/12/27 22:26:01	1.5
  +++ FunctionDef1Arg.java	2001/04/10 18:45:34	1.5.2.1
  @@ -56,7 +56,7 @@
    */
   package org.apache.xpath.functions;
   
  -import org.w3c.dom.Node;
  +//import org.w3c.dom.Node;
   
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.objects.XNodeSet;
  @@ -82,7 +82,7 @@
      * @throws javax.xml.transform.TransformerException if an error occurs while
      *                                   executing the argument expression.
      */
  -  protected Node getArg0AsNode(XPathContext xctxt)
  +  protected int getArg0AsNode(XPathContext xctxt)
             throws javax.xml.transform.TransformerException
     {
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.10.2.1  +86 -80    xml-xalan/java/src/org/apache/xpath/objects/XNodeSet.java
  
  Index: XNodeSet.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/objects/XNodeSet.java,v
  retrieving revision 1.10
  retrieving revision 1.10.2.1
  diff -u -r1.10 -r1.10.2.1
  --- XNodeSet.java	2000/12/14 21:18:02	1.10
  +++ XNodeSet.java	2001/04/10 18:45:43	1.10.2.1
  @@ -56,11 +56,14 @@
    */
   package org.apache.xpath.objects;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.Text;
  -import org.w3c.dom.DocumentFragment;
  -import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.Text;
  +//import org.w3c.dom.DocumentFragment;
  +//import org.w3c.dom.traversal.NodeIterator;
   
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
  +
   import org.apache.xpath.DOMHelper;
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.NodeSet;
  @@ -80,7 +83,7 @@
      *
      * @param val Value of the XNodeSet object
      */
  -  public XNodeSet(NodeIterator val)
  +  public XNodeSet(DTMIterator val)
     {
       super(val);
     }
  @@ -98,12 +101,12 @@
      *
      * @param n Node to add to the new XNodeSet object
      */
  -  public XNodeSet(Node n)
  +  public XNodeSet(int n)
     {
   
       super(new NodeSet());
   
  -    if (null != n)
  +    if (DTM.NULL != n)
       {
         ((NodeSet) m_obj).addNode(n);
       }
  @@ -137,7 +140,7 @@
      *
      * @return numeric value of the string conversion from a single node.
      */
  -  public static double getNumberFromNode(Node n)
  +  public static double getNumberFromNode(int n)
     {
       return XString.castToNum(getStringFromNode(n));
     }
  @@ -151,10 +154,10 @@
     public double num()
     {
   
  -    NodeIterator nl = nodeset();
  -    Node node = nl.nextNode();
  +    DTMIterator nl = nodeset();
  +    int node = nl.nextNode();
   
  -    return (node != null) ? getNumberFromNode(node) : Double.NaN;
  +    return (node != DTM.NULL) ? getNumberFromNode(node) : Double.NaN;
     }
   
     /**
  @@ -164,7 +167,7 @@
      */
     public boolean bool()
     {
  -    return (nodeset().nextNode() != null);
  +    return (nodeset().nextNode() != DTM.NULL);
     }
   
     /**
  @@ -174,24 +177,27 @@
      *
      * @return the string conversion from a single node.
      */
  -  public static String getStringFromNode(Node n)
  +  public static String getStringFromNode(int n)
     {
   
  -    switch (n.getNodeType())
  -    {
  -    case Node.ELEMENT_NODE :
  -    case Node.DOCUMENT_NODE :
  -      return DOMHelper.getNodeData(n);
  -    case Node.CDATA_SECTION_NODE :
  -    case Node.TEXT_NODE :
  -      return ((Text) n).getData();
  -    case Node.COMMENT_NODE :
  -    case Node.PROCESSING_INSTRUCTION_NODE :
  -    case Node.ATTRIBUTE_NODE :
  -      return n.getNodeValue();
  -    default :
  -      return DOMHelper.getNodeData(n);
  -    }
  +    // %TBD%
  +    // I guess we'll have to get a static instance of the DTM manager...
  +    return null;
  +//    switch (n.getNodeType())
  +//    {
  +//    case DTM.ELEMENT_NODE :
  +//    case DTM.DOCUMENT_NODE :
  +//      return DOMHelper.getNodeData(n);
  +//    case DTM.CDATA_SECTION_NODE :
  +//    case DTM.TEXT_NODE :
  +//      return ((Text) n).getData();
  +//    case DTM.COMMENT_NODE :
  +//    case DTM.PROCESSING_INSTRUCTION_NODE :
  +//    case DTM.ATTRIBUTE_NODE :
  +//      return n.getNodeValue();
  +//    default :
  +//      return DOMHelper.getNodeData(n);
  +//    }
     }
   
     /**
  @@ -203,10 +209,10 @@
     public String str()
     {
   
  -    NodeIterator nl = nodeset();
  -    Node node = nl.nextNode();
  +    DTMIterator nl = nodeset();
  +    int node = nl.nextNode();
   
  -    return (node != null) ? getStringFromNode(node) : "";
  +    return (node != DTM.NULL) ? getStringFromNode(node) : "";
     }
   
     /**
  @@ -216,20 +222,19 @@
      *
      * @return the nodeset as a result tree fragment.
      */
  -  public DocumentFragment rtree(XPathContext support)
  +  public DTMIterator rtree(XPathContext support)
     {
  +    DTM frag = support.createDocumentFragment();
   
  -    DocumentFragment frag =
  -      support.getDOMHelper().getDOMFactory().createDocumentFragment();
  -    NodeIterator nl = nodeset();
  -    Node node;
  +    DTMIterator nl = nodeset();
  +    int node;
   
  -    while (null != (node = nl.nextNode()))
  +    while (DTM.NULL != (node = nl.nextNode()))
       {
  -      frag.appendChild(node.cloneNode(true));
  +      frag.appendChild(node, true, true);
       }
   
  -    return frag;
  +    return support.createDTMIterator(frag.getDocument());
     }
     
     /**
  @@ -237,34 +242,35 @@
      *
      * @return The nodeset as a nodelist
      */
  -  public NodeIterator nodeset()
  +  public DTMIterator nodeset()
     {
   
       // System.out.println("In XNodeSet.nodeset()");
  -    NodeIterator ns = (NodeIterator) m_obj;
  +    DTMIterator ns = (DTMIterator) m_obj;
   
       // System.out.println("Got NodeIterator");
  -    if (ns instanceof ContextNodeList)
  -    {
  -
  -      // System.out.println("Is a ContextNodeList: "+ns);
  -      if (((ContextNodeList) ns).isFresh())  // bit of a hack...
  -      {
  -        return ns;
  -      }
  -      else
  -      {
  -        try
  -        {
  -          return ((ContextNodeList) ns).cloneWithReset();
  -        }
  -        catch (CloneNotSupportedException cnse)
  -        {
  -          throw new RuntimeException(cnse.getMessage());
  -        }
  -      }
  -    }
  -    else
  +    // %TBD% !!!
  +//    if (ns instanceof ContextNodeList)
  +//    {
  +//
  +//      // System.out.println("Is a ContextNodeList: "+ns);
  +//      if (((ContextNodeList) ns).isFresh())  // bit of a hack...
  +//      {
  +//        return ns;
  +//      }
  +//      else
  +//      {
  +//        try
  +//        {
  +//          return ((ContextNodeList) ns).cloneWithReset();
  +//        }
  +//        catch (CloneNotSupportedException cnse)
  +//        {
  +//          throw new RuntimeException(cnse.getMessage());
  +//        }
  +//      }
  +//    }
  +//    else
       {
   
         // System.out.println("Returning node iterator");
  @@ -345,20 +351,20 @@
         // is true if and only if some node in $x has the string-value 
         // foo; the latter is true if and only if all nodes in $x have 
         // the string-value foo.
  -      NodeIterator list1 = nodeset();
  -      NodeIterator list2 = ((XNodeSet) obj2).nodeset();
  -      Node node1;
  +      DTMIterator list1 = nodeset();
  +      DTMIterator list2 = ((XNodeSet) obj2).nodeset();
  +      int node1;
         StringVector node2Strings = null;
   
  -      while (null != (node1 = list1.nextNode()))
  +      while (DTM.NULL != (node1 = list1.nextNode()))
         {
           String s1 = getStringFromNode(node1);
   
           if (null == node2Strings)
           {
  -          Node node2;
  +          int node2;
   
  -          while (null != (node2 = list2.nextNode()))
  +          while (DTM.NULL != (node2 = list2.nextNode()))
             {
               String s2 = getStringFromNode(node2);
   
  @@ -415,11 +421,11 @@
         // comparison on the number to be compared and on the result of 
         // converting the string-value of that node to a number using 
         // the number function is true. 
  -      NodeIterator list1 = nodeset();
  +      DTMIterator list1 = nodeset();
         double num2 = obj2.num();
  -      Node node;
  +      int node;
   
  -      while (null != (node = list1.nextNode()))
  +      while (DTM.NULL != (node = list1.nextNode()))
         {
           double num1 = getNumberFromNode(node);
   
  @@ -441,10 +447,10 @@
   
         if (!Double.isNaN(num2))
         {
  -        NodeIterator list1 = nodeset();
  -        Node node;
  +        DTMIterator list1 = nodeset();
  +        int node;
   
  -        while (null != (node = list1.nextNode()))
  +        while (DTM.NULL != (node = list1.nextNode()))
           {
             double num1 = getNumberFromNode(node);
   
  @@ -459,10 +465,10 @@
         else
         {
           String s2 = obj2.str();
  -        NodeIterator list1 = nodeset();
  -        Node node;
  +        DTMIterator list1 = nodeset();
  +        int node;
   
  -        while (null != (node = list1.nextNode()))
  +        while (DTM.NULL != (node = list1.nextNode()))
           {
             String s1 = getStringFromNode(node);
   
  @@ -485,10 +491,10 @@
         // the comparison on the string-value of the node and the other 
         // string is true. 
         String s2 = obj2.str();
  -      NodeIterator list1 = nodeset();
  -      Node node;
  +      DTMIterator list1 = nodeset();
  +      int node;
   
  -      while (null != (node = list1.nextNode()))
  +      while (DTM.NULL != (node = list1.nextNode()))
         {
           String s1 = getStringFromNode(node);
   
  
  
  
  1.5.2.1   +9 -9      xml-xalan/java/src/org/apache/xpath/objects/XNull.java
  
  Index: XNull.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/objects/XNull.java,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- XNull.java	2000/12/14 21:18:03	1.5
  +++ XNull.java	2001/04/10 18:45:43	1.5.2.1
  @@ -56,9 +56,12 @@
    */
   package org.apache.xpath.objects;
   
  -import org.w3c.dom.traversal.NodeIterator;
  -import org.w3c.dom.DocumentFragment;
  +//import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.DocumentFragment;
   
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.NodeSet;
   
  @@ -137,13 +140,10 @@
      *
      * @return The object as a result tree fragment.
      */
  -  public DocumentFragment rtree(XPathContext support)
  +  public DTMIterator rtree(XPathContext support)
     {
  -
  -    DocumentFragment result =
  -      support.getDOMHelper().getDOMFactory().createDocumentFragment();
  -
  -    return result;
  +    DTM frag = support.createDocumentFragment();
  +    return support.createDTMIterator(frag.getDocument());
     }
   
     /**
  @@ -151,7 +151,7 @@
      *
      * @return null
      */
  -  public NodeIterator nodeset()
  +  public DTMIterator nodeset()
     {
       return null;
     }
  
  
  
  1.8.2.1   +108 -22   xml-xalan/java/src/org/apache/xpath/objects/XNumber.java
  
  Index: XNumber.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/objects/XNumber.java,v
  retrieving revision 1.8
  retrieving revision 1.8.2.1
  diff -u -r1.8 -r1.8.2.1
  --- XNumber.java	2001/01/02 03:47:17	1.8
  +++ XNumber.java	2001/04/10 18:45:43	1.8.2.1
  @@ -57,6 +57,7 @@
   package org.apache.xpath.objects;
   
   import org.w3c.dom.*;
  +import java.math.BigDecimal;
   
   /**
    * <meta name="usage" content="general"/>
  @@ -130,6 +131,7 @@
      * @return "NaN" if the number is NaN, Infinity or -Infinity if
      * the number is infinite or the string value of the number.
      */
  +  private static final int PRECISION = 16;
     public String str()
     {
   
  @@ -145,50 +147,132 @@
           return "-Infinity";
       }
   
  -    double num = m_val;
  -    String s = Double.toString(num);
  +    long longVal = (long)m_val;
  +    if ((double)longVal == m_val)
  +      return Long.toString(longVal);
  +
  +
  +    String s = Double.toString(m_val);
       int len = s.length();
   
       if (s.charAt(len - 2) == '.' && s.charAt(len - 1) == '0')
       {
  -      s = s.substring(0, len - 2);
  +      return s.substring(0, len - 2);
  +    }
   
  -      if (s.equals("-0"))
  -        return "0";
  +    int exp = 0;
  +    int e = s.indexOf('E');
  +    if (e != -1)
  +    {
  +      exp = Integer.parseInt(s.substring(e + 1));
  +      s = s.substring(0,e);
  +      len = e;
  +    }
   
  -      return s;
  +    // Calculate Significant Digits:
  +    // look from start of string for first digit
  +    // look from end for last digit
  +    // significant digits = end - start + (0 or 1 depending on decimal location)
  +
  +    int decimalPos = -1;
  +    int start = (s.charAt(0) == '-') ? 1 : 0;
  +    findStart: for( ; start < len; start++ )
  +    {
  +      switch (s.charAt(start))
  +      {
  +      case '0':
  +	break;
  +      case '.':
  +	decimalPos = start;
  +	break;
  +      default:
  +	break findStart;
  +      }
       }
  +    int end = s.length() - 1;
  +    findEnd: for( ; end > start; end-- )
  +    {
  +      switch (s.charAt(end))
  +      {
  +      case '0':
  +	break;
  +      case '.':
  +	decimalPos = end;
  +	break;
  +      default:
  +	break findEnd;
  +      }
  +    }
   
  -    int e = s.indexOf('E');
  +    int sigDig = end - start;
   
  -    if (e < 0)
  -      return s;
  +    // clarify decimal location if it has not yet been found
  +    if (decimalPos == -1)
  +      decimalPos = s.indexOf('.');
  +
  +    // if decimal is not between start and end, add one to sigDig
  +    if (decimalPos < start || decimalPos > end)
  +      ++sigDig;
   
  -    int exp = Integer.parseInt(s.substring(e + 1));
  -    String sign;
  +    // reduce significant digits to PRECISION if necessary
  +    if (sigDig > PRECISION)
  +    {
  +      // re-scale BigDecimal in order to get significant digits = PRECISION
  +      BigDecimal num = new BigDecimal(s);
  +      int newScale = num.scale() - (sigDig - PRECISION);
  +      if (newScale < 0)
  +	newScale = 0;
  +      s = num.setScale(newScale, BigDecimal.ROUND_HALF_UP).toString();
  +
  +      // remove trailing '0's; keep track of decimalPos
  +      int truncatePoint = s.length();
  +      while (s.charAt(--truncatePoint) == '0')
  +	;
  +
  +      if (s.charAt(truncatePoint) == '.')
  +      {
  +	decimalPos = truncatePoint;
  +      }
  +      else
  +      {
  +	decimalPos = s.indexOf('.');
  +	truncatePoint += 1;
  +      }
  +
  +      s = s.substring(0, truncatePoint);
  +      len = s.length();
  +    }
   
  +    // Account for exponent by adding zeros as needed 
  +    // and moving the decimal place
  +
  +    if (exp == 0)
  +       return s;
  +
  +    start = 0;
  +    String sign;
       if (s.charAt(0) == '-')
       {
         sign = "-";
  -      s = s.substring(1);
  -
  -      --e;
  +      start++;
       }
       else
         sign = "";
  +
  +    String wholePart = s.substring(start, decimalPos);
  +    String decimalPart = s.substring(decimalPos + 1);
   
  -    int nDigits = e - 2;
  +    // get the number of digits right of the decimal
  +    int decimalLen = decimalPart.length();
   
  -    if (exp >= nDigits)
  -      return sign + s.substring(0, 1) + s.substring(2, e)
  -             + zeros(exp - nDigits);
  +    if (exp >= decimalLen)
  +      return sign + wholePart + decimalPart + zeros(exp - decimalLen);
   
       if (exp > 0)
  -      return sign + s.substring(0, 1) + s.substring(2, 2 + exp) + "."
  -             + s.substring(2 + exp, e);
  +      return sign + wholePart + decimalPart.substring(0, exp) + "."
  +	     + decimalPart.substring(exp);
   
  -    return sign + "0." + zeros(-1 - exp) + s.substring(0, 1)
  -           + s.substring(2, e);
  +    return sign + "0." + zeros(-1 - exp) + wholePart + decimalPart;
     }
   
     /**
  @@ -201,6 +285,8 @@
      */
     static private String zeros(int n)
     {
  +    if (n < 1)
  +      return "";
   
       char[] buf = new char[n];
   
  
  
  
  1.8.2.1   +33 -30    xml-xalan/java/src/org/apache/xpath/objects/XObject.java
  
  Index: XObject.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/objects/XObject.java,v
  retrieving revision 1.8
  retrieving revision 1.8.2.1
  diff -u -r1.8 -r1.8.2.1
  --- XObject.java	2001/01/02 03:47:17	1.8
  +++ XObject.java	2001/04/10 18:45:43	1.8.2.1
  @@ -56,11 +56,14 @@
    */
   package org.apache.xpath.objects;
   
  -import org.w3c.dom.DocumentFragment;
  -import org.w3c.dom.Text;
  -import org.w3c.dom.Node;
  -import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.DocumentFragment;
  +//import org.w3c.dom.Text;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.traversal.NodeIterator;
   
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
  +
   import java.io.Serializable;
   
   import org.apache.xpath.res.XPATHErrorResources;
  @@ -142,19 +145,20 @@
       else if (val instanceof Double)
       {
         result = new XNumber(((Double) val).doubleValue());
  -    }
  -    else if (val instanceof DocumentFragment)
  -    {
  -      result = new XRTreeFrag((DocumentFragment) val);
  -    }
  -    else if (val instanceof Node)
  -    {
  -      result = new XNodeSet((Node) val);
       }
  -    else if (val instanceof NodeIterator)
  -    {
  -      result = new XNodeSet((NodeIterator) val);
  -    }
  +      // %TBD%
  +//    else if (val instanceof DocumentFragment)
  +//    {
  +//      result = new XRTreeFrag((DocumentFragment) val);
  +//    }
  +//    else if (val instanceof Node)
  +//    {
  +//      result = new XNodeSet((Node) val);
  +//    }
  +//    else if (val instanceof NodeIterator)
  +//    {
  +//      result = new XNodeSet((NodeIterator) val);
  +//    }
       else
       {
         result = new XObject(val);
  @@ -268,20 +272,18 @@
      *
      * @return the objec as a result tree fragment.
      */
  -  public DocumentFragment rtree(XPathContext support)
  +  public DTMIterator rtree(XPathContext support)
     {
   
  -    DocumentFragment result = rtree();
  +    DTMIterator result = rtree();
   
       if (null == result)
       {
  -      result =
  -        support.getDOMHelper().getDOMFactory().createDocumentFragment();
  -
  -      Text textNode =
  -        support.getDOMHelper().getDOMFactory().createTextNode(str());
  -
  -      result.appendChild(textNode);
  +      DTM frag = support.createDocumentFragment();
  +      
  +      // %OPT%
  +      frag.appendTextChild(str());
  +      support.createDTMIterator(frag.getDocument());
       }
   
       return result;
  @@ -292,7 +294,7 @@
      *
      * @return null
      */
  -  public DocumentFragment rtree()
  +  public DTMIterator rtree()
     {
       return null;
     }
  @@ -315,7 +317,7 @@
      *
      * @throws javax.xml.transform.TransformerException
      */
  -  public NodeIterator nodeset() throws javax.xml.transform.TransformerException
  +  public DTMIterator nodeset() throws javax.xml.transform.TransformerException
     {
   
       error(XPATHErrorResources.ER_CANT_CONVERT_TO_NODELIST,
  @@ -372,10 +374,11 @@
         break;
       case CLASS_UNKNOWN :
         result = m_obj;
  -      break;
  -    case CLASS_RTREEFRAG :
  -      result = rtree(support);
         break;
  +      // %TBD%  What to do here?
  +//    case CLASS_RTREEFRAG :
  +//      result = rtree(support);
  +//      break;
       default :
         error(XPATHErrorResources.ER_CANT_CONVERT_TO_TYPE,
               new Object[]{ getTypeString(),
  
  
  
  1.13.2.1  +33 -159   xml-xalan/java/src/org/apache/xpath/objects/XRTreeFrag.java
  
  Index: XRTreeFrag.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/objects/XRTreeFrag.java,v
  retrieving revision 1.13
  retrieving revision 1.13.2.1
  diff -u -r1.13 -r1.13.2.1
  --- XRTreeFrag.java	2001/01/11 03:10:48	1.13
  +++ XRTreeFrag.java	2001/04/10 18:45:44	1.13.2.1
  @@ -56,9 +56,12 @@
    */
   package org.apache.xpath.objects;
   
  -import org.w3c.dom.*;
  -import org.w3c.dom.traversal.NodeIterator;
  -import org.w3c.dom.traversal.NodeFilter;
  +//import org.w3c.dom.*;
  +//import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.traversal.NodeFilter;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
  +import org.apache.xml.dtm.DTMFilter;
   
   import org.apache.xpath.DOMHelper;
   
  @@ -72,10 +75,11 @@
   
     /**
      * Create an XRTreeFrag Object.
  +   * %REVIEW%
      *
      * @param frag Document fragment this will wrap
      */
  -  public XRTreeFrag(DocumentFragment frag)
  +  public XRTreeFrag(DTMIterator frag)
     {
       super(frag);
     }
  @@ -112,7 +116,9 @@
   //    java.text.NumberFormat m_formatter =
   //      java.text.NumberFormat.getNumberInstance();
       double result;
  -    String s = DOMHelper.getNodeData((DocumentFragment) m_obj);
  +    
  +    int node = ((DTMIterator)m_obj).nextNode();
  +    String s = ((DTMIterator)m_obj).getDTM(node).getStringValue(node);
   
       if (null != s)
       {
  @@ -158,9 +164,9 @@
      */
     public String str()
     {
  +    int node = ((DTMIterator)m_obj).nextNode();
  +    String str = ((DTMIterator)m_obj).getDTM(node).getStringValue(node);
   
  -    String str = DOMHelper.getNodeData((DocumentFragment) m_obj);
  -
       return (null == str) ? "" : str;
     }
   
  @@ -169,38 +175,35 @@
      *
      * @return The document fragment this wraps
      */
  -  public DocumentFragment rtree()
  +  public DTMIterator rtree()
     {
  -    return (DocumentFragment) m_obj;
  +    return (DTMIterator) m_obj;
     }
   
     /**
  -   * Cast result object to a NodeIterator.
  +   * Cast result object to a DTMIterator.
      *
  -   * @return The document fragment as a NodeIterator
  +   * @return The document fragment as a DTMIterator
      */
  -  public NodeIterator asNodeIterator()
  +  public DTMIterator asNodeIterator()
     {
  -
  -    if (m_obj instanceof NodeIterator)
  -      return (NodeIterator) m_obj;
  -    else
  -      return new NodeIteratorWrapper(rtree());
  +    return (DTMIterator) m_obj;
     }
   
  -  /**
  -   * Cast result object to a nodelist. (special function).
  -   *
  -   * @return The document fragment as a nodelist
  -   */
  -  public NodeList convertToNodeset()
  -  {
  -
  -    if (m_obj instanceof NodeList)
  -      return (NodeList) m_obj;
  -    else
  -      return null;
  -  }
  +  // %TBD%
  +//  /**
  +//   * Cast result object to a nodelist. (special function).
  +//   *
  +//   * @return The document fragment as a nodelist
  +//   */
  +//  public NodeList convertToNodeset()
  +//  {
  +//
  +//    if (m_obj instanceof NodeList)
  +//      return (NodeList) m_obj;
  +//    else
  +//      return null;
  +//  }
   
     /**
      * Tell if two objects are functionally equal.
  @@ -250,133 +253,4 @@
       }
     }
   
  -  /**
  -   * <meta name="usage" content="internal"/>
  -   * Class to wrap a  NodeIterator object
  -   */
  -  class NodeIteratorWrapper implements NodeIterator
  -  {
  -
  -    /** Position of next node          */
  -    private int m_pos = -1;
  -
  -    /** Document fragment instance this will wrap         */
  -    private DocumentFragment m_docFrag;
  -
  -    /**
  -     * Constructor NodeIteratorWrapper
  -     *
  -     *
  -     * @param df Document fragment instance this will wrap
  -     */
  -    NodeIteratorWrapper(DocumentFragment df)
  -    {
  -      m_docFrag = df;
  -    }
  -
  -    /**
  -     *  The root node of the Iterator, as specified when it was created.
  -     *
  -     * @return null
  -     */
  -    public Node getRoot()
  -    {
  -      return null;
  -    }
  -
  -    /**
  -     *  This attribute determines which node types are presented via the
  -     * iterator. The available set of constants is defined in the
  -     * <code>NodeFilter</code> interface.
  -     *
  -     * @return All node types
  -     */
  -    public int getWhatToShow()
  -    {
  -      return NodeFilter.SHOW_ALL;
  -    }
  -
  -    /**
  -     *  The filter used to screen nodes.
  -     *
  -     * @return null
  -     */
  -    public NodeFilter getFilter()
  -    {
  -      return null;
  -    }
  -
  -    /**
  -     *  The value of this flag determines whether the children of entity
  -     * reference nodes are visible to the iterator. If false, they will be
  -     * skipped over.
  -     * <br> To produce a view of the document that has entity references
  -     * expanded and does not expose the entity reference node itself, use the
  -     * whatToShow flags to hide the entity reference node and set
  -     * expandEntityReferences to true when creating the iterator. To produce
  -     * a view of the document that has entity reference nodes but no entity
  -     * expansion, use the whatToShow flags to show the entity reference node
  -     * and set expandEntityReferences to false.
  -     *
  -     * @return true
  -     */
  -    public boolean getExpandEntityReferences()
  -    {
  -      return true;
  -    }
  -
  -    /**
  -     *  Returns the next node in the set and advances the position of the
  -     * iterator in the set. After a NodeIterator is created, the first call
  -     * to nextNode() returns the first node in the set.
  -     * @return  The next <code>Node</code> in the set being iterated over, or
  -     *   <code>null</code> if there are no more members in that set.
  -     * @throws DOMException
  -     *    INVALID_STATE_ERR: Raised if this method is called after the
  -     *   <code>detach</code> method was invoked.
  -     */
  -    public Node nextNode() throws DOMException
  -    {
  -
  -      if (-1 == m_pos)
  -      {
  -        m_pos = 0;
  -
  -        return m_docFrag;
  -      }
  -      else
  -        return null;
  -    }
  -
  -    /**
  -     *  Returns the previous node in the set and moves the position of the
  -     * iterator backwards in the set.
  -     * @return  The previous <code>Node</code> in the set being iterated over,
  -     *   or<code>null</code> if there are no more members in that set.
  -     * @throws DOMException
  -     *    INVALID_STATE_ERR: Raised if this method is called after the
  -     *   <code>detach</code> method was invoked.
  -     */
  -    public Node previousNode() throws DOMException
  -    {
  -
  -      if (0 == m_pos)
  -      {
  -        m_pos = -1;
  -
  -        return m_docFrag;
  -      }
  -      else
  -        return null;
  -    }
  -
  -    /**
  -     *  Detaches the iterator from the set which it iterated over, releasing
  -     * any computational resources and placing the iterator in the INVALID
  -     * state. After<code>detach</code> has been invoked, calls to
  -     * <code>nextNode</code> or<code>previousNode</code> will raise the
  -     * exception INVALID_STATE_ERR.
  -     */
  -    public void detach(){}
  -  }
   }
  
  
  
  1.6.2.1   +9 -11     xml-xalan/java/src/org/apache/xpath/objects/XString.java
  
  Index: XString.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/objects/XString.java,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- XString.java	2000/12/14 21:18:05	1.6
  +++ XString.java	2001/04/10 18:45:44	1.6.2.1
  @@ -56,7 +56,10 @@
    */
   package org.apache.xpath.objects;
   
  -import org.w3c.dom.*;
  +//import org.w3c.dom.*;
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
  +import org.apache.xml.dtm.DTMFilter;
   
   import org.apache.xpath.XPathContext;
   
  @@ -200,17 +203,12 @@
      *
      * @return A document fragment with this string as a child node
      */
  -  public DocumentFragment rtree(XPathContext support)
  +  public DTMIterator rtree(XPathContext support)
     {
  -
  -    DocumentFragment df =
  -      support.getDOMHelper().getDOMFactory().createDocumentFragment();
  -    Text textNode =
  -      support.getDOMHelper().getDOMFactory().createTextNode(str());
  -
  -    df.appendChild(textNode);
  -
  -    return df;
  +    DTM frag = support.createDocumentFragment();
  +    frag.appendTextChild(str());
  +    
  +    return support.createDTMIterator(frag.getDocument());
     }
   
     /**
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.9.2.1   +24 -18    xml-xalan/java/src/org/apache/xpath/patterns/AncestorStepPattern.java
  
  Index: AncestorStepPattern.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/patterns/AncestorStepPattern.java,v
  retrieving revision 1.9
  retrieving revision 1.9.2.1
  diff -u -r1.9 -r1.9.2.1
  --- AncestorStepPattern.java	2001/01/02 03:47:18	1.9
  +++ AncestorStepPattern.java	2001/04/10 18:45:46	1.9.2.1
  @@ -62,9 +62,11 @@
   import org.apache.xml.utils.PrefixResolver;
   import org.apache.xpath.axes.LocPathIterator;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.traversal.NodeIterator;
   
  +import org.apache.xml.dtm.DTM;
  +
   /**
    * <meta name="usage" content="advanced"/>
    * Implements a match pattern step that tests an ancestor.
  @@ -161,26 +163,30 @@
     {
   
       XObject score = NodeTest.SCORE_NONE;
  -    Node parent = xctxt.getCurrentNode();
  -
  -    while (null != (parent = xctxt.getDOMHelper().getParentOfNode(parent)))
  +    int parent = xctxt.getCurrentNode();
  +    DTM dtm = xctxt.getDTM(parent);
  +    
  +    if(null != dtm)
       {
  -      try
  +      while (DTM.NULL != (parent = dtm.getParent(parent)))
         {
  -        xctxt.pushCurrentNode(parent);
  -
  -        score = execute(xctxt);
  -
  -        if (score != NodeTest.SCORE_NONE)
  +        try
           {
  -          score = SCORE_OTHER;
  -
  -          break;
  +          xctxt.pushCurrentNode(parent);
  +  
  +          score = execute(xctxt);
  +  
  +          if (score != NodeTest.SCORE_NONE)
  +          {
  +            score = SCORE_OTHER;
  +  
  +            break;
  +          }
           }
  -      }
  -      finally
  -      {
  -        xctxt.popCurrentNode();
  +        finally
  +        {
  +          xctxt.popCurrentNode();
  +        }
         }
       }
   
  
  
  
  1.7.2.1   +13 -7     xml-xalan/java/src/org/apache/xpath/patterns/FunctionPattern.java
  
  Index: FunctionPattern.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/patterns/FunctionPattern.java,v
  retrieving revision 1.7
  retrieving revision 1.7.2.1
  diff -u -r1.7 -r1.7.2.1
  --- FunctionPattern.java	2001/01/02 03:47:18	1.7
  +++ FunctionPattern.java	2001/04/10 18:45:46	1.7.2.1
  @@ -63,9 +63,12 @@
   import org.apache.xpath.objects.XNumber;
   import org.apache.xpath.objects.XObject;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.traversal.NodeIterator;
  +//import org.w3c.dom.Node;
  +//import org.w3c.dom.traversal.NodeIterator;
   
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMIterator;
  +
   /**
    * <meta name="usage" content="advanced"/>
    * Match pattern step that contains a function.
  @@ -120,18 +123,21 @@
     public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
     {
   
  -    Node context = xctxt.getCurrentNode();
  +    int context = xctxt.getCurrentNode();
       XObject obj = m_functionExpr.execute(xctxt);
  -    NodeIterator nl = obj.nodeset();
  +    
  +    // %TBD%
  +    DTMIterator nl =  null; /* obj.nodeset(); */
  +    
       XNumber score = SCORE_NONE;
   
       if (null != nl)
       {
  -      Node n;
  +      int n;
   
  -      while (null != (n = nl.nextNode()))
  +      while (DTM.NULL != (n = nl.nextNode()))
         {
  -        score = (n.equals(context)) ? SCORE_OTHER : SCORE_NONE;
  +        score = (context == context) ? SCORE_OTHER : SCORE_NONE;
   
           if (score == SCORE_OTHER)
           {
  
  
  
  1.20.2.2  +2 -2      xml-xalan/java/src/org/apache/xpath/patterns/NodeTest.java
  
  Index: NodeTest.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/patterns/NodeTest.java,v
  retrieving revision 1.20.2.1
  retrieving revision 1.20.2.2
  diff -u -r1.20.2.1 -r1.20.2.2
  --- NodeTest.java	2001/03/31 22:24:10	1.20.2.1
  +++ NodeTest.java	2001/04/10 18:45:46	1.20.2.2
  @@ -65,8 +65,8 @@
   import org.apache.xpath.WhitespaceStrippingElementMatcher;
   import org.apache.xml.utils.PrefixResolver;
   
  -import org.apache.xml.utils.DTMFilter;
  -import org.apache.xml.utils.DTM;
  +import org.apache.xml.dtm.DTMFilter;
  +import org.apache.xml.dtm.DTM;
   
   /**
    * <meta name="usage" content="advanced"/>
  
  
  
  1.19.2.1  +32 -25    xml-xalan/java/src/org/apache/xpath/patterns/StepPattern.java
  
  Index: StepPattern.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/patterns/StepPattern.java,v
  retrieving revision 1.19
  retrieving revision 1.19.2.1
  diff -u -r1.19 -r1.19.2.1
  --- StepPattern.java	2001/01/11 18:31:40	1.19
  +++ StepPattern.java	2001/04/10 18:45:46	1.19.2.1
  @@ -63,10 +63,13 @@
   import org.apache.xpath.axes.SubContextList;
   import org.apache.xpath.compiler.PsuedoNames;
   
  -import org.w3c.dom.traversal.NodeFilter;
  -import org.w3c.dom.Node;
  -import org.w3c.dom.traversal.NodeIterator;
  +// import org.w3c.dom.traversal.NodeFilter;
  +// import org.w3c.dom.Node;
  +// import org.w3c.dom.traversal.NodeIterator;
   
  +import org.apache.xml.dtm.DTM;
  +import org.apache.xml.dtm.DTMFilter;
  +
   /**
    * <meta name="usage" content="advanced"/>
    * This class represents a single pattern match step.
  @@ -84,7 +87,7 @@
      */
     public StepPattern(int whatToShow, String namespace, String name)
     {
  -    
  +
       super(whatToShow, namespace, name);
     }
   
  @@ -116,22 +119,22 @@
   
       switch (whatToShow)
       {
  -    case NodeFilter.SHOW_COMMENT :
  +    case DTMFilter.SHOW_COMMENT :
         m_targetString = PsuedoNames.PSEUDONAME_COMMENT;
         break;
  -    case NodeFilter.SHOW_TEXT :
  -    case NodeFilter.SHOW_CDATA_SECTION :
  -    case (NodeFilter.SHOW_TEXT | NodeFilter.SHOW_CDATA_SECTION):
  +    case DTMFilter.SHOW_TEXT :
  +    case DTMFilter.SHOW_CDATA_SECTION :
  +    case (DTMFilter.SHOW_TEXT | DTMFilter.SHOW_CDATA_SECTION):
         m_targetString = PsuedoNames.PSEUDONAME_TEXT;
         break;
  -    case NodeFilter.SHOW_ALL :
  +    case DTMFilter.SHOW_ALL :
         m_targetString = PsuedoNames.PSEUDONAME_ANY;
         break;
  -    case NodeFilter.SHOW_DOCUMENT :
  -    case NodeFilter.SHOW_DOCUMENT | NodeFilter.SHOW_DOCUMENT_FRAGMENT :
  +    case DTMFilter.SHOW_DOCUMENT :
  +    case DTMFilter.SHOW_DOCUMENT | DTMFilter.SHOW_DOCUMENT_FRAGMENT :
         m_targetString = PsuedoNames.PSEUDONAME_ROOT;
         break;
  -    case NodeFilter.SHOW_ELEMENT :
  +    case DTMFilter.SHOW_ELEMENT :
         if (this.WILD == m_name)
           m_targetString = PsuedoNames.PSEUDONAME_ANY;
         else
  @@ -344,10 +347,12 @@
     public int getProximityPosition(XPathContext xctxt)
     {
   
  -    Node context = xctxt.getCurrentNode();
  +    int context = xctxt.getCurrentNode();
  +    
  +    DTM dtm = xctxt.getDTM(context);
   
       // System.out.println("context: "+context.getNodeName());
  -    Node parentContext = xctxt.getDOMHelper().getParentOfNode(context);
  +    int parentContext = dtm.getParent(context);
   
       // System.out.println("parentContext: "+parentContext.getNodeName());
       try
  @@ -356,8 +361,8 @@
   
         int pos = 0;
   
  -      for (Node child = parentContext.getFirstChild(); child != null;
  -              child = child.getNextSibling())
  +      for (int child = dtm.getFirstChild(parentContext); child != DTM.NULL;
  +              child = dtm.getNextSibling(child))
         {
           try
           {
  @@ -367,7 +372,7 @@
             {
               pos++;
   
  -            if (child.equals(context))
  +            if (child == context)
               {
                 return pos;
               }
  @@ -409,8 +414,9 @@
     public int getLastPos(XPathContext xctxt)
     {
   
  -    Node context = xctxt.getCurrentNode();
  -    Node parentContext = xctxt.getDOMHelper().getParentOfNode(context);
  +    int context = xctxt.getCurrentNode();
  +    DTM dtm = xctxt.getDTM(context);
  +    int parentContext = dtm.getParent(context);
   
       try
       {
  @@ -418,8 +424,8 @@
   
         int count = 0;
   
  -      for (Node child = parentContext.getFirstChild(); child != null;
  -              child = child.getNextSibling())
  +      for (int child = dtm.getFirstChild(parentContext); child != DTM.NULL;
  +              child = dtm.getNextSibling(child))
         {
           try
           {
  @@ -469,10 +475,11 @@
     {
   
       XObject score;
  -    Node parent =
  -      xctxt.getDOMHelper().getParentOfNode(xctxt.getCurrentNode());
  +    int currentNode = xctxt.getCurrentNode();
  +    DTM dtm = xctxt.getDTM(currentNode);
  +    int parent = dtm.getParent(currentNode);
   
  -    if (null != parent)
  +    if (DTM.NULL != parent)
       {
         try
         {
  @@ -542,7 +549,7 @@
      *
      * @throws javax.xml.transform.TransformerException
      */
  -  public double getMatchScore(XPathContext xctxt, Node context)
  +  public double getMatchScore(XPathContext xctxt, int context)
             throws javax.xml.transform.TransformerException
     {
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.1   +2 -0      xml-xalan/java/src/org/w3c/dom/traversal/NodeIterator.java
  
  Index: NodeIterator.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/w3c/dom/traversal/NodeIterator.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- NodeIterator.java	2000/11/15 19:41:08	1.2
  +++ NodeIterator.java	2001/04/10 18:45:47	1.2.2.1
  @@ -104,5 +104,7 @@
        * raise the exception INVALID_STATE_ERR.
        */
       public void detach();
  +    
  +
   
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org