garyp       01/06/08 12:56:36

  Modified:    java/src/org/apache/xalan/serialize SerializerToHTML.java
               java/src/org/apache/xalan/templates OutputProperties.java
                        output_html.properties
               java/xdocs/sources/xalan usagepatterns.xml
  Log:
  Enhancement to implement xalan:omit-meta-tag="yes" on the xsl:output element. 
 When specified,
  no META tag will be created with the HTML output method, even if one should 
be created according to the XSLT Recommendation.
  This clears bug 1310 (http://nagoya.apache.org/bugzilla/show_bug.cgi?id=1310).
  Also, implemented fix in bug 2000 
(http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2000) to avoid changing 
OutputProperties out from under the Enumeration.
  We now enumerate a clone of the OutputProperties.
  
  Revision  Changes    Path
  1.3       +38 -8     
xml-xalan/java/src/org/apache/xalan/serialize/SerializerToHTML.java
  
  Index: SerializerToHTML.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/serialize/SerializerToHTML.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SerializerToHTML.java     2001/03/11 22:04:13     1.2
  +++ SerializerToHTML.java     2001/06/08 19:56:33     1.3
  @@ -382,6 +382,9 @@
     /** True if URLs should be specially escaped with the %xx form. */
     private boolean m_specialEscapeURLs = true;
   
  +  /** True if the META tag should be omitted. */
  +  private boolean m_omitMetaTag = false;
  +
     /**
      * Tells if the formatter should use special URL escaping.
      *
  @@ -393,6 +396,16 @@
     }
   
     /**
  +   * Tells if the formatter should omit the META tag.
  +   *
  +   * @param bool True if the META tag should be omitted.
  +   */
  +  public void setOmitMetaTag(boolean bool)
  +  {
  +    m_omitMetaTag = bool;
  +  }
  +
  +  /**
      * Specifies an output format for this serializer. It the
      * serializer has already been associated with an output format,
      * it will switch to the new format. This method should not be
  @@ -407,6 +420,9 @@
       m_specialEscapeURLs =
         
OutputProperties.getBooleanProperty(OutputProperties.S_USE_URL_ESCAPING,
                                             format);
  +    m_omitMetaTag =
  +      OutputProperties.getBooleanProperty(OutputProperties.S_OMIT_META_TAG,
  +                                          format);
                               
       super.setOutputFormat(format);
     }
  @@ -422,6 +438,16 @@
     }
   
     /**
  +   * Tells if the formatter should omit the META tag.
  +   *
  +   * @return True if the META tag should be omitted.
  +   */
  +  public boolean getOmitMetaTag()
  +  {
  +    return m_omitMetaTag;
  +  }
  +
  +  /**
      * Get a description of the given element.
      *
      * @param name non-null name of element, case insensitive.
  @@ -586,18 +612,22 @@
       if (isHeadElement)
       {
         writeParentTagEnd();
  +
  +      if (!m_omitMetaTag)
  +      {
   
  -      if (m_doIndent)
  -        indent(m_currentIndent);
  +        if (m_doIndent)
  +          indent(m_currentIndent);
   
  -      accum(
  -        "<META http-equiv=\"Content-Type\" content=\"text/html; charset=");
  +        accum(
  +          "<META http-equiv=\"Content-Type\" content=\"text/html; charset=");
   
  -      String encoding = Encodings.getMimeEncoding(m_encoding);
  +        String encoding = Encodings.getMimeEncoding(m_encoding);
   
  -      accum(encoding);
  -      accum('"');
  -      accum('>');
  +        accum(encoding);
  +        accum('"');
  +        accum('>');
  +      }
       }
     }
   
  
  
  
  1.17      +17 -1     
xml-xalan/java/src/org/apache/xalan/templates/OutputProperties.java
  
  Index: OutputProperties.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/OutputProperties.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- OutputProperties.java     2001/05/21 18:12:39     1.16
  +++ OutputProperties.java     2001/06/08 19:56:34     1.17
  @@ -237,7 +237,17 @@
       // Note that we're working at the HashTable level here, 
       // and not at the Properties level!  This is important 
       // because we don't want to modify the default properties.
  -    Enumeration keys = props.keys();
  +    // NB: If fixupPropertyString ends up changing the property
  +    // name or value, we need to remove the old key and re-add
  +    // with the new key and value.  However, then our Enumeration
  +    // could lose its place in the HashTable.  So, we first
  +    // clone the HashTable and enumerate over that since the
  +    // clone will not change.  When we migrate to Collections,
  +    // this code should be revisited and cleaned up to use
  +    // an Iterator which may (or may not) alleviate the need for
  +    // the clone.  Many thanks to Padraig O'hIceadha
  +    // <[EMAIL PROTECTED]> for finding this problem.  Bugzilla 2000.
  +    Enumeration keys = ((Properties) props.clone()).keys();
       while(keys.hasMoreElements())
       {
         String key = (String)keys.nextElement();
  @@ -1040,6 +1050,12 @@
      *  use %xx escaping. */
     public static String S_USE_URL_ESCAPING =
       S_BUILTIN_EXTENSIONS_UNIVERSAL+"use-url-escaping";
  +
  +  /** Use a value of "yes" if the META tag should be omitted where it would
  +   *  otherwise be supplied.
  +   */
  +  public static String S_OMIT_META_TAG =
  +    S_BUILTIN_EXTENSIONS_UNIVERSAL+"omit-meta-tag";
   
     /** The default properties of all output files. */
     private static Properties m_xml_properties = null;
  
  
  
  1.5       +2 -1      
xml-xalan/java/src/org/apache/xalan/templates/output_html.properties
  
  Index: output_html.properties
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/output_html.properties,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- output_html.properties    2001/01/22 20:56:24     1.4
  +++ output_html.properties    2001/06/08 19:56:35     1.5
  @@ -21,4 +21,5 @@
   {http\u003a//xml.apache.org/xslt}indent-amount=0
   
{http\u003a//xml.apache.org/xslt}content-handler=org.apache.xalan.serialize.SerializerToHTML
   {http\u003a//xml.apache.org/xslt}entities=HTMLEntities.res
  -{http\u003a//xml.apache.org/xslt}use-url-escaping=yes
  \ No newline at end of file
  +{http\u003a//xml.apache.org/xslt}use-url-escaping=yes
  +{http\u003a//xml.apache.org/xslt}omit-meta-tag=no
  
  
  
  1.35      +6 -2      xml-xalan/java/xdocs/sources/xalan/usagepatterns.xml
  
  Index: usagepatterns.xml
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/xdocs/sources/xalan/usagepatterns.xml,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- usagepatterns.xml 2001/05/15 14:11:26     1.34
  +++ usagepatterns.xml 2001/06/08 19:56:36     1.35
  @@ -189,13 +189,17 @@
       <td>org.apache.xalan.serialize.SerializerToHTML</td>
     </tr>
     <tr>
  -    <td>entities</td>
  +    <td>xalan:entities</td>
       <td>HTMLEntities.res</td>
     </tr>
     <tr>
       <td>xalan:use-url-escaping</td>
       <td>yes</td>
     </tr>
  +  <tr>
  +    <td>xalan:omit-meta-tag</td>
  +    <td>no</td>
  +  </tr>
   </table>
   <note>You can also create your own HTML entity file (mapping characters to 
entities) 
   or edit src/org/apache/xalan/serialize/HTMLEntities.res and rebuild 
xalan.jar.</note>
  @@ -509,4 +513,4 @@
   </ol>
   <p>We urge our Xalan-Java 1.x users to start using Xalan-Java 2. That is 
where we are concentrating our efforts to improve performance and fix any 
outstanding bugs. To see what portion of the Xalan-Java 1.x API we have 
included in xalanj1compat.jar, see <resource-ref idref="compatapi"/>. For 
example, the compatibility layer does not support the use of Xalan-Java 1.x 
extensions. If you feel that we should extend our compatibility JAR to support 
additional Xalan-Java 1.x API calls, please let us know exactly what you would 
like to see.</p>
   </s2>
  -</s1>
  \ No newline at end of file
  +</s1>
  
  
  

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

Reply via email to