Basic Search  Advanced Search   
Topics Resources Free Library Software XML News About Us
  You are here: home Info Bank Articles » Java, Xalan and XSL Saturday, 23 February 2008
Table of Contents
DTD, Schema & ...
Linking & Querying
Free Library
Wrox Press
New Riders
Prentice Hall
The Coriolis Group
Info Bank
KB Articles
Tips & Tricks
Perfect Solution
Books & Mags
Events 2001
Editors, Authoring Tools
XML Parsers
XSLT Editors
XSLT Engines
XSLT Utilities
XSL Formatters
DTD / Schema Editors..
Information Servers..
Search Engines
XML Browsers
About Us
Contact Us
Ad Info
Link to us
Site Guide
Privacy Policy

XSL Transformation using Xalan and Java
Part I

Part II      

  • Introduction
    In this article Ill be talking about how I used XML, XSLT & Java to solve a problem I faced in the systems interface module of my project. We have various clients with varied type of data files and data streams. They send in their data and we transform those into XML documents and files. Then there is business logic, which uses that data does some more processing and the results are to be sent back to the same clients or different carriers.

  • Details
    Each carrier has its setup. Some accept XML, some only plain TEXT and some HTML. Depending on the output needed we need to transform the given document into the carriers format.

    XML is used as the primary format for transmission of data among the clients and carriers through our system.

    XSLT contains the various translation formats and templates using which the XML documents can be converted from the clients XML to the carriers XML or HTML or Text formats.

    Java programs helped in loading, parsing and creating various structures from the XML documents and data streams. In the programs we also loaded the XSLT files and matched the required template details and converted the XML to the output type i.e. XML, HTML or TEXT.

The basic tools needed for the above setup to be up and running were:
  • JDK 1.2 or higher from Sun,
  • Xalan Java version 1.2 or higher from Apache,
  • XSLT templates developed by the programmer,
  • XML Documents containing data from the clients, &
  • XML / TEXT / HTML format from the carrier

  • Some details about Xalan
    XalanExternal link is a joint project between Sun and Apache Foundation. Xalan is a software program for converting XML based documents into HTML, text or other XML documents using the XSLT and XPath specifications. Xalan is based on the W3C recommendations for XSLT and XPath languages.

    For parsing the XSLT language, it uses an XSLT processor. Xalan has been developed in Java and C++ also. Ill be talking specifically about Xalan-Java version 1.2.2 in this article. In the Java version of Xalan there are some Jar files, which can be used in our projects for transformations. A Java program using Xalan can be a command line application, an applet or a Servlet.

    Xalan uses the Xerces XML parser as its default parser, which is also from the Apache foundation. But we can change that to use any parser that is DOM Level 2 or SAX Level 1 conformed.

    To learn more about Xalan:
    External linkXalan-Java Overview
    External linkGetting Started with Xalan
Ill talk about Java programming and how to develop and deploy the complete translation system in the next few articles.

Part II      

About the author:

Vijay Kukreja Email is a software developer and consultant whose primary focus is a combination of Java and XML. In addition to the many platform-independent benefits of Java applications, he believes that a combination of Java and XML will become the primary driving force in the delivery of structured information on the Web and across heterogeneous systems. Vijay has participated in numerous consulting projects involving Java, CORBA & XML, or a combination of the same. He frequently provides onsite Java and/or XML development at the high-tech companies located in and around Andover, MA. He has also published articles on Java Programming and JSP and Servlets in various online magazines with other consultants.

Vijay holds a Masters degree in Computer Science from the University of Pune (India) and has more than 6 years of experience in the application of computer technology to real-world problems.

The programs and names are registered trademarks of their appropriate owners. The usage of the examples supplied by Apache and Sun are only meant for educational and information purposes. The writer of this article & does not take any responsibility of the functionality of the above Xalan Software. The intended use in this article is only educational and not commercial or otherwise.

  Contact Us | E-mail Us | Site Guide | About PerfectXML | Advertise ©2004 All rights reserved. | Privacy