BizTalk Utilities CV ,   Jobs ,   Code library  
 
Home Page
XALAN
<< WCF, WS, SOAP
XHTML >>
 

By :Mark Wilson
I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :03/19/2008
Times viewed :5680

 

Xalan: Getting Started

Introduction

Xalan-J provides transformation API to convert XML into any other document (XML, .TXT etc..) by applying XSLT stylesheet. Xalan-j fully supports XSL Transformations (XSLT) Version 1.0 and the XML Path Language (XPath) Version 1.0. XSLT is the first part of the XSL stylesheet language for XML. It includes the XSL Transformation vocabulary and XPath, a language for addressing parts of XML documents.

To know more details about XSLT and XPATH, please visit http://www.w3.org/TR/xsl and http://www.w3.org/TR/xpath.

XSLT stylesheets are well formed XML documents, they contains instructions to convert XML document XML, HTML, XHTML or plain text. In structural terms, an XSL stylesheet specifies the transformation of one tree of nodes (the XML input) into another tree of nodes (the output or transformation result).

Example of XSLT:

Let’s look into the XML document

<?xml version="1.0" encoding="UTF-8"?>

<employee>

     <employeename>test</employeename>

     <employeeaddress>test123</employeeaddress>

     <SSN>12343456</SSN>

     <company>XYZ Corporation</company>

</employee>

I want to convert this XML document into a HTML document in a tabular format.

Let’s look into the XSLT stylesheet

<?xml version='1.0'?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">

<html>

<head><title>XSLT Example</title></head>

<body>

     <xsl:for-each select="//employee">

          <BR><B>Employee Name:<xsl:value-of select="employeename"/></B></BR>

          <BR><B>Employee Address:<xsl:value-of select="employeeaddress"/></B></BR>

          <BR><B>SSN:<xsl:value-of select="SSN"/></B></BR>

          <BR><B>Company:<xsl:value-of select="company"/></B></BR>

     </xsl:for-each>

</body>

</html>

</xsl:template>

</xsl:stylesheet>

The output would be:

Employee Name:test
Employee Address:test123
SSN:12343456
Company:XYZ Corporation

By default XALAN-J works with Xerces-Java but it can be configured to work with any parsers.

Features of XALAN-JAVA

  • XALAN-JAVA contains XSLT processor for use in a tooling and debugging environment and a Compiling processor (XSLTC) for use in a high performance runtime environment.
  • Fully supports W3C provided XSLT1.0 and XPATH1.0
  • XALAN-JAVA implements TrAX. This transformation API for XML which in built on SAX2 and SOM Level2.
  • XALAN-JAVA by default works with Xerces-java.
  • XALAN-JAVA can be configured to work with api XML Parser API.
  • Chaining mechanism can be used for transformation. E.g. output of one transformation can be used an the input to another transformation.
  • XALAN-JAVA can be run from command line. Please look into the Process document as a part of XALAN tutorial in topxml.com to know more details on command line operation.
  • XALAN-JAVA can be used in server componet e.g. servlet to perform the transformation.

Setting up your environment

The very first thing you need to do is to set up your classpath to refer all jar files provided with XALAN-java directory. include xalan.jar, xml-apis.jar, and xercesImpl.jar -- or another conformant XML parser.

To run the Xalan-Java Interpretive processor sample applications, include xalansamples.jar (all samples other than the servlet) and xalanservlet.jar. To run JavaScript extensions, include bsf.jar. All these JAR files are distributed with Xalan-Java.

If you are using JDK or JRE 1.2.2, 1.3.x or 1.4.x, include tools.jar on the classpath. If you are using JDK or JRE 1.1.8 (supported for runtime only), then include classes.zip on the classpath.

Please go through this tutorial to enhance your understanding on transformation using XALAN-java.


Rate this article on a scale of 1 to 10

Your vote :  


 

Recent Jobs

Integration Specialist Needed - Wor
Virtualization Server Infrastructur
A great opportunity to Digital Vide
here is a greate opportunity as a S
A great opportunity as a Network En

View all Jobs (Add yours)
View all CV (Add yours)




swimming pool builder
chicago web site design
spfxmasks
Cheap Web Hosting
conference calling
Juicy couture sunglasses
answering service


    Email TopXML  

Front Page Daily Stuff TopXML Forum XML blogs XML Newsgroups BizTalk Biztalk Utilities Biztalk Utilities Tutorial B2B SAP XML Microsoft .NET Dotnet System XML Soapformatter SQLXML XMLserializer XQuery PHP PHP SimpleXML PHP XML Dom PHP XML RPC PHP XSLT Java Java Java XML Xalan Microsoft ASP ASP Schemas XML SQL Server XML XMLDom XSL XSL Tutorial XSLT Stylesheets General Javascript CSS XHTML WAP