Part of fix for XALANJ-2294.  The way that SAXImpl.getIterator is used in
generated code makes it clear that XSLTC always expects the iterator to point to
the root of the DTM, rather than being affected by calls to setStartNode.  Added
the "constant" flag with a value of true on SingletonIterator constructed by
getIterator.

Also, added support for ROOT axis in getAxisIterator and getTypedAxisIterator.


Reviewed by Christine Li (jycli () ca ! ibm ! com)

diff --git a/src/org/apache/xalan/xsltc/dom/SAXImpl.java b/src/org/apache/xalan/xsltc/dom/SAXImpl.java
index 36f23ed..5c5cf41 100644
--- a/src/org/apache/xalan/xsltc/dom/SAXImpl.java
+++ b/src/org/apache/xalan/xsltc/dom/SAXImpl.java
@@ -458,11 +458,12 @@
 
     /**
      * Returns singleton iterator containg the document root
-     * Works for them main document (mark == 0)
+     * Works for them main document (mark == 0).  It cannot be made
+     * to point to any other node through setStartNode().
      */
     public DTMAxisIterator getIterator()
     {
-        return new SingletonIterator(getDocument());
+        return new SingletonIterator(getDocument(), true);
     }
 
      /**
@@ -1160,6 +1161,8 @@
                 return new PrecedingSiblingIterator();
             case Axis.NAMESPACE:
                 return new NamespaceIterator();
+            case Axis.ROOT:
+                return new RootIterator();
             default:
                 BasisLibrary.runTimeError(BasisLibrary.AXIS_SUPPORT_ERR, 
                         Axis.getNames(axis));
@@ -1210,6 +1213,8 @@
                 return new TypedPrecedingSiblingIterator(type);
             case Axis.NAMESPACE:
                 return  new TypedNamespaceIterator(type);
+            case Axis.ROOT:
+                return new TypedRootIterator(type);
             default:
                 BasisLibrary.runTimeError(BasisLibrary.TYPED_AXIS_SUPPORT_ERR, 
                         Axis.getNames(axis));