This commit was manufactured by cvs2svn to create tag
'jaxp-1_3_0-02'.

git-svn-id: https://svn.apache.org/repos/asf/xalan/java/tags/jaxp-1_3_0-02@337615 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/org/apache/xalan/processor/TransformerFactoryImpl.java b/src/org/apache/xalan/processor/TransformerFactoryImpl.java
index f1d9824..7d4bf73 100644
--- a/src/org/apache/xalan/processor/TransformerFactoryImpl.java
+++ b/src/org/apache/xalan/processor/TransformerFactoryImpl.java
@@ -855,6 +855,16 @@
       if (source instanceof SAXSource)
         reader = ((SAXSource) source).getXMLReader();
         
+      // As per JAXP1.2 spec, if a SAXSource is created using a SAX InputSource then
+      // the Transformer or SAXTransformerFactory creates a reader via 
+      // org.xml.sax.helpers.XMLReaderFactory (if setXMLReader is not used), 
+      // sets itself as the reader s org.xml.sax.ContentHandler , and calls 
+      // reader.parse(inputSource).
+      if (null == reader){
+        reader = XMLReaderFactory.createXMLReader();
+        reader.setFeature("http://xml.org/sax/features/namespaces", true);
+      } 
+        
       if (null == reader)
       {
 
@@ -882,8 +892,6 @@
         catch (AbstractMethodError ame){}
       }
 
-      if (null == reader)
-        reader = XMLReaderFactory.createXMLReader();
 
       // If you set the namespaces to true, we'll end up getting double 
       // xmlns attributes.  Needs to be fixed.  -sb
diff --git a/src/org/apache/xalan/processor/XSLTElementProcessor.java b/src/org/apache/xalan/processor/XSLTElementProcessor.java
index c04ee24..1f21722 100644
--- a/src/org/apache/xalan/processor/XSLTElementProcessor.java
+++ b/src/org/apache/xalan/processor/XSLTElementProcessor.java
@@ -2,7 +2,7 @@
  * The Apache Software License, Version 1.1
  *
  *
- * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights 
+ * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -56,16 +56,23 @@
  */
 package org.apache.xalan.processor;
 
-import java.util.Vector;
+import org.xml.sax.InputSource;
+import org.xml.sax.Attributes;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.DTDHandler;
+import org.xml.sax.ContentHandler;
 
 import org.apache.xalan.res.XSLMessages;
 import org.apache.xalan.res.XSLTErrorResources;
 import org.apache.xalan.templates.ElemTemplateElement;
+import org.apache.xalan.templates.Constants;
 import org.apache.xml.utils.IntStack;
 
-import org.xml.sax.Attributes;
-import org.xml.sax.InputSource;
 import org.xml.sax.helpers.AttributesImpl;
+import javax.xml.transform.ErrorListener;
+import javax.xml.transform.TransformerException;
+
+import java.util.Vector;
 
 /**
  * This class acts as the superclass for all stylesheet element
@@ -326,7 +333,13 @@
   {
 
     XSLTElementDef def = getElemDef();
-    AttributesImpl undefines = throwError ? null : new AttributesImpl();
+   
+    AttributesImpl undefines = null;
+    boolean isCompatibleMode = ((null != handler.getStylesheet() 
+                                 && handler.getStylesheet().getCompatibleMode())
+                                || !throwError);
+    if (isCompatibleMode)
+      undefines = new AttributesImpl();
 
     // Keep track of which XSLTAttributeDefs have been processed, so 
     // I can see which default values need to be set.
@@ -351,7 +364,7 @@
 
       if (null == attrDef)
       {
-        if (throwError)
+        if (!isCompatibleMode)
         {
 
           // Then barf, because this element does not allow this attribute.
diff --git a/src/org/apache/xalan/templates/Stylesheet.java b/src/org/apache/xalan/templates/Stylesheet.java
index 47d7d32..777b977 100644
--- a/src/org/apache/xalan/templates/Stylesheet.java
+++ b/src/org/apache/xalan/templates/Stylesheet.java
@@ -2,7 +2,7 @@
  * The Apache Software License, Version 1.1
  *
  *
- * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights 
+ * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -56,20 +56,33 @@
  */
 package org.apache.xalan.templates;
 
-import java.io.IOException;
+// Java imports
 import java.io.ObjectInputStream;
+import java.io.IOException;
 import java.io.ObjectOutputStream;
+
+import java.text.DecimalFormatSymbols;
+
 import java.util.Hashtable;
 import java.util.Stack;
 import java.util.Vector;
 
-import javax.xml.transform.SourceLocator;
-import javax.xml.transform.TransformerException;
-
-import org.apache.xml.dtm.DTM;
+// Xalan imports
+import org.apache.xml.utils.SystemIDResolver;
 import org.apache.xml.utils.QName;
 import org.apache.xml.utils.StringVector;
-import org.apache.xml.utils.SystemIDResolver;
+import org.apache.xpath.XPath;
+
+// DOM Imports
+//import org.w3c.dom.Node;
+//import org.w3c.dom.Document;
+import org.apache.xml.dtm.DTM;
+
+// SAX2 Imports
+import javax.xml.transform.TransformerException;
+import org.xml.sax.Locator;
+
+import javax.xml.transform.SourceLocator;
 
 /**
  * Represents a stylesheet element.
@@ -435,7 +448,13 @@
    * @serial
    */
   private String m_Version;
-
+  
+  /**
+   * Whether or not the stylesheet is in "Forward Compatibility Mode" 
+   * @serial
+   */
+  private boolean m_isCompatibleMode = false;
+ 
   /**
    * Set the "version" property.
    * @see <a href="http://www.w3.org/TR/xslt#forwards">forwards in XSLT Specification</a>
@@ -445,6 +464,17 @@
   public void setVersion(String v)
   {
     m_Version = v;
+    m_isCompatibleMode = (Double.valueOf(v).doubleValue() > Constants.XSLTVERSUPPORTED);
+  }
+
+  /**
+   * Get whether or not the stylesheet is in "Forward Compatibility Mode"
+   * 
+   * @return true if in forward compatible mode, false otherwise
+   */
+  public boolean getCompatibleMode()
+  {
+       return m_isCompatibleMode;
   }
 
   /**
diff --git a/src/org/apache/xalan/templates/StylesheetRoot.java b/src/org/apache/xalan/templates/StylesheetRoot.java
index 53eda5c..5b258a8 100644
--- a/src/org/apache/xalan/templates/StylesheetRoot.java
+++ b/src/org/apache/xalan/templates/StylesheetRoot.java
@@ -299,6 +299,21 @@
     for (int i = recomposableElements.size() - 1; i >= 0; i--)
       ((ElemTemplateElement) recomposableElements.elementAt(i)).recompose(this);
     
+/*
+ * Backing out REE again, as it seems to cause some new failures
+ * which need to be investigated. -is
+ */      
+    // This has to be done before the initialization of the compose state, because 
+    // eleminateRedundentGlobals will add variables to the m_variables vector, which 
+    // it then copied in the ComposeState constructor.
+    
+//    if(true && org.apache.xalan.processor.TransformerFactoryImpl.m_optimize)
+//    {
+//          RedundentExprEliminator ree = new RedundentExprEliminator();
+//          callVisitors(ree);
+//          ree.eleminateRedundentGlobals(this);
+//    }
+          
     initComposeState();
 
     // Need final composition of TemplateList.  This adds the wild cards onto the chains.
diff --git a/src/org/apache/xalan/transformer/TransformerIdentityImpl.java b/src/org/apache/xalan/transformer/TransformerIdentityImpl.java
index 55ac1f3..66f482c 100644
--- a/src/org/apache/xalan/transformer/TransformerIdentityImpl.java
+++ b/src/org/apache/xalan/transformer/TransformerIdentityImpl.java
@@ -322,6 +322,16 @@
         m_systemID = dsource.getSystemId();
   
         Node dNode = dsource.getNode();
+        
+      // As per JAXP1.2 spec if Zero-argument default constructor DOMSource()
+      // is used, and no DOM source is set, then the Transformer will create
+      // an empty source Document using newDocument().
+        if(null == dNode){
+            try{
+                dNode = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
+            }
+            catch(Exception e){ }
+        }
   
         if (null != dNode)
         {
@@ -383,6 +393,17 @@
         if (source instanceof SAXSource)
           reader = ((SAXSource) source).getXMLReader();
           
+        //As per JAXP1.2 spec, if a SAXSource is created using a SAX InputSource then
+        // the Transformer or SAXTransformerFactory creates a reader via 
+        //org.xml.sax.helpers.XMLReaderFactory (if setXMLReader is not used), 
+        //sets itself as the reader s org.xml.sax.ContentHandler , and calls 
+        //reader.parse(inputSource).
+        if (null == reader)
+        {
+          reader = XMLReaderFactory.createXMLReader();
+          reader.setFeature("http://xml.org/sax/features/namespaces", true);
+        } 
+        
         if (null == reader)
         {
   
@@ -410,11 +431,7 @@
           catch (AbstractMethodError ame){}
         }
   
-        if (null == reader)
-        {
-          reader = XMLReaderFactory.createXMLReader();
-        }
-  
+        
         try
         {
           reader.setFeature("http://xml.org/sax/features/namespace-prefixes",
diff --git a/src/org/apache/xalan/transformer/TransformerImpl.java b/src/org/apache/xalan/transformer/TransformerImpl.java
index fb4b26e..95c2fcc 100644
--- a/src/org/apache/xalan/transformer/TransformerImpl.java
+++ b/src/org/apache/xalan/transformer/TransformerImpl.java
@@ -66,6 +66,7 @@
 import java.util.Vector;
 
 import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.transform.ErrorListener;
 import javax.xml.transform.OutputKeys;
 import javax.xml.transform.Result;
@@ -77,6 +78,7 @@
 import javax.xml.transform.dom.DOMResult;
 import javax.xml.transform.sax.SAXResult;
 import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.dom.DOMSource;
 
 import org.apache.xalan.extensions.ExtensionsTable;
 import org.apache.xalan.res.XSLMessages;
@@ -623,16 +625,16 @@
 
     try
     {
-        
+
       // Patch for bugzilla #13863.  If we don't reset the namespaceContext
-      // then we will get a NullPointerException if transformer is reused 
-      // (for stylesheets that use xsl:key).  Not sure if this should go 
-      // here or in reset(). -is  
+      // then we will get a NullPointerException if transformer is reused
+      // (for stylesheets that use xsl:key).  Not sure if this should go
+      // here or in reset(). -is
       if(getXPathContext().getNamespaceContext() == null){
          getXPathContext().setNamespaceContext(getStylesheet());
       }
       String base = source.getSystemId();
-      
+
       // If no systemID of the source, use the base of the stylesheet.
       if(null == base)
       {
@@ -647,15 +649,31 @@
           currentDir = System.getProperty("user.dir");
         }
         catch (SecurityException se) {}// user.dir not accessible from applet
-              
+
         if (currentDir.startsWith(java.io.File.separator))
           base = "file://" + currentDir;
         else
           base = "file:///" + currentDir;
-        
+
         base = base + java.io.File.separatorChar
                + source.getClass().getName();
       }
+      
+      // As per JAXP1.2 spec if Zero-argument default constructor DOMSource()
+      // is used, and no DOM source is set, then the Transformer will create
+      // an empty source Document using newDocument().
+      if(source instanceof DOMSource ){
+          DOMSource dSource = (DOMSource)source;
+          if(dSource.getSystemId() == null && dSource.getNode()== null){
+              try{
+                  dSource.setNode(DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument());
+                  source = dSource;
+              }
+              catch(Exception e){
+              }
+          }
+      }    
+            
       setBaseURLOfSource(base);
       DTMManager mgr = m_xcontext.getDTMManager();
       DTM dtm = mgr.getDTM(source, false, this, true, true);
@@ -918,6 +936,11 @@
 
     synchronized (m_reentryGuard)
     {
+		if(oformat == null){
+       		 m_outputFormat =
+			 	(OutputProperties) getStylesheet().getOutputComposed().clone();
+			return ;
+		}
       if (null != oformat)
       {
 
diff --git a/src/org/apache/xml/utils/DOMBuilder.java b/src/org/apache/xml/utils/DOMBuilder.java
index 446f6c9..6e5ffd5 100644
--- a/src/org/apache/xml/utils/DOMBuilder.java
+++ b/src/org/apache/xml/utils/DOMBuilder.java
@@ -1,8 +1,9 @@
 /*
  * The Apache Software License, Version 1.1
  *
- *
- * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights 
+ *zaz
+ 
+ * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -56,21 +57,23 @@
  */
 package org.apache.xml.utils;
 
+import org.apache.xml.res.XMLMessages;
+import org.apache.xml.res.XMLErrorResources;
+import org.apache.xml.utils.NodeVector;
 import java.util.Stack;
 
-import org.apache.xml.res.XMLErrorResources;
-import org.apache.xml.res.XMLMessages;
+import org.xml.sax.ext.LexicalHandler;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.Attributes;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.DocumentFragment;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.Text;
+import org.w3c.dom.CDATASection;
 
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.Locator;
-import org.xml.sax.ext.LexicalHandler;
 /**
  * <meta name="usage" content="general"/>
  * This class takes SAX events (in addition to some extra events
@@ -328,15 +331,15 @@
   
           String attrNS = atts.getURI(i);
           
-          if("".equals(attrNS))
-            attrNS = null; // DOM represents no-namespace as null
-  
-          // System.out.println("attrNS: "+attrNS+", localName: "+atts.getQName(i)
-          //                   +", qname: "+atts.getQName(i)+", value: "+atts.getValue(i));
-          // Crimson won't let us set an xmlns: attribute on the DOM.
           String attrQName = atts.getQName(i);
-          // ALWAYS use the DOM Level 2 call!
-          elem.setAttributeNS(attrNS,attrQName, atts.getValue(i));
+          if((attrQName.equals("xmlns") || attrQName.startsWith("xmlns:")) )
+          {
+            elem.setAttributeNS("http://www.w3.org/2000/xmlns/",attrQName, atts.getValue(i));
+          }
+          else
+          {
+             elem.setAttributeNS(atts.getURI(i),attrQName, atts.getValue(i));
+          }
         }
       }
       
@@ -426,11 +429,18 @@
 
       return;
     }
-
+    
     String s = new String(ch, start, length);
-    Text text = m_doc.createTextNode(s);
+    Node childNode = m_currentNode.getLastChild();
 
-    append(text);
+    if( childNode != null && childNode.getNodeType() == Node.TEXT_NODE ){
+      ((Text)childNode).appendData(s);
+    }
+    else
+    {
+      Text text = m_doc.createTextNode(s);
+      append(text);
+    }
   }
 
   /**
@@ -588,6 +598,7 @@
   public void startCDATA() throws org.xml.sax.SAXException
   {
     m_inCData = true;
+    append(m_doc.createCDATASection(""));
   }
 
   /**
@@ -630,8 +641,9 @@
       return;  // avoid DOM006 Hierarchy request error
 
     String s = new String(ch, start, length);
-
-    append(m_doc.createCDATASection(s));
+    
+    CDATASection section  =(CDATASection) m_currentNode.getLastChild();
+    section.appendData(s);
   }
 
   /**
diff --git a/src/trax/trax.properties b/src/trax/trax.properties
deleted file mode 100644
index e593c39..0000000
--- a/src/trax/trax.properties
+++ /dev/null
@@ -1,11 +0,0 @@
-# $Revision$ $Date$
-#
-# Note: This properties file is provided for illustrative purposes
-#       only and is not part of the interface definition.
-#       This properties file is located in the implementation JAR
-#       and different implementations will specify different
-#       implementation classes and output methods.
-#
-
-# The TRaX Stylesheet processor
-trax.processor.xslt=org.apache.xalan.processor.StylesheetProcessor
diff --git a/xdocs/sources/xalan/history.xml b/xdocs/sources/xalan/history.xml
index 1b5a321..3ba0127 100644
--- a/xdocs/sources/xalan/history.xml
+++ b/xdocs/sources/xalan/history.xml
@@ -209,6 +209,31 @@
 Patch from Christine Li (jycli@ca.ibm.com) for bugzilla #18926.
 
 Variables weren't being cleared from stack between calls to func:function.
+<br/><br/></li>
+<li><ref>Committed by </ref>mkwan@apache.org<ref> on </ref>2003/05/28<br/><ref>Modified: </ref> xml-xalan/java/src/org/apache/xalan/res XSLTErrorResources_ca.java XSLTErrorResources_cs.java XSLTErrorResources_de.java XSLTErrorResources_es.java XSLTErrorResources_fr.java XSLTErrorResources_hu.java XSLTErrorResources_it.java XSLTErrorResources_ja.java XSLTErrorResources_ko.java XSLTErrorResources_pl.java XSLTErrorResources_pt_BR.java XSLTErrorResources_ru.java XSLTErrorResources_sk.java XSLTErrorResources_tr.java XSLTErrorResources_zh_CN.java XSLTErrorResources_zh_TW.java xml-xalan/java/src/org/apache/xalan/xslt Process.java xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util ErrorMessages_ca.java ErrorMessages_cs.java ErrorMessages_de.java ErrorMessages_es.java ErrorMessages_fr.java ErrorMessages_hu.java ErrorMessages_it.java ErrorMessages_ja.java ErrorMessages_ko.java ErrorMessages_pl.java ErrorMessages_pt_BR.java ErrorMessages_ru.java ErrorMessages_sk.java ErrorMessages_tr.java ErrorMessages_zh_CN.java ErrorMessages_zh_TW.java xml-xalan/java/src/org/apache/xalan/xsltc/runtime ErrorMessages_ca.java ErrorMessages_cs.java ErrorMessages_de.java ErrorMessages_es.java ErrorMessages_fr.java ErrorMessages_hu.java ErrorMessages_it.java ErrorMessages_ja.java ErrorMessages_ko.java ErrorMessages_pl.java ErrorMessages_pt_BR.java ErrorMessages_ru.java ErrorMessages_sk.java ErrorMessages_tr.java ErrorMessages_zh_CN.java ErrorMessages_zh_TW.java xml-xalan/java/src/org/apache/xml/res XMLErrorResources_ca.java XMLErrorResources_cs.java XMLErrorResources_de.java XMLErrorResources_es.java XMLErrorResources_fr.java XMLErrorResources_hu.java XMLErrorResources_it.java XMLErrorResources_ja.java XMLErrorResources_ko.java XMLErrorResources_pl.java XMLErrorResources_pt_BR.java XMLErrorResources_ru.java XMLErrorResources_sk.java XMLErrorResources_tr.java XMLErrorResources_zh_CN.java XMLErrorResources_zh_TW.java xml-xalan/java/src/org/apache/xpath/res XPATHErrorResources_ca.java XPATHErrorResources_cs.java XPATHErrorResources_de.java XPATHErrorResources_es.java XPATHErrorResources_fr.java XPATHErrorResources_hu.java XPATHErrorResources_it.java XPATHErrorResources_ja.java XPATHErrorResources_ko.java XPATHErrorResources_pl.java XPATHErrorResources_pt_BR.java XPATHErrorResources_ru.java XPATHErrorResources_sk.java XPATHErrorResources_tr.java XPATHErrorResources_zh_CN.java XPATHErrorResources_zh_TW.java<br/><ref>Committer's log entry: </ref>
+Checked in localized messages for Xalan and XSLTC contributed by IBM.
+New Locale support includes ca, cs, hu, pl, pt_BR, ru, sk and tr.
+The old messages are also updated with translations for newly added
+English messages.
+<br/><br/></li><li><ref>Committed by </ref>minchau@apache.org<ref> on </ref>2003/05/28<br/><ref>Modified: </ref> xml-xalan/java/src/org/apache/xml/utils BoolStack.java<br/><ref>Committer's log entry: </ref>
+Added a clear() method to clear a BoolStack, so that such a 
+stack can be re-used without the need to create a new one
+(for performance).
+Submitted by: Brian Minchau
+<br/><br/></li><li><ref>Committed by </ref>minchau@apache.org<ref> on </ref>2003/05/28<br/><ref>Modified: </ref> xml-xalan/java/src/org/apache/xml/serializer NamespaceMappings.java SerializerBase.java ToHTMLStream.java ToSAXHandler.java ToStream.java ToXMLSAXHandler.java ToXMLStream.java<br/><ref>Committer's log entry: </ref>
+Support for reset() for the stream serializers and for ToXMLSAXHandler.
+These serializers can now be reset and re-used rather than creating a new one.
+A reset() takes about 1/2 the time of creating a new one.
+
+Submitted by: Brian Minchau
+<br/><br/></li><li><ref>Committed by </ref>minchau@apache.org<ref> on </ref>2003/05/28<br/><ref>Modified: </ref> xml-xalan/java/src/org/apache/xml/serializer ToHTMLSAXHandler.java<br/><ref>Committer's log entry: </ref>
+Support for a ToHTMLSAXHandler serializer to be reset() and re-used.
+Submitted by: Brian Minchau
+<br/><br/></li>
+<li><ref>Committed by </ref>grchiu@apache.org<ref> on </ref>2003/05/28<br/><ref>Modified: </ref> xml-xalan/java/xdocs/sources/xalan faq.xml<br/><ref>Committer's log entry: </ref>
+Contributed by Christine Li (jycli@ca.ibm.com).
+Modified FAQ entry regarding bootclasspath; the class path separator is not
+colon for all systems.
 <br/><br/></li></ul>
 </s2>
 <s2 title="Changes for &xslt4j; 2.5.0">