You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by il...@apache.org on 2002/07/26 02:28:16 UTC

cvs commit: xml-xalan/java/src/org/apache/xalan/processor XSLTAttributeDef.java XSLTSchema.java

ilene       2002/07/25 17:28:16

  Modified:    java/src/org/apache/xalan/processor XSLTAttributeDef.java
                        XSLTSchema.java
  Log:
  Applying Paul Brown's patch for bug#6972.
  
  xsl:output cdata-section-elements attribute was not handled correctly.
  
  Revision  Changes    Path
  1.24      +54 -4     xml-xalan/java/src/org/apache/xalan/processor/XSLTAttributeDef.java
  
  Index: XSLTAttributeDef.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/processor/XSLTAttributeDef.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- XSLTAttributeDef.java	10 Jul 2002 16:06:31 -0000	1.23
  +++ XSLTAttributeDef.java	26 Jul 2002 00:28:15 -0000	1.24
  @@ -270,7 +270,8 @@
     // gets expanded by the XSLT processor. -->
     T_QNAME = 9,
   
  -  // <!-- Like qname but a whitespace-separated list of QNames. -->
  +  // <!--Used for a whitespace-separated list of QNames where the non-prefixed
  +  // entries are not to be placed in the default namespace. -->
     T_QNAMES = 10,
   
     // <!-- Used for enumerated values -->
  @@ -295,7 +296,11 @@
     T_NCNAME = 17,
     
     // Used for QName attributes that are always AVT.  Prefix isn't resolved.
  -  T_AVT_QNAME = 18;
  +  T_AVT_QNAME = 18,
  +  
  +  // Used for a list of QNames where non-prefixed items are to be resolved
  +  // using the default namespace (This is only true for cdata-section-elements)
  +  T_QNAMES_RESOLVE_NULL = 19;
     
   
     /** Representation for an attribute in a foreign namespace. */
  @@ -1093,8 +1098,9 @@
    }
   
     /**
  -   * Process an attribute string of type T_QNAMES into
  -   * a vector of QNames.
  +   * Process an attribute string of type T_QNAMES into a vector of QNames where
  +   * the specification requires that non-prefixed elements not be placed in a
  +   * namespace.  (See section 2.4 of XSLT 1.0.)
      *
      * @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
      * @param uri The Namespace URI, or an empty string.
  @@ -1126,6 +1132,47 @@
       return qnames;
     }
   
  + /**
  +   * Process an attribute string of type T_QNAMES_RESOLVE_NULL into a vector
  +   * of QNames where the specification requires non-prefixed elements to be
  +   * placed in the default namespace.  (See section 16 of XSLT 1.0; the
  +   * <em>only</em> time that this will get called is for the
  +   * <code>cdata-section-elements</code> attribute on <code>xsl:output</code>.
  +   *
  +   * @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
  +   * @param uri The Namespace URI, or an empty string.
  +   * @param name The local name (without prefix), or empty string if not namespace processing.
  +   * @param rawName The qualified name (with prefix).
  +   * @param value A whitespace delimited list of qualified names.
  +   *
  +   * @return a Vector of QName objects.
  +   *
  +   * @throws org.xml.sax.SAXException if the one of the qualified name strings
  +   * contains a prefix that can not be resolved, or a qualified name contains
  +   * syntax that is invalid for a qualified name.
  +   */
  +  final Vector processQNAMESRNU(StylesheetHandler handler, String uri,
  +    String name, String rawName, String value)
  +    throws org.xml.sax.SAXException
  +  {
  +
  +    StringTokenizer tokenizer = new StringTokenizer(value, " \t\n\r\f");
  +    int nQNames = tokenizer.countTokens();
  +    Vector qnames = new Vector(nQNames);
  +
  +    String defaultURI = handler.getNamespaceForPrefix("");
  +    for (int i = 0; i < nQNames; i++)
  +    {
  +      String tok = tokenizer.nextToken();
  +      if (tok.indexOf(':') == -1) {
  +        qnames.addElement(new QName(defaultURI,tok));
  +      } else {
  +        qnames.addElement(new QName(tok, handler));
  +      }
  +    }
  +    return qnames;
  +  }
  +
     /**
      * Process an attribute string of type T_SIMPLEPATTERNLIST into
      * a vector of XPath match patterns.
  @@ -1360,6 +1407,9 @@
         break;
       case T_QNAMES :
         processedValue = processQNAMES(handler, uri, name, rawName, value);
  +      break;
  +	case T_QNAMES_RESOLVE_NULL:
  +      processedValue = processQNAMESRNU(handler, uri, name, rawName, value);
         break;
       case T_SIMPLEPATTERNLIST :
         processedValue = processSIMPLEPATTERNLIST(handler, uri, name, rawName,
  
  
  
  1.29      +1 -1      xml-xalan/java/src/org/apache/xalan/processor/XSLTSchema.java
  
  Index: XSLTSchema.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/processor/XSLTSchema.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- XSLTSchema.java	24 Jul 2002 14:15:03 -0000	1.28
  +++ XSLTSchema.java	26 Jul 2002 00:28:16 -0000	1.29
  @@ -117,7 +117,7 @@
                                              XSLTAttributeDef.T_CDATA, false, false,XSLTAttributeDef.ERROR);
       XSLTAttributeDef cdataSectionElementsAttr = new XSLTAttributeDef(null,
                                                     "cdata-section-elements",
  -                                                  XSLTAttributeDef.T_QNAMES,
  +                                                  XSLTAttributeDef.T_QNAMES_RESOLVE_NULL,
                                                     false, false,XSLTAttributeDef.ERROR);
       XSLTAttributeDef indentAttr = new XSLTAttributeDef(null, "indent",
                                       XSLTAttributeDef.T_YESNO, false, false,XSLTAttributeDef.ERROR);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org