You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by sa...@apache.org on 2002/04/22 18:39:00 UTC

cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/compiler Stylesheet.java

santiagopg    02/04/22 09:39:00

  Modified:    java/src/org/apache/xalan/xsltc/compiler Tag:
                        jaxp-ri-1_2_0-fcs-branch Stylesheet.java
  Log:
  Fixed bug in resolveReferences().
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.35.4.3  +25 -4     xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Stylesheet.java
  
  Index: Stylesheet.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Stylesheet.java,v
  retrieving revision 1.35.4.2
  retrieving revision 1.35.4.3
  diff -u -r1.35.4.2 -r1.35.4.3
  --- Stylesheet.java	17 Apr 2002 20:25:26 -0000	1.35.4.2
  +++ Stylesheet.java	22 Apr 2002 16:39:00 -0000	1.35.4.3
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: Stylesheet.java,v 1.35.4.2 2002/04/17 20:25:26 santiagopg Exp $
  + * @(#)$Id: Stylesheet.java,v 1.35.4.3 2002/04/22 16:39:00 santiagopg Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -703,12 +703,31 @@
   	return("("+DOM_INTF_SIG+NODE_ITERATOR_SIG+TRANSLET_OUTPUT_SIG+")V");
       }
   
  -
  +    /**
  +     * This method returns a vector with variables in the order in which
  +     * they are to be compiled. The order is determined by the dependencies
  +     * between them. The first step is to close the input vector under
  +     * the dependence relation (this is usually needed when variables are
  +     * defined inside other variables in a RTF).
  +     */
       private Vector resolveReferences(Vector input) {
  -	Vector result = new Vector();
   
  -	int zeroDep = 0;
  +	// Make sure that the vector 'input' is closed
  +	for (int i = 0; i < input.size(); i++) {
  +	    final VariableBase var = (VariableBase) input.elementAt(i);
  +	    final Vector dep  = var.getDependencies();
  +	    final int depSize = (dep != null) ? dep.size() : 0;
  +
  +	    for (int j = 0; j < depSize; j++) {
  +		final VariableBase depVar = (VariableBase) dep.elementAt(j);
  +		if (!input.contains(depVar)) {
  +		    input.addElement(depVar);
  +		}
  +	    }
  +	}
   
  +	Vector result = new Vector();
  +	int zeroDep = 0;
   	while (input.size() > 0) {
   	    boolean changed = false;
   	    for (int i = 0; i < input.size(); ) {
  @@ -728,6 +747,8 @@
   		    i++;
   		}
   	    }
  +
  +
   	    // If nothing was changed in this pass then we have a circular ref
   	    if (!changed) {
   		ErrorMsg err = new ErrorMsg(ErrorMsg.CIRCULAR_VARIABLE_ERR,
  
  
  

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