sboag       00/02/17 05:06:28

  Modified:    src      makexpath4j
               src/org/apache/xalan/xpath ExtensionFunctionHandler.java
                        SimpleNodeLocator.java UnionContext.java XPath.java
                        XPathEnvSupport.java XPathProcessorImpl.java
                        XPathSupportDefault.java
               src/org/apache/xalan/xpath/xdom XercesLiaison.java
               src/org/apache/xalan/xpath/xml FormatterToHTML.java
                        FormatterToXML.java StringVector.java
                        XMLParserLiaisonDefault.java
               src/org/apache/xalan/xslt ElemChoose.java
                        ElemExtensionCall.java ElemTemplateElement.java
                        ExtensionNSHandler.java
                        SerializableAttrListImpl.java
                        StylesheetHandler.java StylesheetRoot.java
                        XSLTEngineImpl.java
  Log:
  Changes to cache Method objects for java extensions, fixed regression for 
Simple flag, memory conservation.
  
  Revision  Changes    Path
  1.14      +1 -0      xml-xalan/src/makexpath4j
  
  Index: makexpath4j
  ===================================================================
  RCS file: /home/cvs/xml-xalan/src/makexpath4j,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- makexpath4j       2000/02/13 16:42:40     1.13
  +++ makexpath4j       2000/02/17 13:06:23     1.14
  @@ -113,6 +113,7 @@
        
   SRCS2 = \
        $(XMLLIAISONDIR)$(PATHSEP)AttList.java \
  +  $(XMLLIAISONDIR)$(PATHSEP)MutableAttrListImpl.java \
        $(XMLLIAISONDIR)$(PATHSEP)DefaultErrorHandler.java \
        $(XMLLIAISONDIR)$(PATHSEP)FormatterToDOM.java \
        $(XMLLIAISONDIR)$(PATHSEP)FormatterToXML.java \
  
  
  
  1.8       +284 -27   
xml-xalan/src/org/apache/xalan/xpath/ExtensionFunctionHandler.java
  
  Index: ExtensionFunctionHandler.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/src/org/apache/xalan/xpath/ExtensionFunctionHandler.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ExtensionFunctionHandler.java     2000/02/13 16:42:41     1.7
  +++ ExtensionFunctionHandler.java     2000/02/17 13:06:23     1.8
  @@ -63,6 +63,11 @@
   import org.w3c.dom.*;
   import org.xml.sax.*;
   
  +import com.ibm.bsf.BSFException;
  +import java.lang.reflect.*;
  +import com.ibm.cs.util.ReflectionUtils;
  +
  +
   /**
    * Class handling an extension namespace for XPath. Provides functions
    * to test a function's existence and call a function
  @@ -181,7 +186,239 @@
     {
       return (functions.get (function) != null);
     }
  +  
  +  Hashtable m_cachedMethods = null;
  +  
  +  /**
  +   * call the named method on the object that was loaded by eval. 
  +   * The method selection stuff is very XSLT-specific, hence the
  +   * custom engine.
  +   *
  +   * @param object ignored - should always be null
  +   */
  +  public Object callJava (Object object, String method, Object[] args, 
  +                          Object methodKey) 
  +    throws BSFException
  +  {
  +    // if the function name has a "." in it, then its a static
  +    // call with the args being arguments to the call. If it 
  +    // does not, then its a method call on args[0] with the rest
  +    // of the args as the arguments to the call
  +    int dotPos = method.lastIndexOf (".");
  +    Object[] methodArgs = null;
  +    boolean isNew = false;
  +    if (dotPos == -1) 
  +    {
  +      methodArgs = args;
  +      object = args[0];
  +      if (args.length > 1) 
  +      {
  +        methodArgs = new Object[args.length-1];
  +        System.arraycopy (args, 1, methodArgs, 0, args.length - 1);
  +      }
  +    }
  +    else 
  +    {
  +      String className = method.substring (0, dotPos);
  +      method = method.substring (dotPos+1);
  +      methodArgs = args;
  +      isNew = method.equals ("new");
  +      try 
  +      {
  +        if(null == object)
  +          object = Class.forName (className);
  +      }
  +      catch (ClassNotFoundException e) 
  +      {
  +        throw new BSFException(1, "unable to load class '" + 
  +          className + "'", e);
  +      }
  +    }
  +    
  +    if((null != m_cachedMethods) && !isNew && (null != object))
  +    {
  +      try
  +      {
  +        Method thisMethod = (Method)m_cachedMethods.get(methodKey);
  +        if(null != thisMethod)
  +        {
  +          return thisMethod.invoke (object, methodArgs);
  +        }
  +      }
  +      catch(Exception e)
  +      {
  +        // try again below...
  +      }
  +    
  +    }
   
  +    // determine the argument types as they are given
  +    Class[] argTypes = null;
  +    if (methodArgs != null) 
  +    {
  +      argTypes = new Class[methodArgs.length];
  +      for (int i = 0; i < argTypes.length; i++) 
  +      {
  +        argTypes[i] = (methodArgs[i]!=null) ? methodArgs[i].getClass() : 
null;
  +      }
  +    }
  +
  +    // try to find the method and run it, taking into account the special
  +    // type conversions we want. If an arg is a Double, we first try with
  +    // double and then with Double. Same for Boolean/boolean. This is done
  +    // wholesale tho - that is, if there are two Double args both are
  +    // tried double first and then Double.
  +    boolean done = false;
  +    boolean toggled = false;
  +    try 
  +    {
  +      while (!done) 
  +      {
  +        if (methodArgs == null) 
  +        {
  +          done = true; // nothing to retry - do as-is or give up
  +        }
  +        else 
  +        {
  +          if (!toggled) 
  +          {
  +            for (int i = 0; i < argTypes.length; i++) 
  +            {
  +              Class cl = argTypes[i];
  +              if (cl != null) 
  +              {
  +                if (cl == Double.class) 
  +                {
  +                  cl = double.class;
  +                }
  +                if (cl == Float.class) 
  +                {
  +                  cl = float.class;
  +                }
  +                else if (cl == Boolean.class) 
  +                {
  +                  cl = boolean.class;
  +                }
  +                else if (cl == Byte.class) 
  +                {
  +                  cl = byte.class;
  +                }
  +                else if (cl == Character.class) 
  +                {
  +                  cl = char.class;
  +                }
  +                else if (cl == Short.class) 
  +                {
  +                  cl = short.class;
  +                }
  +                else if (cl == Integer.class) 
  +                {
  +                  cl = int.class;
  +                }
  +                else if (cl == Long.class) 
  +                {
  +                  cl = long.class;
  +                }
  +                argTypes[i] = cl;
  +              }
  +            }
  +            toggled = true;
  +          }
  +          else 
  +          {
  +            for (int i = 0; i < argTypes.length; i++) 
  +            {
  +              Class cl = argTypes[i];
  +              if (cl != null) 
  +              {
  +                if (cl == double.class) 
  +                {
  +                  cl = Double.class;
  +                }
  +                if (cl == float.class) 
  +                {
  +                  cl = Float.class;
  +                }
  +                else if (cl == boolean.class) 
  +                {
  +                  cl = Boolean.class;
  +                }
  +                else if (cl == byte.class) 
  +                {
  +                  cl = Byte.class;
  +                }
  +                else if (cl == char.class) 
  +                {
  +                  cl = Character.class;
  +                }
  +                else if (cl == short.class) 
  +                {
  +                  cl = Short.class;
  +                }
  +                else if (cl == int.class) 
  +                {
  +                  cl = Integer.class;
  +                }
  +                else if (cl == long.class) 
  +                {
  +                  cl = Long.class;
  +                }
  +                argTypes[i] = cl;
  +              }
  +            }
  +            done = true;
  +          }
  +        }
  +        
  +        // now find method with the right signature, call it and return 
result.
  +        try 
  +        {
  +          if (isNew) 
  +          {
  +            // if its a "new" call then need to find and invoke a constructor
  +            // otherwise find and invoke the appropriate method. The method
  +            // searching logic is the same of course.
  +            Constructor c =
  +                           ReflectionUtils.getConstructor ((Class) object, 
argTypes);
  +            Object obj = c.newInstance (methodArgs);
  +            return obj;
  +          }
  +          else 
  +          {
  +            Method m = ReflectionUtils.getMethod (object, method, argTypes);
  +            Object returnObj = m.invoke (object, methodArgs);
  +            if(!isNew)
  +            {
  +              if(null == m_cachedMethods)
  +                m_cachedMethods = new Hashtable();
  +              m_cachedMethods.put(methodKey, m);
  +            }
  +            return returnObj;
  +          }
  +        }
  +        catch (NoSuchMethodException e) 
  +        {
  +          // ignore if not done looking
  +          if (done) 
  +          {
  +            throw e;
  +          }
  +        }
  +      }
  +    }
  +    catch (Exception e) 
  +    {
  +      Throwable t = (e instanceof InvocationTargetException) ?
  +                    ((InvocationTargetException)e).getTargetException () :
  +                    null;
  +      throw new BSFException (BSFException.REASON_OTHER_ERROR,
  +        "method call/new failed: " + e +
  +        ((t==null)?"":(" target exception: "+t)), t);
  +    }
  +    // should not get here
  +    return null;
  +  }
  +
     /////////////////////////////////////////////////////////////////////////
   
     /**
  @@ -199,14 +436,15 @@
      * @exception IOException           if loading trouble
      * @exception SAXException          if parsing trouble
      */
  -  public Object callFunction (String funcName, Vector args)
  +  public Object callFunction (String funcName, Vector args, Object 
methodKey, Class javaClass)
       throws XPathException 
     {
       if (!componentStarted) 
       {
  -      startupComponent ();
  +      startupComponent (javaClass);
       }
   
  +    boolean isJava = false;
       try 
       {
         com.ibm.bsf.BSFEngine e;
  @@ -224,6 +462,7 @@
         boolean isCTorCall = false;
         if (scriptLang.equals ("javaclass")) 
         {
  +        isJava = true;
           isCTorCall = funcName.equals("new");
           e = mgr.loadScriptingEngine ("xslt-javaclass");
           if(isCTorCall)
  @@ -244,8 +483,11 @@
               }
               
               argArray = new Object[args.size () + 1];
  +            
               argArray[0] = javaObject;
               argStart = 1;
  +            // argArray = new Object[args.size ()];
  +            // argStart = 0;
             }
             else
             {
  @@ -268,8 +510,11 @@
           argArray[i+argStart] = 
                                 (o instanceof XObject) ? ((XObject)o).object 
() : o;
         }
  -
  -      return e.call (null, funcName, argArray);
  +      
  +      if(isJava)
  +        return callJava(javaObject, funcName, argArray, methodKey);
  +      else
  +        return e.call (null, funcName, argArray);
       }
       catch (Exception e) 
       {
  @@ -303,7 +548,7 @@
      * 
      * @exception XPathProcessorException if something bad happens.
      */
  -  protected void startupComponent () throws  XPathProcessorException 
  +  protected void startupComponent (Class classObj) throws  
XPathProcessorException 
     {
       if(!bsfInitialized)
       {
  @@ -320,34 +565,46 @@
       // the class name to run. If it starts with class: then use the
       // class object with that name instead of init'ing it as the
       // target of the calls later
  -    if (scriptLang.equals ("javaclass") && (scriptSrcURL != null)) 
  +    if(null != classObj)
       {
  -      try 
  +      classObject = classObj;
  +      if (scriptSrcURL.startsWith ("class:")) 
         {
  -        String cname = scriptSrcURL;
  -        boolean isClass = false;
  -        if (scriptSrcURL.startsWith ("class:")) 
  -        {
  -          cname = scriptSrcURL.substring (6);
  -          isClass = true;
  -        }
  -        classObject = Class.forName (cname);
  -        if (isClass) 
  +        javaObject = classObj;
  +      }
  +      return;
  +    }
  +    else
  +    {
  +      if (scriptLang.equals ("javaclass") && (scriptSrcURL != null)) 
  +      {
  +        try 
           {
  -          javaObject = classObject;
  +          String cname = scriptSrcURL;
  +          boolean isClass = false;
  +          if (scriptSrcURL.startsWith ("class:")) 
  +          {
  +            cname = scriptSrcURL.substring (6);
  +            isClass = true;
  +          }
  +          classObject = Class.forName (cname);
  +          if (isClass) 
  +          {
  +            javaObject = classObject;
  +          }
  +          else
  +          {
  +            // We'll only do this if they haven't called a ctor.
  +            // javaObject = classObject.newInstance ();
  +          }
  +          componentStarted = true;
  +          return;
           }
  -        else
  +        catch (Exception e) 
           {
  -          // We'll only do this if they haven't called a ctor.
  -          // javaObject = classObject.newInstance ();
  +          // System.out.println("Extension error: "+e.getMessage ());
  +          throw new XPathProcessorException (e.getMessage (), e);
           }
  -        componentStarted = true;
  -        return;
  -      }
  -      catch (Exception e) 
  -      {
  -        // System.out.println("Extension error: "+e.getMessage ());
  -        throw new XPathProcessorException (e.getMessage (), e);
         }
       }
   
  
  
  
  1.13      +6 -2      
xml-xalan/src/org/apache/xalan/xpath/SimpleNodeLocator.java
  
  Index: SimpleNodeLocator.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/src/org/apache/xalan/xpath/SimpleNodeLocator.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- SimpleNodeLocator.java    2000/02/13 16:42:41     1.12
  +++ SimpleNodeLocator.java    2000/02/17 13:06:23     1.13
  @@ -236,7 +236,7 @@
     {
       XNodeSet resultNodeSet = null;
       
  -    opPos = xpath.getFirstChildPos(opPos);
  +    opPos = xpath.getFirstChildPos(opPos); 
   
       while((xpath.m_opMap[opPos] & XPath.LOCATIONPATHEX_MASK) == 
xpath.OP_LOCATIONPATH)
       {
  @@ -291,11 +291,15 @@
       throws org.xml.sax.SAXException
     {    
       XNodeSet results;
  -    boolean isSimpleFollowing = (0 != (xpath.m_opMap[opPos] & 
XPath.LOCATIONPATHEX_MASK));
  +    boolean isSimpleFollowing = (0 != (xpath.m_opMap[opPos] & 
XPath.LOCATIONPATHEX_ISSIMPLE));
       opPos = xpath.getFirstChildPos(opPos);
       MutableNodeList mnl;
       try
       {
  +      if(xpath.m_currentPattern.equals("mi/fct/rd"))
  +      {
  +        int x = 4;
  +      }
         mnl = step(xpath, execContext, context, opPos,
                    callback, callbackInfo, isSimpleFollowing, false);
       }
  
  
  
  1.3       +1 -1      xml-xalan/src/org/apache/xalan/xpath/UnionContext.java
  
  Index: UnionContext.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xpath/UnionContext.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- UnionContext.java 2000/02/13 16:42:41     1.2
  +++ UnionContext.java 2000/02/17 13:06:24     1.3
  @@ -123,7 +123,7 @@
     /**
      * This flag must be set down to the bottom of the stack. It tells 
      * that all following nodes must be tested.
  -   */
  +   */ 
     static final int FLAG_SHOULDWALKFOLLOWING = (0x00000001 << 3);
   
     IntStack[] m_stacks = new IntStack[INITIALTABLEWIDTH*SLOTSPERVALUE];
  
  
  
  1.17      +11 -9     xml-xalan/src/org/apache/xalan/xpath/XPath.java
  
  Index: XPath.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xpath/XPath.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- XPath.java        2000/02/16 19:12:54     1.16
  +++ XPath.java        2000/02/17 13:06:24     1.17
  @@ -996,25 +996,25 @@
      */
     protected XObject extfunction(XPathSupport execContext, Node context, int 
opPos, 
                                   String namespace, String extensionName, 
  -                                Vector argVec) 
  +                                Vector argVec, Object methodKey) 
       throws org.xml.sax.SAXException
     {
       XObject result;
       Object val = execContext.extFunction(namespace, extensionName, 
  -                                         argVec);
  +                                         argVec, methodKey);
       if(null != val)
       {
  -      if(val instanceof XLocator)
  +      if(val instanceof XObject)
         {
  +        result = (XObject)val;
  +      }
  +      else if(val instanceof XLocator)
  +      {
           XLocator locator = (XLocator)val;
           opPos = getNextOpPos(opPos+1);
           result = locator.connectToNodes(this, execContext, context, opPos, 
argVec);  
           // System.out.println("nodeset len: "+result.nodeset().getLength());
         }
  -      else if(val instanceof XObject)
  -      {
  -        result = (XObject)val;
  -      }
         else if(val instanceof String)
         {
           result = new XString((String)val);
  @@ -1356,7 +1356,9 @@
                 args.addElement( execute(execContext, context, opPos) );
                 opPos = nextOpPos;
               }
  -            result = extfunction(execContext, context, opPos, ns, funcName, 
args);
  +            result = extfunction(execContext, context, opPos, ns, funcName, 
args, 
  +                                 // Create a method key, for faster lookup.
  +                                 
String.valueOf(m_opMap[opPos])+String.valueOf(((Object)this).hashCode()));
             }
             break;
         case OP_FUNCTION:
  @@ -1985,7 +1987,7 @@
      *  XNodeSet
      */
     public static final int OP_LOCATIONPATH = 28;
  -  public static final int LOCATIONPATHEX_MASK = 0xFFFF0000;
  +  public static final int LOCATIONPATHEX_MASK = 0x0000FFFF;
     public static final int LOCATIONPATHEX_ISSIMPLE = 0x00010000;
     public static final int OP_LOCATIONPATH_EX = (28 | 0x00010000);
       
  
  
  
  1.4       +1 -1      xml-xalan/src/org/apache/xalan/xpath/XPathEnvSupport.java
  
  Index: XPathEnvSupport.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/src/org/apache/xalan/xpath/XPathEnvSupport.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XPathEnvSupport.java      1999/12/16 06:10:44     1.3
  +++ XPathEnvSupport.java      2000/02/17 13:06:24     1.4
  @@ -103,7 +103,7 @@
      * Handle an extension function.
      */
     public Object extFunction(String namespace, String extensionName, 
  -                                Vector argVec)
  +                                Vector argVec, Object methodKey)
       throws org.xml.sax.SAXException;
     
     /**
  
  
  
  1.18      +42 -35    
xml-xalan/src/org/apache/xalan/xpath/XPathProcessorImpl.java
  
  Index: XPathProcessorImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/src/org/apache/xalan/xpath/XPathProcessorImpl.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- XPathProcessorImpl.java   2000/02/13 16:42:41     1.17
  +++ XPathProcessorImpl.java   2000/02/17 13:06:24     1.18
  @@ -1764,49 +1764,56 @@
      */
     static boolean isLocationPathSimpleFollowing(XPath xpath, int opPos)
     {
  -    int posOfLastOp = xpath.getNextOpPos(opPos)-1;
  -    
  -    opPos = xpath.getFirstChildPos(opPos);
  -    // step
  -    int stepType = xpath.m_opMap[opPos];
  -    
  -    // make sure all step types are going forwards
  -    switch(stepType)
  +    if(true)
       {
  -    case XPath.FROM_SELF:
  -    case XPath.FROM_ATTRIBUTES:
  -    case XPath.FROM_CHILDREN:
  -    case XPath.FROM_DESCENDANTS:
  -    case XPath.FROM_DESCENDANTS_OR_SELF:
  -    case XPath.FROM_FOLLOWING:
  -    case XPath.FROM_FOLLOWING_SIBLINGS:
  -      if(xpath.m_opMap[xpath.getNextOpPos(opPos)] == xpath.ENDOP)
  +      int posOfLastOp = xpath.getNextOpPos(opPos)-1;
  +      
  +      opPos = xpath.getFirstChildPos(opPos);
  +      // step
  +      int stepType = xpath.m_opMap[opPos];
  +      
  +      // make sure all step types are going forwards
  +      switch(stepType)
         {
  -        // Add the length of the step itself, plus the length of the op, 
  -        // and two length arguments, to the op position.
  -        opPos = 
(xpath.getArgLengthOfStep(opPos)+xpath.getFirstChildPosOfStep(opPos));
  -        int nextStepType = xpath.m_opMap[opPos];
  -                
  -        if(xpath.OP_PREDICATE == nextStepType)
  +      case XPath.FROM_SELF:
  +      case XPath.FROM_ATTRIBUTES:
  +      case XPath.FROM_CHILDREN:
  +      case XPath.FROM_DESCENDANTS:
  +      case XPath.FROM_DESCENDANTS_OR_SELF:
  +      case XPath.FROM_FOLLOWING:
  +      case XPath.FROM_FOLLOWING_SIBLINGS:
  +        if(xpath.m_opMap[xpath.getNextOpPos(opPos)] == xpath.ENDOP)
           {
  -          int firstPredPos = opPos+2;
  -          int predicateType = xpath.m_opMap[firstPredPos];
  -          if((XPath.OP_NUMBERLIT == predicateType) || (XPath.OP_NUMBER == 
predicateType)
  -             || (XPath.FUNC_NUMBER == predicateType))
  +          // Add the length of the step itself, plus the length of the op, 
  +          // and two length arguments, to the op position.
  +          opPos = 
(xpath.getArgLengthOfStep(opPos)+xpath.getFirstChildPosOfStep(opPos));
  +          int nextStepType = xpath.m_opMap[opPos];
  +          
  +          if(xpath.OP_PREDICATE == nextStepType)
             {
  -            return false;
  +            int firstPredPos = opPos+2;
  +            int predicateType = xpath.m_opMap[firstPredPos];
  +            if((XPath.OP_NUMBERLIT == predicateType) || (XPath.OP_NUMBER == 
predicateType)
  +               || (XPath.FUNC_NUMBER == predicateType))
  +            {
  +              return false;
  +            }
  +            opPos = xpath.getNextOpPos(opPos);
  +            nextStepType = xpath.m_opMap[opPos];
  +            // Multiple predicates?
  +            if(xpath.OP_PREDICATE == nextStepType)
  +              return false;
             }
  -          opPos = xpath.getNextOpPos(opPos);
  -          nextStepType = xpath.m_opMap[opPos];
  -          // Multiple predicates?
  -          if(xpath.OP_PREDICATE == nextStepType)
  -            return false;
  +          return true;
           }
  -        return true;
  +        break;
         }
  -      break;
  +      return false;
  +    }
  +    else
  +    {
  +      return false;
       }
  -    return false;
     }
   
   
  
  
  
  1.11      +1 -1      
xml-xalan/src/org/apache/xalan/xpath/XPathSupportDefault.java
  
  Index: XPathSupportDefault.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/src/org/apache/xalan/xpath/XPathSupportDefault.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- XPathSupportDefault.java  2000/02/14 22:22:39     1.10
  +++ XPathSupportDefault.java  2000/02/17 13:06:24     1.11
  @@ -491,7 +491,7 @@
      * Handle an extension function.
      */
     public Object extFunction(String namespace, String extensionName, 
  -                                Vector argVec)
  +                                Vector argVec, Object methodKey)
       throws org.xml.sax.SAXException
     {
       return null;
  
  
  
  1.6       +29 -13    
xml-xalan/src/org/apache/xalan/xpath/xdom/XercesLiaison.java
  
  Index: XercesLiaison.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/src/org/apache/xalan/xpath/xdom/XercesLiaison.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XercesLiaison.java        2000/02/01 14:26:26     1.5
  +++ XercesLiaison.java        2000/02/17 13:06:25     1.6
  @@ -353,22 +353,38 @@
       return isIgnorable;
     }
     
  -  /*
     public String getNamespaceOfNode(Node n)
     {
  -    String ns;
  -    
  -    if(Node.ATTRIBUTE_NODE == n.getNodeType())
  -    {
  -      ns = null;
  -    }
  -    else
  -    {
  -      ns = super.getNamespaceOfNode(n);
  -    }
  -    return ns;
  +    return ((org.apache.xerces.dom.NodeImpl)n).getNamespaceURI();
     }
  -  */
  +  
  +  /**
  +   * Returns the local name of the given node.
  +   */
  +  // public String getLocalNameOfNode(Node n)
  +  // {
  +  //   return ((org.apache.xerces.dom.NodeImpl)n).getLocalName();
  +  // }
  +
  +  /**
  +   * Returns the element name with the namespace expanded.
  +   */
  +   // public String getExpandedElementName(Element elem)
  +   // {
  +    //  String namespace = getNamespaceOfNode(elem);
  +   //   return (null != namespace) ? namespace+":"+ getLocalNameOfNode(elem) 
  +   //                                : getLocalNameOfNode(elem);
  +   // }
  +
  +  /**
  +   * Returns the attribute name with the namespace expanded.
  +   */
  +   // public String getExpandedAttributeName(Attr attr)
  +   // {
  +    //  String namespace = getNamespaceOfNode(attr);
  +   //   return (null != namespace) ? namespace+":"+ getLocalNameOfNode(attr) 
  +    //                               : getLocalNameOfNode(attr);
  +   // }
     
     /**
      * Get the parent of a node.
  
  
  
  1.22      +4 -3      
xml-xalan/src/org/apache/xalan/xpath/xml/FormatterToHTML.java
  
  Index: FormatterToHTML.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/src/org/apache/xalan/xpath/xml/FormatterToHTML.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- FormatterToHTML.java      2000/02/09 21:09:01     1.21
  +++ FormatterToHTML.java      2000/02/17 13:06:25     1.22
  @@ -219,7 +219,7 @@
       m_elementFlags.put("TBODY", new ElemDesc(0|ElemDesc.BLOCK));
       m_elementFlags.put("COLGROUP", new ElemDesc(0|ElemDesc.BLOCK));
       m_elementFlags.put("COL", new ElemDesc(0|ElemDesc.EMPTY|ElemDesc.BLOCK));
  -    m_elementFlags.put("TR", new ElemDesc(0|ElemDesc.BLOCK));
  +    m_elementFlags.put("TR", new ElemDesc(0));
       m_elementFlags.put("TH", new ElemDesc(0));
       m_elementFlags.put("TD", new ElemDesc(0));
       m_elementFlags.put("HEAD", new ElemDesc(0|ElemDesc.BLOCK));
  @@ -297,7 +297,6 @@
   
       elemDesc = (ElemDesc)m_elementFlags.get("HEAD");
       elemDesc.setAttr("PROFILE", ElemDesc.ATTRURL);
  -   
     }
     
     /**
  @@ -465,10 +464,12 @@
       // ElemDesc parentElemDesc = getElemDesc(m_currentElementName);
       
       boolean isBlockElement = elemDesc.is(ElemDesc.BLOCK);
  +    // boolean isWhiteSpaceSensitive = 
elemDesc.is(ElemDesc.WHITESPACESENSITIVE);
       
       if(m_ispreserve)
         m_ispreserve = false;
  -    else if(m_doIndent && (null != m_currentElementName) && (!m_inBlockElem 
|| isBlockElement))
  +    else if(m_doIndent && (null != m_currentElementName) && (!m_inBlockElem 
|| isBlockElement)
  +            /* && !isWhiteSpaceSensitive */ )
       {
         m_startNewLine = true;
         indent(m_currentIndent);
  
  
  
  1.23      +12 -7     
xml-xalan/src/org/apache/xalan/xpath/xml/FormatterToXML.java
  
  Index: FormatterToXML.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/src/org/apache/xalan/xpath/xml/FormatterToXML.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- FormatterToXML.java       2000/02/16 18:25:50     1.22
  +++ FormatterToXML.java       2000/02/17 13:06:25     1.23
  @@ -80,6 +80,8 @@
      */
     protected  Writer m_writer      =   null;
     
  +  boolean m_shouldFlush = true;
  +  
     protected OutputStream m_outputStream = null;
     
     private boolean m_bytesEqualChars = false;
  @@ -321,6 +323,7 @@
      */
     public FormatterToXML(Writer writer) 
     {
  +    m_shouldFlush = false;
       m_writer = writer;
       initEncodings();
     }
  @@ -379,7 +382,8 @@
      * @param format The output format
      */
     public synchronized void init( Writer writer, OutputFormat format )
  -  {        
  +  {
  +    m_shouldFlush = false;
       this.m_writer   =   writer;
       // This is to get around differences between Xalan and Xerces.
       // Xalan uses -1 as default for no indenting, Xerces uses 0.
  @@ -879,8 +883,8 @@
           }
         }
       }
  -    catch(IOException ioe)
  -    {
  +    catch(IOException ioe) 
  +    { 
         throw new SAXException("IO error", ioe);
       }
     }
  @@ -991,7 +995,6 @@
     {
       try
       {
  -      // System.out.println("Flushing bytes...");
         this.m_outputStream.write(m_byteBuf, 0, m_pos);
         m_pos = 0;
       }
  @@ -1006,9 +1009,11 @@
     {
       try
       {
  -      // System.out.println("Flushing chars...");
         this.m_writer.write(m_charBuf, 0, m_pos);
  -      this.m_writer.flush();
  +      if(m_shouldFlush)
  +      {
  +        this.m_writer.flush(); 
  +      }
         m_pos = 0;
       }
       catch(IOException ioe)
  @@ -1444,7 +1449,7 @@
       for (int i = 0;  i < n;  i ++)
         accum(' ');
     }
  -
  + 
     /**
      * Prints a newline character and <var>n</var> spaces.
      * @param pw        The character output stream to use.
  
  
  
  1.4       +5 -5      
xml-xalan/src/org/apache/xalan/xpath/xml/StringVector.java
  
  Index: StringVector.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/src/org/apache/xalan/xpath/xml/StringVector.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- StringVector.java 1999/12/13 07:40:11     1.3
  +++ StringVector.java 2000/02/17 13:06:25     1.4
  @@ -62,10 +62,10 @@
    */
   public class StringVector
   {
  -  private int m_blocksize;
  -  private String m_map[];
  -  private int m_firstFree = 0;
  -  private int m_mapSize;
  +  protected int m_blocksize;
  +  protected String m_map[];
  +  protected int m_firstFree = 0;
  +  protected int m_mapSize;
   
     /**
      * Default constructor.  Note that the default 
  @@ -91,7 +91,7 @@
     /**
      * Get the length of the list.
      */
  -  public final int getLength()
  +  public int getLength()
     {
       return m_firstFree;
     }
  
  
  
  1.21      +6 -4      
xml-xalan/src/org/apache/xalan/xpath/xml/XMLParserLiaisonDefault.java
  
  Index: XMLParserLiaisonDefault.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/src/org/apache/xalan/xpath/xml/XMLParserLiaisonDefault.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- XMLParserLiaisonDefault.java      2000/02/13 16:42:43     1.20
  +++ XMLParserLiaisonDefault.java      2000/02/17 13:06:25     1.21
  @@ -1791,7 +1791,8 @@
      *
      * @return result of executing the function
      */
  -  public Object extFunction (String ns, String funcName, Vector argVec)
  +  public Object extFunction (String ns, String funcName, Vector argVec, 
  +                             Object methodKey)
       throws org.xml.sax.SAXException
     {
       if(null == m_extensionFunctionNamespaces.get 
("http://xml.apache.org/xslt/java";))
  @@ -1835,8 +1836,9 @@
         {
           try 
           {
  -          String cname = ns.startsWith ("class:") ? ns.substring (6) : ns;
  -          Class.forName (cname); // does it load?
  +          // Scott: I don't think this is doing anything for us.
  +          // String cname = ns.startsWith ("class:") ? ns.substring (6) : ns;
  +          // Class.forName (cname); // does it load?
             extNS = new ExtensionFunctionHandler (ns, null, "javaclass",
                                                   ns, null);
             addExtensionNamespace (ns, extNS);
  @@ -1851,7 +1853,7 @@
         {
           try
           {
  -          result = extNS.callFunction (funcName, argVec);
  +          result = extNS.callFunction (funcName, argVec, methodKey, null);
           }
           catch (Exception e)
           {
  
  
  
  1.5       +3 -2      xml-xalan/src/org/apache/xalan/xslt/ElemChoose.java
  
  Index: ElemChoose.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xslt/ElemChoose.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ElemChoose.java   2000/02/08 15:36:19     1.4
  +++ ElemChoose.java   2000/02/17 13:06:26     1.5
  @@ -111,7 +111,7 @@
           ElemWhen when = (ElemWhen)node;
           // must be xsl:when
           XPathSupport execContext = processor.getXMLProcessorLiaison();
  -
  +        
           XObject test = when.m_test.execute(execContext, sourceNode, this);
           if(null != m_stylesheet.m_stylesheetRoot.m_traceListeners)
           {
  @@ -122,7 +122,8 @@
                                                                                
when.m_test,
                                                                                
test));
           }
  -        if(test.bool())
  +
  +        if((null != test) && test.bool())
           {
             when.executeChildren(processor, sourceTree, 
                                  sourceNode, mode);
  
  
  
  1.6       +24 -2     
xml-xalan/src/org/apache/xalan/xslt/ElemExtensionCall.java
  
  Index: ElemExtensionCall.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/src/org/apache/xalan/xslt/ElemExtensionCall.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ElemExtensionCall.java    2000/02/13 16:42:44     1.5
  +++ ElemExtensionCall.java    2000/02/17 13:06:26     1.6
  @@ -64,6 +64,7 @@
   import org.apache.xalan.xpath.xml.NameSpace;
   import org.apache.xalan.xpath.xml.StringToStringTable;
   import org.apache.xalan.xpath.xml.XMLParserLiaisonDefault;
  +import org.apache.xalan.xpath.xml.MutableAttrListImpl;
   
   import java.io.*;
   import java.util.*;
  @@ -82,6 +83,7 @@
     String m_lang;
     String m_srcURL;
     String m_scriptSrc;
  +  Class m_javaClass = null;
   
     public int getXSLToken()
     {
  @@ -106,11 +108,31 @@
       m_lang = lang;
       m_srcURL = srcURL;
       m_scriptSrc = scriptSrc;
  +    
  +    if (m_lang.equals ("javaclass") && (m_srcURL != null)) 
  +    {
  +      try 
  +      {
  +        String cname = m_srcURL;
  +        boolean isClass = false;
  +        if (cname.startsWith ("class:")) 
  +        {
  +          cname = m_scriptSrc.substring (6);
  +          isClass = true;
  +        }
  +        // m_javaClass = Class.forName (cname);
  +      }
  +      catch (Exception e) 
  +      {
  +        // System.out.println("Extension error: "+e.getMessage ());
  +        throw new XSLProcessorException (e.getMessage (), e);
  +      }
  +    }
   
       // this.nsh = nsh;
       // 
processor.getXMLProcessorLiaison().addExtensionNamespace(m_extHandlerLookup, 
nsh);
       this.localPart = localPart;
  -    m_attrs = new AttributeListImpl(atts);
  +    m_attrs = new MutableAttrListImpl(atts);
       int nAttrs = atts.getLength();
       for(int i = 0; i < nAttrs; i++)
       {
  @@ -199,7 +221,7 @@
         nsh.processElement (localPart, this,
                             processor, 
                             m_stylesheet,
  -                          sourceTree, sourceNode, mode);
  +                          sourceTree, sourceNode, mode, m_javaClass);
       }
       catch(Exception e)
       {
  
  
  
  1.17      +8 -3      
xml-xalan/src/org/apache/xalan/xslt/ElemTemplateElement.java
  
  Index: ElemTemplateElement.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/src/org/apache/xalan/xslt/ElemTemplateElement.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- ElemTemplateElement.java  2000/02/13 16:42:44     1.16
  +++ ElemTemplateElement.java  2000/02/17 13:06:26     1.17
  @@ -384,7 +384,7 @@
      * track of namespaces.  This will check namespace decls for aliasing.
      */
     void addResultAttribute(Stack resultNameSpaces, 
  -                          AttributeListImpl attList, 
  +                          MutableAttrListImpl attList, 
                             String aname, 
                             String value)
     {
  @@ -631,8 +631,8 @@
       boolean savedPendingStartDoc = processor.m_pendingStartDoc;
       String savedPendingName = processor.m_pendingElementName;
       processor.m_pendingElementName = null;
  -    AttributeListImpl savedPendingAttributes = processor.m_pendingAttributes;
  -    processor.m_pendingAttributes = new AttributeListImpl();
  +    MutableAttrListImpl savedPendingAttributes = 
processor.m_pendingAttributes;
  +    processor.m_pendingAttributes = new MutableAttrListImpl();
       
       executeChildren(processor, sourceTree, sourceNode, mode);
       
  @@ -1276,6 +1276,11 @@
     public String getBaseIdentifier()
     {
       return m_baseident;
  +  }
  +  
  +  class xhashtable extends Hashtable
  +  {
  +    public Object get(Object obj){return null; }
     }
     
    }
  
  
  
  1.5       +6 -5      
xml-xalan/src/org/apache/xalan/xslt/ExtensionNSHandler.java
  
  Index: ExtensionNSHandler.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/src/org/apache/xalan/xslt/ExtensionNSHandler.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ExtensionNSHandler.java   1999/12/14 00:21:55     1.4
  +++ ExtensionNSHandler.java   2000/02/17 13:06:26     1.5
  @@ -228,7 +228,8 @@
     public void processElement (String localPart, Element element,
                                 XSLTEngineImpl processor, 
                                 Stylesheet stylesheetTree, 
  -                              Node sourceTree, Node sourceNode, QName mode)
  +                              Node sourceTree, Node sourceNode, QName mode,
  +                              Class classObj)
       throws XSLProcessorException, 
              MalformedURLException, 
              FileNotFoundException, 
  @@ -239,7 +240,7 @@
       {
         try 
         {
  -        startupComponent ();
  +        startupComponent (classObj);
         }
         catch (XPathProcessorException e) 
         {
  @@ -257,7 +258,7 @@
         Vector argv = new Vector (2);
         argv.addElement (xpc);
         argv.addElement (element);
  -      result = super.callFunction (localPart, argv);
  +      result = super.callFunction (localPart, argv, this, classObj);
       }
       catch (XPathProcessorException e) 
       {
  @@ -282,7 +283,7 @@
      * 
      * @exception XPathProcessorException if something bad happens.
      */
  -  protected void startupComponent () throws  XPathProcessorException 
  +  protected void startupComponent (Class classObj) throws  
XPathProcessorException 
     {
       if(!bsfInitialized)
       {
  @@ -306,7 +307,7 @@
           throw new XPathProcessorException (e.getMessage (), e);
         }
       }
  -    super.startupComponent ();
  +    super.startupComponent (classObj);
     }
   
     /////////////////////////////////////////////////////////////////////////
  
  
  
  1.2       +2 -230    
xml-xalan/src/org/apache/xalan/xslt/SerializableAttrListImpl.java
  
  Index: SerializableAttrListImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/src/org/apache/xalan/xslt/SerializableAttrListImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SerializableAttrListImpl.java     1999/11/08 20:56:35     1.1
  +++ SerializableAttrListImpl.java     2000/02/17 13:06:26     1.2
  @@ -62,39 +62,9 @@
   import java.io.Serializable;
   
   /**
  -  * Convenience implementation for AttributeList.
  -  *
  -  * <p>This class provides a convenience implementation of the SAX
  -  * AttributeList class.  This implementation is useful both
  -  * for SAX parser writers, who can use it to provide attributes
  -  * to the application, and for SAX application writers, who can
  -  * use it to create a persistent copy of an element's attribute
  -  * specifications:</p>
  -  *
  -  * <pre>
  -  * private AttributeList myatts;
  -  *
  -  * public void startElement (String name, AttributeList atts)
  -  * {
  -  *              // create a persistent copy of the attribute list
  -  *              // for use outside this method
  -  *   myatts = new AttributeListImpl(atts);
  -  *   [...]
  -  * }
  -  * </pre>
  -  *
  -  * <p>Please note that SAX parsers are not required to use this
  -  * class to provide an implementation of AttributeList; it is
  -  * supplied only as an optional convenience.  In particular, 
  -  * parser writers are encouraged to invent more efficient
  -  * implementations.</p>
  -  *
  -  * @author David Megginson ([EMAIL PROTECTED])
  -  * @version Revision: 33 1.3 
src/org/xml/sax/helpers/AttributeListImpl.java, xml4jsrc, xml4j-jtcsv, 
xml4j_1_1_9 
  -  * @see org.xml.sax.AttributeList
  -  * @see org.xml.sax.DocumentHandler#startElement
  +  * @deprecated
     */
  -public class SerializableAttrListImpl implements AttributeList, Serializable
  +public class SerializableAttrListImpl extends 
org.apache.xalan.xpath.xml.MutableAttrListImpl
   {
   
     /**
  @@ -126,202 +96,4 @@
     {
       setAttributeList(atts);
     }
  -
  -  //////////////////////////////////////////////////////////////////////
  -  // Methods specific to this class.
  -  //////////////////////////////////////////////////////////////////////
  -
  -
  -  /**
  -    * Set the attribute list, discarding previous contents.
  -    *
  -    * <p>This method allows an application writer to reuse an
  -    * attribute list easily.</p>
  -    *
  -    * @param atts The attribute list to copy.
  -    */
  -  public void setAttributeList (AttributeList atts)
  -  {
  -    int count = atts.getLength();
  -
  -    clear();
  -
  -    for (int i = 0; i < count; i++) {
  -      addAttribute(atts.getName(i), atts.getType(i), atts.getValue(i));
  -    }
  -  }
  -
  -
  -  /**
  -    * Add an attribute to an attribute list.
  -    *
  -    * <p>This method is provided for SAX parser writers, to allow them
  -    * to build up an attribute list incrementally before delivering
  -    * it to the application.</p>
  -    *
  -    * @param name The attribute name.
  -    * @param type The attribute type ("NMTOKEN" for an enumeration).
  -    * @param value The attribute value (must not be null).
  -    * @see #removeAttribute
  -    * @see org.xml.sax.DocumentHandler#startElement
  -    */
  -  public void addAttribute (String name, String type, String value)
  -  {
  -    names.addElement(name);
  -    types.addElement(type);
  -    values.addElement(value);
  -  }
  -
  -
  -  /**
  -    * Remove an attribute from the list.
  -    *
  -    * <p>SAX application writers can use this method to filter an
  -    * attribute out of an AttributeList.  Note that invoking this
  -    * method will change the length of the attribute list and
  -    * some of the attribute's indices.</p>
  -    *
  -    * <p>If the requested attribute is not in the list, this is
  -    * a no-op.</p>
  -    *
  -    * @param name The attribute name.
  -    * @see #addAttribute
  -    */
  -  public void removeAttribute (String name)
  -  {
  -    int i = names.indexOf(name);
  -
  -    if (i >= 0) {
  -      names.removeElementAt(i);
  -      types.removeElementAt(i);
  -      values.removeElementAt(i);
  -    }
  -  }
  -
  -
  -  /**
  -    * Clear the attribute list.
  -    *
  -    * <p>SAX parser writers can use this method to reset the attribute
  -    * list between DocumentHandler.startElement events.  Normally,
  -    * it will make sense to reuse the same AttributeListImpl object
  -    * rather than allocating a new one each time.</p>
  -    *
  -    * @see org.xml.sax.DocumentHandler#startElement
  -    */
  -  public void clear ()
  -  {
  -    names.removeAllElements();
  -    types.removeAllElements();
  -    values.removeAllElements();
  -  }
  -
  -  //////////////////////////////////////////////////////////////////////
  -  // Implementation of org.xml.sax.AttributeList
  -  //////////////////////////////////////////////////////////////////////
  -
  -
  -  /**
  -    * Return the number of attributes in the list.
  -    *
  -    * @return The number of attributes in the list.
  -    * @see org.xml.sax.AttributeList#getLength
  -    */
  -  public int getLength ()
  -  {
  -    return names.size();
  -  }
  -
  -
  -  /**
  -    * Get the name of an attribute (by position).
  -    *
  -    * @param i The position of the attribute in the list.
  -    * @return The attribute name as a string, or null if there
  -    *         is no attribute at that position.
  -    * @see org.xml.sax.AttributeList#getName(int)
  -    */
  -  public String getName (int i)
  -  {
  -    try {
  -      return (String)names.elementAt(i);
  -    } catch (ArrayIndexOutOfBoundsException e) {
  -      return null;
  -    }
  -  }
  -
  -
  -  /**
  -    * Get the type of an attribute (by position).
  -    *
  -    * @param i The position of the attribute in the list.
  -    * @return The attribute type as a string ("NMTOKEN" for an
  -    *         enumeration, and "CDATA" if no declaration was
  -    *         read), or null if there is no attribute at
  -    *         that position.
  -    * @see org.xml.sax.AttributeList#getType(int)
  -    */
  -  public String getType (int i)
  -  {
  -    try {
  -      return (String)types.elementAt(i);
  -    } catch (ArrayIndexOutOfBoundsException e) {
  -      return null;
  -    }
  -  }
  -
  -
  -  /**
  -    * Get the value of an attribute (by position).
  -    *
  -    * @param i The position of the attribute in the list.
  -    * @return The attribute value as a string, or null if
  -    *         there is no attribute at that position.
  -    * @see org.xml.sax.AttributeList#getValue(int)
  -    */
  -  public String getValue (int i)
  -  {
  -    try {
  -      return (String)values.elementAt(i);
  -    } catch (ArrayIndexOutOfBoundsException e) {
  -      return null;
  -    }
  -  }
  -
  -
  -  /**
  -    * Get the type of an attribute (by name).
  -    *
  -    * @param name The attribute name.
  -    * @return The attribute type as a string ("NMTOKEN" for an
  -    *         enumeration, and "CDATA" if no declaration was
  -    *         read).
  -    * @see org.xml.sax.AttributeList#getType(java.lang.String)
  -    */
  -  public String getType (String name)
  -  {
  -    return getType(names.indexOf(name));
  -  }
  -
  -
  -  /**
  -    * Get the value of an attribute (by name).
  -    *
  -    * @param name The attribute name.
  -    * @see org.xml.sax.AttributeList#getValue(java.lang.String)
  -    */
  -  public String getValue (String name)
  -  {
  -    return getValue(names.indexOf(name));
  -  }
  -
  -
  -  //////////////////////////////////////////////////////////////////////
  -  // Internal state.
  -  //////////////////////////////////////////////////////////////////////
  -
  -  Vector names = new Vector();
  -  Vector types = new Vector();
  -  Vector values = new Vector();
  -
   }
  
  
  
  1.21      +3 -3      
xml-xalan/src/org/apache/xalan/xslt/StylesheetHandler.java
  
  Index: StylesheetHandler.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/src/org/apache/xalan/xslt/StylesheetHandler.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- StylesheetHandler.java    2000/02/16 19:57:42     1.20
  +++ StylesheetHandler.java    2000/02/17 13:06:26     1.21
  @@ -220,7 +220,7 @@
         Locator locator = (Locator)m_processor.m_stylesheetLocatorStack.pop();
         // System.out.println("popping locator for: "+locator.getPublicId());
       }
  -    m_stylesheet.m_extensionNamespaces.clear();
  +    // m_stylesheet.m_extensionNamespaces.clear();
     }
     
     /** 
  @@ -1171,8 +1171,8 @@
     {
       m_stylesheet.initXSLTKeys();
       m_stylesheet.m_stylesheetRoot.initDefaultRule();
  -    org.xml.sax.helpers.AttributeListImpl templateAttrs 
  -      = new org.xml.sax.helpers.AttributeListImpl();
  +    MutableAttrListImpl templateAttrs 
  +      = new MutableAttrListImpl();
       templateAttrs.addAttribute("name", "CDATA", "simple");
       m_template = new ElemTemplate(m_processor,
                                     m_stylesheet,
  
  
  
  1.23      +1 -1      xml-xalan/src/org/apache/xalan/xslt/StylesheetRoot.java
  
  Index: StylesheetRoot.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xslt/StylesheetRoot.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- StylesheetRoot.java       2000/02/14 16:42:39     1.22
  +++ StylesheetRoot.java       2000/02/17 13:06:27     1.23
  @@ -884,7 +884,7 @@
       int lineNumber = 0;
       int columnNumber = 0;
       // Then manufacture a default
  -    AttributeListImpl attrs = new AttributeListImpl();
  +    MutableAttrListImpl attrs = new MutableAttrListImpl();
       attrs.addAttribute(Constants.ATTRNAME_MATCH, "CDATA", "*");
       m_defaultRule = new ElemTemplate(null, this,
                                        
"xsl:"+Constants.ELEMNAME_TEMPLATE_STRING, 
  
  
  
  1.37      +20 -14    xml-xalan/src/org/apache/xalan/xslt/XSLTEngineImpl.java
  
  Index: XSLTEngineImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xslt/XSLTEngineImpl.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- XSLTEngineImpl.java       2000/02/13 16:42:44     1.36
  +++ XSLTEngineImpl.java       2000/02/17 13:06:27     1.37
  @@ -219,7 +219,7 @@
      * the attributes have to be fully collected before you
      * can call startElement.
      */
  -  AttributeListImpl m_pendingAttributes = new AttributeListImpl();
  +  MutableAttrListImpl m_pendingAttributes = new MutableAttrListImpl();
   
     /**
      * A stack to keep track of the result tree namespaces.
  @@ -243,7 +243,7 @@
      * attribute is a CSS attribute or not.
      * @deprecated
      */
  -  private static Hashtable m_cssKeys = null;
  +  // private static Hashtable m_cssKeys = null;
   
     /*
     * If this is true, translate CSS attributes on
  @@ -485,7 +485,7 @@
       m_stylesheetLocatorStack = new Stack();
       m_pendingElementName = null;
       m_pendingAttributes.clear();
  -    m_pendingAttributes = new AttributeListImpl();
  +    m_pendingAttributes = new MutableAttrListImpl();
       m_resultNameSpaces.removeAllElements();
       // m_resultNameSpaces = new Stack();
       m_cdataStack = new Stack();
  @@ -1182,10 +1182,10 @@
      * Handle an extension function.
      */
     public Object extFunction(String namespace, String extensionName,
  -                            Vector argVec)
  +                            Vector argVec, Object methodKey)
       throws org.xml.sax.SAXException
     {
  -    return m_parserLiaison.extFunction(namespace, extensionName, argVec);
  +    return m_parserLiaison.extFunction(namespace, extensionName, argVec, 
methodKey);
     }
   
     /**
  @@ -1932,8 +1932,8 @@
       boolean savedPendingStartDoc = this.m_pendingStartDoc;
       String savedPendingName = this.m_pendingElementName;
       this.m_pendingElementName = null;
  -    AttributeListImpl savedPendingAttributes = this.m_pendingAttributes;
  -    this.m_pendingAttributes = new AttributeListImpl();
  +    MutableAttrListImpl savedPendingAttributes = this.m_pendingAttributes;
  +    this.m_pendingAttributes = new MutableAttrListImpl();
   
       m_flistener = new FormatterToDOM(m_resultTreeFactory, resultFragment);
   
  @@ -1977,9 +1977,9 @@
       String savedPendingName = m_pendingElementName;
   
       m_pendingElementName = null;
  -    AttributeListImpl savedPendingAttributes = m_pendingAttributes;
  +    MutableAttrListImpl savedPendingAttributes = m_pendingAttributes;
   
  -    m_pendingAttributes = new AttributeListImpl();
  +    m_pendingAttributes = new MutableAttrListImpl();
       m_flistener = flistener;
   
       templateParent.executeChildren(this, sourceTree, sourceNode, mode);
  @@ -2186,7 +2186,7 @@
     /**
      * Copy <KBD>xmlns:</KBD> attributes in if not already in scope.
      */
  -  void copySourceNSAttrs(Node src, AttributeListImpl destination)
  +  void copySourceNSAttrs(Node src, MutableAttrListImpl destination)
     {
       int type;
       // Vector nameValues = null;
  @@ -2257,7 +2257,7 @@
     protected void copyAttributeToTarget( Attr attr,
                                           Node contextNode,
                                           Stylesheet stylesheetTree,
  -                                        AttributeListImpl attrList,
  +                                        MutableAttrListImpl attrList,
                                           Element namespaceContext
                                           )
       throws SAXException,
  @@ -2294,7 +2294,7 @@
     protected void copyAttributesToAttList(
                                            Node contextNode,
                                            Stylesheet stylesheetTree,
  -                                         Element templateChild, 
AttributeListImpl attList)
  +                                         Element templateChild, 
MutableAttrListImpl attList)
       throws SAXException,
              java.net.MalformedURLException,
              java.io.FileNotFoundException,
  @@ -2337,7 +2337,7 @@
      * @deprecated
      */
     /*
  -  void translateCSSAttrsToStyleAttr(AttributeListImpl attList)
  +  void translateCSSAttrsToStyleAttr(MutableAttrListImpl attList)
     {
       if(m_translateCSS)
       {
  @@ -2539,6 +2539,10 @@
     public boolean shouldStripSourceNode(Node textNode)
       throws org.xml.sax.SAXException
     {
  +    if((null != m_stylesheetRoot.m_whitespacePreservingElements) ||
  +       (null != m_stylesheetRoot.m_whitespaceStrippingElements)
  +       )
  +    {
       boolean strip = false; // return value
       int type = textNode.getNodeType();
       if((Node.TEXT_NODE == type) || (Node.CDATA_SECTION_NODE == type))
  @@ -2631,6 +2635,8 @@
         }
       }
       return strip;
  +    }
  +    else return false;
     }
   
     /**
  @@ -3960,7 +3966,7 @@
      * Bottleneck addition of result tree attributes, so I can keep
      * track of namespaces.
      */
  -  void addResultAttribute(AttributeListImpl attList, String aname, String 
value)
  +  void addResultAttribute(MutableAttrListImpl attList, String aname, String 
value)
     {
       boolean isPrefix = aname.startsWith("xmlns:");
       if (aname.equals("xmlns") || isPrefix)
  
  
  

Reply via email to