You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by ig...@apache.org on 2003/10/16 23:20:05 UTC

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

igorh       2003/10/16 14:20:05

  Modified:    java/src/org/apache/xalan/processor XSLTAttributeDef.java
                        XSLTSchema.java
  Log:
  Patch for Bugzilla Bug 788. Submitted by  Richard Cao.
  
  Revision  Changes    Path
  1.31      +53 -1     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.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- XSLTAttributeDef.java	15 Oct 2003 14:42:35 -0000	1.30
  +++ XSLTAttributeDef.java	16 Oct 2003 21:20:05 -0000	1.31
  @@ -284,6 +284,8 @@
     T_STRINGLIST = 14,
   
     // Used for a list of white-space delimited strings.
  +  // Prefixes are checked to make sure they refer to 
  +  // valid namespaces, and are resolved when processed
     T_PREFIX_URLLIST = 15,
     
     // Used for enumerated values, one of which could be a qname-but-not-ncname
  @@ -297,8 +299,12 @@
     
     // 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;
  +  T_QNAMES_RESOLVE_NULL = 19,
     
  +  // Used for a list of white-space delimited strings.
  +  // strings are checked to make sure they are valid 
  +  // prefixes, and are not expanded when processed. 
  +  T_PREFIXLIST = 20;
   
     /** Representation for an attribute in a foreign namespace. */
     static XSLTAttributeDef m_foreignAttr = new XSLTAttributeDef("*", "*",
  @@ -1281,6 +1287,47 @@
     }
   
     /**
  +    * Process an attribute string of type T_PREFIXLIST into
  +    * a vector of prefixes that may be resolved to URLs.
  +    *
  +    * @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 list of whitespace delimited prefixes.
  +    *
  +    * @return A vector of strings that may be resolved to URLs.
  +    *
  +    * @throws org.xml.sax.SAXException if one of the prefixes can not be resolved.
  +    */
  +   StringVector processPREFIX_LIST(
  +           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 nStrings = tokenizer.countTokens();
  +     StringVector strings = new StringVector(nStrings);
  +
  +     for (int i = 0; i < nStrings; i++)
  +     {
  +       String prefix = tokenizer.nextToken();
  +       String url = handler.getNamespaceForPrefix(prefix);
  +       if (prefix.equals(Constants.ATTRVAL_DEFAULT_PREFIX) || url != null)
  +         strings.addElement(prefix);
  +       else
  +         throw new org.xml.sax.SAXException(
  +              XSLMessages.createMessage(
  +                   XSLTErrorResources.ER_CANT_RESOLVE_NSPREFIX, 
  +                   new Object[] {prefix}));
  +    
  +     }
  +
  +     return strings;
  +   }
  +
  +
  +  /**
      * Process an attribute string of type T_URL into
      * a URL value.
      *
  @@ -1438,6 +1485,11 @@
       case T_AVT_QNAME :
           processedValue = processAVT_QNAME(handler, uri, name, rawName, value, owner);
           break;
  +    case T_PREFIXLIST :
  +      processedValue = processPREFIX_LIST(handler, uri, name, rawName,
  +                                             value);
  +      break;
  +
       default :
       }
   
  
  
  
  1.34      +2 -2      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.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- XSLTSchema.java	30 Jan 2003 18:45:45 -0000	1.33
  +++ XSLTSchema.java	16 Oct 2003 21:20:05 -0000	1.34
  @@ -345,7 +345,7 @@
       XSLTAttributeDef xslExcludeResultPrefixesAttr =
         new XSLTAttributeDef(Constants.S_XSLNAMESPACEURL,
                              "exclude-result-prefixes",
  -                           XSLTAttributeDef.T_STRINGLIST, false, false,XSLTAttributeDef.ERROR);
  +                           XSLTAttributeDef.T_PREFIXLIST, false, false,XSLTAttributeDef.ERROR);
       XSLTAttributeDef xslExtensionElementPrefixesAttr =
         new XSLTAttributeDef(Constants.S_XSLNAMESPACEURL,
                              "extension-element-prefixes",
  @@ -885,7 +885,7 @@
       
       XSLTAttributeDef excludeResultPrefixesAttr =
         new XSLTAttributeDef(null, "exclude-result-prefixes",
  -                           XSLTAttributeDef.T_STRINGLIST, false,false,XSLTAttributeDef.WARNING);
  +                           XSLTAttributeDef.T_PREFIXLIST, false,false,XSLTAttributeDef.WARNING);
       XSLTAttributeDef extensionElementPrefixesAttr =
         new XSLTAttributeDef(null, "extension-element-prefixes",
                              XSLTAttributeDef.T_PREFIX_URLLIST, false,false,XSLTAttributeDef.WARNING);
  
  
  

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