Declaring an XSLT Extension Function

Extension functions must have one of the following signatures:

public Object FxnName()
       
public Object FxnName(Type1 var1, Type2 var2,...)
       
public static Object FxnName()
       
public static Object FxnName(Type1 var1, Type2 var2,...)
       

    

A class that contains an extension function might look like the following:

import org.w3c.dom.*;
               
import java.lang.Double;
               
public class NumberUtils
               
{ 
               
  public Object Average(NodeList nl)
               
  {
               
    double nSum = 0;
               
  for (int i = nl.getLength() - 1; i >= 0; i--)
               
   {
               
    nSum += 
               
    Double.valueOf(nl.item(i).
               
    getNodeValue()).doubleValue();
               
   }
               
  return new Double(nSum / nl.getLength());
               
  }
               
}
               

            

Investments and Financial Companies That Use Stylus Studio

Stylus Studio provides XML tools & components to leading investment and financial companies! See which top investment and financial companies are banking on Stylus Studio 2006 to simplify their dollars and cents.

XQuery Editor

Stylus Studio's XQuery development tools are a tremendous help in building and testing XML applications requiring a standards-based approach to querying, integrating and transforming data from various distributed data sources.

Educational Institutions That Use Stylus Studio

Education is the most powerful tool one can have. That's why these top education providers reach for Stylus Studio to educate their students and professors as well. See which education providers have the most powerful XML IDE in their classrooms!

Learn XQuery Visually

Stylus Studio offers three infomative XQuery demonstration videos illustrating Stylus Studio's XQuery Editor, Mapper, Debugger and other advanced functionality. Watch them today!

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member