You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by dl...@locus.apache.org on 2000/03/31 20:17:50 UTC

cvs commit: xml-xalan/src/org/apache/xalan/xslt ElemExtensionCall.java

dleslie     00/03/31 10:17:49

  Modified:    src/org/apache/xalan/xslt ElemExtensionCall.java
  Log:
  Added getAttributeList() method to support enumeration
  of extension element attributes.
  
  Revision  Changes    Path
  1.11      +39 -31    xml-xalan/src/org/apache/xalan/xslt/ElemExtensionCall.java
  
  Index: ElemExtensionCall.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xslt/ElemExtensionCall.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ElemExtensionCall.java	2000/03/16 17:33:39	1.10
  +++ ElemExtensionCall.java	2000/03/31 18:17:49	1.11
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  + *    notice, this list of conditions and the following disclaimer.
    *
    * 2. Redistributions in binary form must reproduce the above copyright
    *    notice, this list of conditions and the following disclaimer in
  @@ -18,7 +18,7 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:  
  + *    if any, must include the following acknowledgment:
    *       "This product includes software developed by the
    *        Apache Software Foundation (http://www.apache.org/)."
    *    Alternately, this acknowledgment may appear in the software itself,
  @@ -26,7 +26,7 @@
    *
    * 4. The names "Xalan" and "Apache Software Foundation" must
    *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written 
  + *    software without prior written permission. For written
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -95,47 +95,47 @@
       return Constants.ELEMNAME_EXTENSIONCALL;
     }
   
  -  ElemExtensionCall(XSLTEngineImpl processor, 
  +  ElemExtensionCall(XSLTEngineImpl processor,
                       Stylesheet stylesheetTree,
                       // ExtensionNSHandler nsh,
                       String extns,
                       String lang, String srcURL, String scriptSrc,
  -                    String name, 
  +                    String name,
                       String localPart,
                       AttributeList atts,
                       int lineNumber, int columnNumber)
       throws SAXException
     {
       super(processor, stylesheetTree, name, atts, lineNumber, columnNumber);
  -        
  +
       m_extHandlerLookup = new String("ElemExtensionCall:"+extns);
       m_extns = extns;
       m_lang = lang;
       m_srcURL = srcURL;
       m_scriptSrc = scriptSrc;
  -    
  -    if (m_lang.equals ("javaclass") && (m_srcURL != null)) 
  +
  +    if (m_lang.equals ("javaclass") && (m_srcURL != null))
       {
  -      try 
  +      try
         {
           String cname = m_srcURL;
           boolean isClass = false;
  -        if (cname.startsWith ("class:")) 
  +        if (cname.startsWith ("class:"))
           {
             cname = cname.substring (6);
             isClass = true;
           }
           // m_javaClass = Class.forName (cname);
         }
  -      catch (Exception e) 
  +      catch (Exception e)
         {
           // System.out.println("Extension error: "+e.getMessage ());
           throw new XSLProcessorException (e.getMessage (), e);
         }
       }
  -    
  -    // Make a copy of the attributes, so we can give them to the 
  -    // extension in raw form.  The alternative to doing this is to 
  +
  +    // Make a copy of the attributes, so we can give them to the
  +    // extension in raw form.  The alternative to doing this is to
       // reconstruct the list in raw form.
       m_attrs = new MutableAttrListImpl(atts);
   
  @@ -144,7 +144,7 @@
       this.localPart = localPart;
       m_attrs = new MutableAttrListImpl(atts);
     }
  -  
  +
     /**
      * Tell if this extension element is available for execution.
      */
  @@ -153,13 +153,13 @@
       return isAvailable;
     }
   
  -  public void execute(XSLTEngineImpl processor, 
  -                      Node sourceTree, 
  +  public void execute(XSLTEngineImpl processor,
  +                      Node sourceTree,
                         Node sourceNode,
                         QName mode)
  -    throws XSLProcessorException, 
  -           java.net.MalformedURLException, 
  -           java.io.FileNotFoundException, 
  +    throws XSLProcessorException,
  +           java.net.MalformedURLException,
  +           java.io.FileNotFoundException,
              java.io.IOException,
              SAXException
     {
  @@ -167,7 +167,7 @@
       {
         processor.flushPending();
         XMLParserLiaisonDefault liaison = ((XMLParserLiaisonDefault)processor.getXMLProcessorLiaison());
  -      ExtensionNSHandler nsh 
  +      ExtensionNSHandler nsh
           = (ExtensionNSHandler)liaison.m_extensionFunctionNamespaces.get(m_extns);
   
         if(null == nsh)
  @@ -177,7 +177,7 @@
           liaison.addExtensionElementNamespace(m_extns, nsh);
         }
         nsh.processElement (localPart, this,
  -                          processor, 
  +                          processor,
                             m_stylesheet,
                             sourceTree, sourceNode, mode, m_javaClass, this);
       }
  @@ -195,8 +195,8 @@
           // System.exit(-1);
         }
         // processor.message(msg);
  -      isAvailable = false; 
  -      for (ElemTemplateElement child = m_firstChild; child != null; child = child.m_nextSibling) 
  +      isAvailable = false;
  +      for (ElemTemplateElement child = m_firstChild; child != null; child = child.m_nextSibling)
         {
           if(child.getXSLToken() == Constants.ELEMNAME_FALLBACK)
           {
  @@ -204,20 +204,28 @@
           }
         }
       }
  +  }
  +
  +  /**
  +   * Return the Attributes
  +   */
  +  public AttributeList getAttributeList()
  +  {
  +    return m_attrs;
     }
  -  
  +
     /**
      * Return the raw value of the attribute.
      */
     public String getAttribute(String name)
     {
  -    String value = m_attrs.getValue(name);  
  +    String value = m_attrs.getValue(name);
       return value;
     }
   
     /**
  -   * Return the value of the attribute interpreted as an Attribute 
  -   * Value Template (in other words, you can use curly expressions 
  +   * Return the value of the attribute interpreted as an Attribute
  +   * Value Template (in other words, you can use curly expressions
      * such as href="http://{website}".
      */
     public String getAttribute(String name, Node sourceNode, XSLTEngineImpl processor)
  @@ -233,11 +241,11 @@
           {
             XPathSupport execContext = processor.getXMLProcessorLiaison();
             return avt.evaluate(execContext, sourceNode, this,
  -                              new StringBuffer());        
  +                              new StringBuffer());
           }
         } // end for
       }
  -    return null;  
  +    return null;
     }
   
   }