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

            

XML-DEV Discussion Forum

XML-DEV is a leading technical forum for XML discussion and a valuable free XML learning resource. Subscribe to the XML-DEV email discussion forum today to help further your XML education.

JavaServer Pages IDE (JSP IDE)

The Stylus Studio JSP IDE provides syntax help and code completion for developing JSP 1.2 and JSP 2.0 applications.

XML Schema Editor

Stylus Studio's XML Schema Editor lets you easily develop advanced data models expressed in W3C XML Schema. Its synchronized split-pane interface shows both a visual XML Schema Diagram and the underlying code, and you can edit in either one.

Insurance Companies That Use Stylus Studio

Everyone needs insurance, even insurance companies. That's why these top insurance companies are insured when it comes to XML. Come see which insurance providers are insured by the power of Stylus Studio!

Stylus Most Wanted

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.