XSL (Extensible Stylesheet Language) - Implementation in JDK

This section provides a tutorial example on how to write a simple program, XSLClassChecker.java, to view implementation classes of XSL (Extensible Stylesheet Language) in JDK.

JDK offers the following interfaces to support XSL (Extensible Stylesheet Language):

One thing is missing here: who represents the transformation style rules? The answer is that javax.xml.transform.Source also represents transformation style rules, because they written in XML.

I have a simple program here, XSLClassChecker.java, to show what are the XSL implementation classes:

/* XSLClassChecker.java
 - Copyright (c) 2014, HerongYang.com, All Rights Reserved.
 */
import javax.xml.transform.Source;
import javax.xml.transform.Result;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
class XSLClassChecker {
   public static void main(String[] args) {
      try {
         TransformerFactory f = TransformerFactory.newInstance();
         System.out.println(f.toString());
         Transformer t = f.newTransformer();
         System.out.println(t.toString());
         Source s = new StreamSource();
         System.out.println(s.toString());
         Result r = new StreamResult();
         System.out.println(r.toString());
         t.transform(s,r);
      } catch (TransformerConfigurationException e) {
         System.out.println(e.toString()); 	
      } catch (TransformerException e) {
         System.out.println(e.toString()); 	
      }
   }
}

Output with JDK 1.8:

com.sun.org.apache.xalan.internal.xsltc.trax
   .TransformerFactoryImpl@1db9742

com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl@25154f

javax.xml.transform.stream.StreamSource@10dea4e

javax.xml.transform.stream.StreamResult@647e05

javax.xml.transform.TransformerException: Result object passed to 
   ''{0}'' is invalid.

Note that:

If you are still using JDK 1.4.1, you may get something like:

org.apache.xalan.processor.TransformerFactoryImpl@119298d
org.apache.xalan.transformer.TransformerIdentityImpl@1f33675
javax.xml.transform.stream.StreamSource@1690726
javax.xml.transform.stream.StreamResult@9931f5
javax.xml.transform.TransformerException: No output specified

Last update: 2014.

Table of Contents

 About This JDK Tutorial Book

 Downloading and Installing JDK 1.8.0 on Windows

 Downloading and Installing JDK 1.7.0 on Windows

 Downloading and Installing JDK 1.6.2 on Windows

 Java Date-Time API

 Date, Time and Calendar Classes

 Date and Time Object and String Conversion

 Number Object and Numeric String Conversion

 Locales, Localization Methods and Resource Bundles

 Calling and Importing Classes Defined in Unnamed Packages

 HashSet, Vector, HashMap and Collection Classes

 Character Set Encoding Classes and Methods

 Character Set Encoding Maps

 Encoding Conversion Programs for Encoded Text Files

 Socket Network Communication

 Datagram Network Communication

 DOM (Document Object Model) - API for XML Files

 SAX (Simple API for XML)

 DTD (Document Type Definition) - XML Validation

 XSD (XML Schema Definition) - XML Validation

XSL (Extensible Stylesheet Language)

XSL (Extensible Stylesheet Language) - Implementation in JDK

 XSLTransformer.java - XML Transformer

 Message Digest Algorithm Implementations in JDK

 Private key and Public Key Pair Generation

 PKCS#8/X.509 Private/Public Encoding Standards

 Digital Signature Algorithm and Sample Program

 "keytool" Commands and "keystore" Files

 KeyStore and Certificate Classes

 Secret Key Generation and Management

 Cipher - Secret Key Encryption and Decryption

 The SSL (Secure Socket Layer) Protocol

 SSL Socket Communication Testing Programs

 SSL Client Authentication

 HTTPS (Hypertext Transfer Protocol Secure)

 Outdated Tutorials

 References

 PDF Printing Version