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

            

Introduction to the XQuery Mapper

This free online video demonstration covers Stylus Studio's synchronized XQuery editing and mapping tool which allows you to create any XQuery expression, either manually using Stylus Studio's XQuery editor.

DTD Generator

Stylus Studio's DTD Generator supports the automatic generation and association of both internal and external DTDs based on XML instance documents.

XPath Introduction - Using XPath Queries to Extract Data from XML Documents

The XPath introduction covers how to use XPath code completion, XPath syntax highlighting, support for XPath 2.0 functions and XML namespaces to simplify your next XPath application.

Varying Record Layout to XML

Not every row in a text file has to have the same layout. Convert to XML has advanced pattern-recognition tools to route the data to where it belongs.

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member