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());
               
  }
               
}
               

            

Food & Beverage Services

"I'll have a burger and a side of Stylus Studio", says these top food & beverage services that use Stylus Studio in everyday operations. Come see which food & beverage services eat up the idea of having the most powerful XML IDE at their finger tips!

XQuery API for Java (XQJ)

DataDirect XQuery is an embeddable software product based on the XQuery and XQJ standards that enables Java developers to access both relational and XML data sources using a single XQuery query. Runs on Oracle, SQL Server, DB2, and more!

Business Solutions & Outsourcing

Business Solutions & Outsourcing companies know the best solutions. That's why they choose Stylus Studio to enhance their business productivity. See which companies are already using Stylus Studio 2006 to take care of their own business!

Developer Resource Center: Learn XML and Stylus Studio

Learning XML is easy with Stylus Studio. Check out our free XML tutorials, XML whitepapers, online video demonstrations, XML examples and XML references and more.

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member