You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by sb...@locus.apache.org on 2000/08/01 00:09:09 UTC

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

sboag       00/07/31 15:09:09

  Modified:    java/src/org/apache/xalan/processor ProcessorLRE.java
                        XSLTAttributeDef.java XSLTSchema.java
  Log:
  Process xsl:extension-element-prefixes to create ElemExtensionCall instead of LRE.
  
  Revision  Changes    Path
  1.2       +47 -1     xml-xalan/java/src/org/apache/xalan/processor/ProcessorLRE.java
  
  Index: ProcessorLRE.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorLRE.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ProcessorLRE.java	2000/06/19 16:52:07	1.1
  +++ ProcessorLRE.java	2000/07/31 22:09:07	1.2
  @@ -57,6 +57,9 @@
   package org.apache.xalan.processor;
   
   import org.apache.xalan.templates.ElemLiteralResult;
  +import org.apache.xalan.templates.ElemTemplateElement;
  +import org.apache.xalan.templates.Stylesheet;
  +import org.apache.xalan.templates.ElemExtensionCall;
   import org.xml.sax.SAXException;
   import org.xml.sax.Attributes;
   
  @@ -79,10 +82,36 @@
       XSLTElementDef def = getElemDef();
       Class classObject = def.getClassObject();
       
  +    boolean isExtension = false;
  +    ElemTemplateElement p = handler.getElemTemplateElement();
  +    while(null != p)
  +    {
  +      // System.out.println("Checking: "+p);
  +      if(p instanceof ElemLiteralResult)
  +      {
  +        ElemLiteralResult parentElem = (ElemLiteralResult)p;
  +        isExtension = parentElem.containsExtensionElementURI(uri);
  +      }
  +      else if(p instanceof Stylesheet)
  +      {
  +        Stylesheet parentElem = (Stylesheet)p;
  +        isExtension = parentElem.containsExtensionElementURI(uri);
  +      }
  +      if(isExtension)
  +        break;
  +      p = p.getParentElem();
  +    }
  +    
       ElemLiteralResult elem = null;
       try
       {
  -      elem = (ElemLiteralResult)classObject.newInstance();
  +      if(isExtension)
  +      {
  +        // System.out.println("Creating extension(1): "+uri);
  +        elem = new ElemExtensionCall();
  +      }
  +      else
  +        elem = (ElemLiteralResult)classObject.newInstance();
         elem.setLocaterInfo(handler.getLocator());
         elem.setPrefixes(handler.getNamespaceSupport());
         elem.setNamespace(uri);
  @@ -99,6 +128,23 @@
       }
       
       setPropertiesFromAttributes(handler, rawName, attributes, elem);
  +    
  +    // bit of a hack here...
  +    if(!isExtension)
  +    {
  +      isExtension = elem.containsExtensionElementURI(uri);
  +      if(isExtension)
  +      {
  +        // System.out.println("Creating extension(2): "+uri);
  +        elem = new ElemExtensionCall();
  +        elem.setLocaterInfo(handler.getLocator());
  +        elem.setPrefixes(handler.getNamespaceSupport());
  +        elem.setNamespace(uri);
  +        elem.setLocalName(localName);
  +        elem.setRawName(rawName);
  +        setPropertiesFromAttributes(handler, rawName, attributes, elem);
  +      }
  +    }
       
       appendAndPush(handler, elem);
     }
  
  
  
  1.5       +29 -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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XSLTAttributeDef.java	2000/07/30 22:46:30	1.4
  +++ XSLTAttributeDef.java	2000/07/31 22:09:07	1.5
  @@ -204,7 +204,10 @@
       T_NMTOKEN = 13,
   
       // Used for a list of white-space delimited strings.
  -    T_STRINGLIST = 14
  +    T_STRINGLIST = 14,
  +    
  +    // Used for a list of white-space delimited strings.
  +    T_PREFIX_URLLIST = 15
       ;
   
     static XSLTAttributeDef m_foreignAttr 
  @@ -500,6 +503,28 @@
     }
     
     /**
  +   * Process an attribute string of type T_STRINGLIST into 
  +   * a vector of XPath match patterns.
  +   */
  +  StringVector processPREFIX_URLLIST(StylesheetHandler handler,
  +                                  String uri, String name,
  +                                  String rawName, String value)
  +    throws 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);
  +      strings.addElement(url);
  +    }
  +    return strings;
  +  }
  +
  +  
  +  /**
      * Process an attribute string of type T_URL into 
      * a URL value.
      */
  @@ -577,6 +602,9 @@
         break;
       case T_STRINGLIST:
         processedValue = processSTRINGLIST(handler, uri, name, rawName, value);
  +      break;
  +    case T_PREFIX_URLLIST:
  +      processedValue = processPREFIX_URLLIST(handler, uri, name, rawName, value);
         break;
       default:
       }
  
  
  
  1.5       +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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XSLTSchema.java	2000/07/28 22:13:47	1.4
  +++ XSLTSchema.java	2000/07/31 22:09:07	1.5
  @@ -218,7 +218,7 @@
       XSLTAttributeDef xslExtensionElementPrefixesAttr
         = new XSLTAttributeDef(Constants.S_XSLNAMESPACEURL, 
                                "extension-element-prefixes", 
  -                             XSLTAttributeDef.T_STRINGLIST, false);
  +                             XSLTAttributeDef.T_PREFIX_URLLIST, false);
   
       XSLTAttributeDef xslUseAttributeSetsAttr
         = new XSLTAttributeDef(Constants.S_XSLNAMESPACEURL, 
  @@ -623,7 +623,7 @@
   
        XSLTAttributeDef extensionElementPrefixesAttr
         = new XSLTAttributeDef(null, "extension-element-prefixes", 
  -                             XSLTAttributeDef.T_STRINGLIST, false);
  +                             XSLTAttributeDef.T_PREFIX_URLLIST, false);
        
        XSLTAttributeDef idAttr
         = new XSLTAttributeDef(null, "id",