Browse Prior Art Database

Method for Producing Multiple Versions of an XSL Transformation From a Single Code Base

IP.com Disclosure Number: IPCOM000028576D
Original Publication Date: 2004-May-21
Included in the Prior Art Database: 2004-May-21
Document File: 2 page(s) / 62K

Publishing Venue

IBM

Abstract

This pre-processor uses five simple tags in a BUILD file to control how other files of XSLT fragments are conditionally assembled to produced a complete stylesheet dynamically.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 51% of the total text.

Page 1 of 2

Method for Producing Multiple Versions of an XSL Transformation From a Single Code Base

An XSL stylesheet tells how to convert XML documents from one format to another. In one application, a customer's software describes his order in one format (e.g. CFXML) but the manufacturer wants to receive the order in a different format (e.g. a RosettaNet PIP). In addition, the manufacturer may need variations in the description of the order depending on which of multiple manufacturing sites receives the XML order document. Many other applications require similar diversity within a common theme.

Normally a separate XSL stylesheet is maintained for each version of the transform. These stylesheets can easily exceed 1000 lines in length but differ in only 3 or 4 lines. Maintaining separate, nearly identical, stylesheets is usually easier than using XSLT commands to pull code from a common source into the differing versions. Because of restrictions built into the XSLT language, stylesheets with conditional includes are very obscure and still repetitive.

However, the use of the following five preprocessor tags reduces both complexity and storage space. These tags placed in a build file control the assembly of various XSLT fragments into a completed stylesheet. Where, previously, there were multiple stylesheets of 1000 lines each, there are now multiple build files of 50 lines or less each. Where, previously, there was 99% duplication among multiple stylesheets, there is now only one set of XSLT fragment files with no duplication. By thus isolating common code, the differences between versions can be handled at either a modular (file name) level or specific (line of code) level, whichever makes most sense to the maintainer.

By the use of seven additional tags (not discussed here) values are retrieved from the end user which determine which fragment files will be included in the completed stylesheet or what variables will be passed to it. Files containing fragments of XSLT have the ".wsl" extension. Using the five tags, a build file looks like this:

.ASSIGN $country South Africa
.INCLUDES
. 'process.wsl'
. 'common.wsl' <xsl:output cdata-section-elements="Attachments"/>
. 'root.wsl'
.TEST list_box[1] '_partial.wsl...