dleslie     2002/06/04 12:57:27

  Modified:    java/src/org/apache/xalan/templates Tag: Xalan3
                        StylesheetRoot.java
  Added:       java/src/org/apache/xalan/templates Tag: Xalan3
                        ElemResultDocument.java
                        ElemPrincipalResultDocument.java ElemFunction.java
                        ElemFuncResult.java
  Log:
  First version for Xalan3 branch!
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.46.8.1  +82 -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.46
  retrieving revision 1.46.8.1
  diff -u -r1.46 -r1.46.8.1
  --- StylesheetRoot.java       30 Jan 2002 19:08:01 -0000      1.46
  +++ StylesheetRoot.java       4 Jun 2002 19:57:27 -0000       1.46.8.1
  @@ -89,6 +89,11 @@
   import javax.xml.transform.ErrorListener;
   
   import org.apache.xml.dtm.ref.ExpandedNameTable;
  +//dml
  +import org.apache.xml.utils.StringVector;
  +import org.apache.xalan.extensions.ExtensionNamespaceSupport;
  +import org.apache.xalan.extensions.ExtensionHandler;
  +import org.apache.xalan.extensions.ExtensionNamespacesManager;
   
   /**
    * <meta name="usage" content="general"/>
  @@ -126,7 +131,7 @@
      * @serial
      */
     private Hashtable m_availElems;
  -
  +  
     /**
      * Creates a StylesheetRoot and retains a pointer to the schema used to 
create this
      * StylesheetRoot.  The schema may be needed later for an 
element-available() function call.
  @@ -139,7 +144,6 @@
   
       this(listener);
       m_availElems = schema.getElemsAvailable();
  -
     }
   
     /**
  @@ -162,6 +166,39 @@
     {
       return m_availElems;
     }
  +  
  +  private ExtensionNamespacesManager m_extNsMgr = null;
  +  
  +  /**
  +   * Only instantiate an ExtensionNamespacesManager if one is called for
  +   * (i.e., if the stylesheet contains  extension functions and/or elements).
  +   */
  +  public ExtensionNamespacesManager getExtensionNamespacesManager()
  +  {
  +     if (m_extNsMgr == null)
  +       m_extNsMgr = new ExtensionNamespacesManager();
  +     return m_extNsMgr;
  +  }
  +  
  +  /**
  +   * Get the vector of extension namespaces. Used to provide
  +   * the extensions table access to a list of extension
  +   * namespaces encountered during composition of a stylesheet.
  +   */
  +  public Vector getExtensions()
  +  {
  +    return m_extNsMgr != null ? m_extNsMgr.getExtensions() : null;
  +  }  
  +
  +/*
  +  public void runtimeInit(TransformerImpl transformer) throws 
TransformerException
  +  {
  +    System.out.println("StylesheetRoot.runtimeInit()");
  +      
  +  //    try{throw new Exception("StylesheetRoot.runtimeInit()");} 
catch(Exception e){e.printStackTrace();}
  +
  +    }
  +*/  
   
     //============== Templates Interface ================
   
  @@ -243,12 +280,8 @@
           // Calculate the number of this import.    
           m_globalImportList[j--].recomposeImports();        
         }
  -    }
  -
  -    
  -
  +    }    
       // Next, we walk the import tree and add all of the recomposable 
elements to the vector.
  -
       int n = getGlobalImportCount();
   
       for (int i = 0; i < n; i++)
  @@ -303,7 +336,10 @@
           composeTemplates(included);
         }
       }
  -    
  +    // Attempt to register any remaining unregistered extension namespaces.
  +    if (m_extNsMgr != null)
  +      m_extNsMgr.registerUnregisteredNamespaces();
  +
       clearComposeState();
     }
   
  @@ -447,7 +483,14 @@
      * will be set as stylesheets are encountered.
      * @serial
      */
  -  private OutputProperties m_outputProperties;
  +  private OutputProperties m_outputProperties; // Keep for time being?? 
  +  // Can set from ElemPrincipalResultDocument.
  +  protected void setOutputProperties(OutputProperties primaryProps)
  +  {
  +    m_outputProperties = primaryProps;
  +  }
  +  
  +  private Hashtable m_outputPropertiesTable = new Hashtable();
   
     /**
      * Recompose the output format object from the included elements.
  @@ -457,8 +500,25 @@
     void recomposeOutput(OutputProperties oprops)
       throws TransformerException
     {
  +    //System.out.println("StylesheetRoot.recomposeOutput() " + 
oprops.getName());
  +    // put into m_outputPropertiesTable
       
  -    m_outputProperties.copyFrom(oprops);
  +    Object key = (oprops.getName() != null)
  +                  ? (Object)oprops.getName(): (Object)new String("") ;
  +    
  +    if (m_outputPropertiesTable.containsKey(key))
  +    {
  +      //System.out.println("has key " + key);
  +      ((OutputProperties)m_outputPropertiesTable.get(key)).copyFrom(oprops);
  +    }
  +    else
  +    { 
  +      //System.out.println("new key " + key);
  +      OutputProperties outputProps = new OutputProperties(Method.XML);
  +      outputProps.copyFrom(oprops);
  +      m_outputPropertiesTable.put(key, outputProps);
  +    }
  +    //m_outputProperties.copyFrom(oprops);
     }
   
     /**
  @@ -479,7 +539,19 @@
       // System.out.println("getOutputComposed.getIndenting: 
"+m_outputProperties.getIndenting());
       return m_outputProperties;
     }
  +  
  +  //dml
  +  public OutputProperties getOutputComposed(QName qname)
  +  {
  +    Object key = (qname != null)
  +                  ? (Object)qname : (Object)new String("") ;
  +    OutputProperties oprops = 
(OutputProperties)m_outputPropertiesTable.get(key);
  +    
  +    return oprops;
  +  }
   
  +  // following flag must be changed to include QName param.
  +  
     /** Flag indicating whether an output method has been set by the user.
      *  @serial           */
     private boolean m_outputMethodSet = false;
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +256 -0    
xml-xalan/java/src/org/apache/xalan/templates/Attic/ElemResultDocument.java
  
  
  
  
  1.1.2.1   +273 -0    
xml-xalan/java/src/org/apache/xalan/templates/Attic/ElemPrincipalResultDocument.java
  
  
  
  
  1.1.2.1   +234 -0    
xml-xalan/java/src/org/apache/xalan/templates/Attic/ElemFunction.java
  
  
  
  
  1.1.2.1   +74 -0     
xml-xalan/java/src/org/apache/xalan/templates/Attic/ElemFuncResult.java
  
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to