Interfacing the Oracle XSLT Processor to Java

It takes a little more effort to perform an XSLT transformation using the Oracle XSLT processor’s API. Here I show how it works in a new example, oraclejava.java.

First in oraclejava.java, you must read in the documents you want to work with, using a DOMParser object:

import org.w3c.dom.*; 
import java.util.*; 
import java.io.*; 
import java.net.*; 
import oracle.xml.parser.v2.*; 

public class oraclejava 
{
    public static void main (String args[]) throws Exception 
    {
        DOMParser parser; 

        try 
        {
            parser = new DOMParser(); 
            parser.setPreserveWhitespace(true); 
        . 
        . 
        . 

Next, you convert the URLs of the XML source and XSLT stylesheet documents into Java URL objects, using the parser object’s parse method to read those ...

Get Inside XSLT now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.