home
NEWS       BLOGS       FORUMS       NEWSLETTERS       RESEARCH       EVENTS       DIGITAL LIBRARY       CAREERS  
Network Computing Network Computing Powered by InformationWeek Business Technology Network

IMMERSE YOURSELF:

SOA

  |

Data Center

  |

802.11n

  |

Data Privacy

  |
APO  |

Virtualization

  |

NAC

  |

Security

  |

Network Mgmt

  |

Enterprise Apps

  |

Storage & Servers



Netdesign Manual

Part 3

Java XML Programmers Reference

Chapter 11: XML Tools for Information Appliances


October 8, 2001


Brought to you by:





Check It Out!

XSLT Compiler (XSLTC)

The XSLT Compiler, originally produced by Sun Microsystems, but now donated to the Apache XML Project, is a tool for compiling extensible stylesheets into lightweight Java code. The compiled XSL sheets consist of standard Java bytecode and are called translets. During runtime, whenever your code wants to transform some XML, only three steps need be taken:

  • Ask the XSLTC runtime to parse an XML document
  • Pass the object representing the parsed XML to the translet, along with an object implementing interface org.xml.sax.DocumentHandler or org.apache.xalan.xsltc.DOM
  • Tell the translet to transform() the parsed XML

The translet calls back into the object implementing the org.xml.sax.DocumentHandler interface using the standard SAX 1.0 callback mechanism, or builds a DOM-style tree with the object implementing org.apache.xalan.xsltc.DOM.

In this way, the XSLTC runtime and translets can be used to repeatedly generate any type of output based upon original stylesheets and any input XML.


Compiled stylesheets are called translets.


The XSLT Compiler is itself written in Java, so translet creation can be done on any operating system with a Java 2 VM. Translets are merely Java classes, but are designed to run on any Java VM, not just Java 2 VMs. Since they are class files, their compilation is usually done with build scripts along with the rest of your project code.

The XSLT Compiler can be downloaded from http://xml.apache.org/xalan-j

It has two important dependencies:

  • The Constructor of Useful Parsers (CUP) Parser Generator
  • The Byte Code Engineering Library (BCEL)

The CUP Parser Generator is used to generate a Java parser and scanner from a stylesheet (the grammar). BCEL is used by XSLTC to convert the parser and scanner from Java source code to bytecode. Both are included as JARs in the Xalan distribution.

In this section, we will:

  • Examine what is supported and not supported by XSLTC
  • Discuss the benefits of translets over traditional transformation engines, specifically in regard to lightweight clients
  • Make a translet using a real example
  • Review the major classes and steps involved in using the XSLTC

What's Supported, What's Not Supported

Sun and Apache have done an excellent job covering the XSLT 1.0 recommendation. It will be easier to list the features of XSLT that aren't supported by XSLTC, rather than the ones that are.

Feature

Supported

Notes

SAX 2.0 callbacks (org.xml.sax.ContentHandler) for transformed documents

No

SAX 1.0's org.xml.sax.DocumentHandler is supported

Simplified stylesheets

No

The simplified syntax for stylesheets that consist of only a single template for the root node isn't permitted. The syntax is a literal result element that can represent the whole document. For example:

 

<total xsl:version="1.0" xmlns:xsl=

http://www.w3.org/1999/XSL/Transform>

 

<xsl:value-of select="cart/total"/>

 

</total>

 

Notice the <xsl:stylesheet> prolog is missing, along with some other things.

 

For more information, click here

Match patterns with id attribute

No

The ability to match elements by their unique id attribute is unsupported

Match patterns using <xsl:key>

No

The ability to match elements using implicit cross-referencing (keys) is unsupported. For more information, see http://www.w3.org/TR/xslt.html#key

Namespace axis

No

The namespace axis isn't supported. It is defined this way: if the starting node in the axis is an element, the axis selects all the namespace nodes that are in scope for that element; otherwise, the axis selects nothing. For instance: <<namespace::*>>

Document validatation

Yes

DTD validation of XML source

DOM parser included

Yes

If you're using XSLTC on a lightweight client, you can make use of the DOM Level 1 parser independent of XSLTC that comes with xml.jar. No need to include the JAR files for NanoXML or other parsers.

SAX parser included

Yes

A SAX 1.0 parser comes with the xml.jar library. The parser can actually be removed and replaced with another SAX library, but the current documentation on how to do this is non-existent.


PAGE: 1 | 2 | 3 | 4 | 5 | 6 | NEXT PAGE
 





Ready to take that job and shove it?

Function:

Keyword(s):

State:
SPONSOR
RECENT JOB POSTINGS
CAREER NEWS
Go beyond Google and get vertical. These specialized search sites will help you find the business information you need -- fast.

Ari Balogh was named to the post of chief technology officer as the companys for a "realignment" of employees.










InformationWeek U.S. IT Salary Survey 2008
Salaries for business technology professionals are falling. Here's what you need to know in order to make good hiring decisions and personal career choices. Download Today
 
ROLLING RIGHT ALONG
Follow key Network Computing Reviews from conception to completion. This Week: Holistic APM.



Network Computing Reports Emerging Enterprise Podcast Series: Secrets to Success








TechSearch


Microsite of the Week


Powerful Information at Your Fingertips



InformationWeek Business Technology Network
InformationWeekInformationWeek 500InformationWeek 500 ConferenceInformationWeek AnalyticsInformationWeek CIO
InformationWeek EventsInformationWeek ReportsInformationWeek MagazinebMightyByte and SwitchDark Reading
Digital LibraryIntelligent EnterpriseInternet EvolutionNetwork ComputingNo JitterPlug Into The Cloud
space
Techweb Events Network
InteropVoiceConWeb 2.0 ExpoWeb 2.0 SummitEnterprise 2.0 ConferenceMobile Business ExpoSoftware ConferenceCSI - Computer Security Institute
Black HatGTECEnergy CampMashup CampStartup Camp
space
Light Reading Communications Network
Light ReadingLight Reading EuropeUnstrungLight Reading's Cable Digital NewsConstantinopleInternet EvolutionPyramid Research
Heavy ReadingLight Reading Live!Light Reading InsiderEthernet ExpoOptical ExpoTeleco TVTower Technology Summit
space
Financial Technology Network
Advanced TradingBank Systems & TechnologyInsurance & TechnologyWall Street & TechnologyAccelerating Wall StreetBank Systems & Technology Executive SummitBuyside Trading SummitInsurance & Technology Executive Summit
space
Microsoft Technology Network
MSDN MagazineTechNetThe Architecture Journal
space


App Infrastructure   |   Messaging & Collaboration   |   Network & Systems Mgmt   |   Network Infrastructure   |   Security  |   Storage & Servers   |   Wireless   |   Enterprise Apps
About Us  |  Contact Us  |  Site Map  |  Technology Marketing Solutions  |  Advertising Contacts  |   Briefing Centers
Copyright © 2008  United Business Media LLC  |  Privacy Statement  |  Terms of Service  |  Your California Privacy Rights