morten      01/09/12 01:35:11

  Modified:    java/src/org/apache/xalan/xsltc/runtime
                        AbstractTranslet.java TextOutput.java
  Log:
  I have updated out output handler to treat this in the same manner as XT does.
  We allow AVT's to create namespace mappings between some prefix and the null
  URI. But, whenever an attribute or element uses a prefix that maps to the null
  URI we replace the prefix with the default prefix. So insead of outputting an
  illegal namespace declaration xmlns:ns1="" and ns1:Attr1="Whatsup" we simply
  output Attr1="Whatsup"
  PR:           bugzilla 1518
  Obtained from:        n/a
  Submitted by: [EMAIL PROTECTED]
  Reviewed by:  [EMAIL PROTECTED]
  
  Revision  Changes    Path
  1.23      +3 -3      
xml-xalan/java/src/org/apache/xalan/xsltc/runtime/AbstractTranslet.java
  
  Index: AbstractTranslet.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/AbstractTranslet.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- AbstractTranslet.java     2001/09/05 18:49:33     1.22
  +++ AbstractTranslet.java     2001/09/12 08:35:11     1.23
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: AbstractTranslet.java,v 1.22 2001/09/05 18:49:33 tmiller Exp $
  + * @(#)$Id: AbstractTranslet.java,v 1.23 2001/09/12 08:35:11 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -152,7 +152,7 @@
            // bug fix #3424, John Howard.
            // remove objects that are in the stack since objects are   
            // added with insertElementAt(int) and will cause memory retention
  -         for (int i=top; i>=bot; i--){
  +         for (int i=top; i>=bot; i--) {
                paramsStack.removeElementAt(i);
            }
        }
  @@ -235,7 +235,7 @@
            // bug fix 3424, John Howard
            // remove objects that are in the stack since objects are   
            // added with insertElementAt(int) and will cause memory retention
  -         for (int i=top; i>=bot; i--){
  +         for (int i=top; i>=bot; i--) {
                varsStack.removeElementAt(i);
            }
        }
  
  
  
  1.25      +17 -4     
xml-xalan/java/src/org/apache/xalan/xsltc/runtime/TextOutput.java
  
  Index: TextOutput.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/TextOutput.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- TextOutput.java   2001/09/06 13:39:45     1.24
  +++ TextOutput.java   2001/09/12 08:35:11     1.25
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: TextOutput.java,v 1.24 2001/09/06 13:39:45 tmiller Exp $
  + * @(#)$Id: TextOutput.java,v 1.25 2001/09/12 08:35:11 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -271,6 +271,7 @@
                                                prefix+" has not been "+
                                                "declared.");
                }
  +             if (uri.equals(EMPTYSTRING)) _elementName = localname;
                _saxHandler.startElement(uri, localname,
                                         _elementName, _attributes);
            }
  @@ -581,7 +582,7 @@
        * Put an attribute and its value in the start tag of an element.
        * Signal an exception if this is attempted done outside a start tag.
        */
  -    public void attribute(final String name, final String value)
  +    public void attribute(String name, final String value)
        throws TransletException {
        
        // Do not output attributes if output mode is 'text'
  @@ -596,6 +597,18 @@
                    namespace(name.substring(6),value);
            }
            else {
  +             final int col = name.lastIndexOf(':');
  +             if (col > 0) {
  +                 final String prefix = name.substring(0,col);
  +                 final String localname = name.substring(col+1);
  +                 final String uri = lookupNamespace(prefix);
  +                 if (uri == null) {
  +                     throw new TransletException("Namespace for prefix "+
  +                                                 prefix+" has not been "+
  +                                                 "declared.");
  +                 }
  +                 if (uri.equals(EMPTYSTRING)) name = localname;
  +             }
                if (_outputType == HTML)
                    _attributes.add(name,value);
                else
  @@ -701,8 +714,6 @@
   
        if (prefix.equals(XML_PREFIX)) return;
   
  -     if ((!prefix.equals(EMPTYSTRING)) && (uri.equals(EMPTYSTRING))) return;
  -
        Stack stack;
        // Get the stack that contains URIs for the specified prefix
        if ((stack = (Stack)_namespaces.get(prefix)) == null) {
  @@ -716,6 +727,8 @@
   
        _prefixStack.push(prefix);
        _nodeStack.push(new Integer(_depth));
  +
  +     if ((!prefix.equals(EMPTYSTRING)) && (uri.equals(EMPTYSTRING))) return;
        _saxHandler.startPrefixMapping(prefix, uri);
       }
   
  
  
  

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

Reply via email to