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.*;
               
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 Schema Documentation Generator

Stylus Studio's XML Schema Editor includes an integrated XML Schema documentation generator, allowing you to easily publish XML content models defined in XML Schema in a convenient, HTML format. A screenshon of the XML Schema Editor is shown here.

XSL-List

The XSL-List forum is a valuable learning resource for the Extensible Stylesheet Language (XSL), covering the XSL specification, XSL processor implementations, and XSL user questions. Get this free XSL resource delivered to your inbox today.

XSD Documentation Generator

Stylus Studio®'s XSD Editor includes an integrated XSD documentation generator, allowing you to easily publish XML content models defined in XSD in a convenient, HTML format.

XML Code Folding

Stylus Studio's XML Editor features XML code folding, a powerful and intuitive way to maximize limited screen real-estate and help make sense of large XML files.

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member