October 23, 2016
Hot Topics:

Code Generation With XSL

  • December 30, 2002
  • By Jeff Ryan
  • Send Email »
  • More Articles »

Generated Java Bean

To view the complete generated program, click here.

Think of how much time it would take to hand code this class versus the time spent to author the meta data file. And the generated code will compile and run properly the first time.


XSL can do more than transform XML into other markup languages. It is an excellent code generation language. Meta data can be quite naturally structured in XML. XSL can easily process the meta data via a "pull" or rules-based fashion and invoke code fragments in modular templates.

We developed a JavaBean generator to demonstrate the concept. XSL techniques such as modes and called routines were used to modularize the code. The code generation technique demonstrated here could also be used to generate EJB classes, JDBC code, or classes running on a framework like Struts. But the rest is up to you.

Code Examples

To download the example XML stream and stylesheet, click here.

About the Author

Jeff Ryan is an architect for Hartford Financial Services. He has eighteen years of experience designing and developing automated solutions to business problems. His current focus is on Java, XML, and Web Services technology. He may be reached at jryan@thehartford.com.
Other Articles Written by Jeff Ryan

Page 3 of 3

Comment and Contribute


(Maximum characters: 1200). You have characters left.



Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Sitemap | Contact Us

Thanks for your registration, follow us on our social networks to keep up-to-date
Rocket Fuel