aruny       2003/08/13 05:48:51

  Modified:    java/src/org/apache/xalan/transformer Tag: jaxp-1_3_0-branch
                        TransformerImpl.java
  Log:
  Description: Applying patch for :
  1.As per JAXP1.2 spec if argument to Transformer.setOutputProperties(Properties 
oformat)
   function is null, any properties  previously set are removed, and  the value will 
revert
   to the value defined in the templates object.
  2.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().
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.146.2.1 +30 -7     
xml-xalan/java/src/org/apache/xalan/transformer/TransformerImpl.java
  
  Index: TransformerImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/TransformerImpl.java,v
  retrieving revision 1.146
  retrieving revision 1.146.2.1
  diff -u -r1.146 -r1.146.2.1
  --- TransformerImpl.java      27 May 2003 15:47:43 -0000      1.146
  +++ TransformerImpl.java      13 Aug 2003 12:48:51 -0000      1.146.2.1
  @@ -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)
         {
   
  
  
  

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

Reply via email to