US 20050240876 A1
A system and method is disclosed for generating XSL transformation documents. A software wizard presents a series of screens to lead the user through the authoring process. The screens include a load screen, a select screen, a new entity screen, a conditional screen, and a view screen. The load screen prompts the user for an input document name. The wizard then retrieves XML entities from the input document and presents them to the user in tree form on the select screen. The user selects entities from the tree for inclusion in the output document. The new entity screen allows the user to create new entities for inclusion in the output document. These entities are accumulated in an output list. The conditional screen allows the user to make entities from the output list conditional. The view screen allows review of a tentative transformation document that will accomplish the user's purpose.
1. A computer-readable information carrier medium configured to provide a software wizard for guided creation of transformation documents, the wizard comprising:
a load routine that retrieves a tree of input entities from an input document;
a display routine that shows the tree of input entities;
a create new entity routine that adds a new entity of a user-specified type to an output list of entities, wherein the new entity includes a field specifying an input entity from the tree, wherein when the user-specified type is “replace” the new entity further includes a field for specifying one or more characters to replace with other specified characters as the specified input entity is written to an output document; and
a translation routine that converts the output list into a transformation document, wherein the translation routine converts entities of the replace type into extended stylesheet language (XSL) fragments according to the following pattern:
wherein “EntityName” is a user-specified name of the entity.
2. The medium of
3. The medium of
wherein “EntityName” is a user-specified name of the entity and “Text String” is the specified text string.
6. The medium of
7. The medium of
wherein “EntityName” is a user-specified name of the entity.
9. A computer-readable information carrier medium configured to provide a software wizard for guided creation of transformation documents, the wizard comprising:
a load routine that retrieves a tree of input entities from an input document;
a display routine that shows the tree of input entities;
a create new entity routine that adds a new entity of a user-specified type to an output list of entities, wherein the new entity includes a field specifying an input entity from the tree, and wherein when the user-specified type is “concatenate” the new entity further includes a field for identifying multiple input entities to be concatenated in an output document; and
a translation routine that converts the output list into a transformation document, wherein the translation routine converts entities of the concatenate type into extended stylesheet language (XSL) fragments according to the following pattern:
wherein “EntityName” is a user-specified name of the entity, and wherein “FirstEntityName” and “SecondEntityName” are user-identified input entities.
10. The medium of
11. The medium of
wherein “EntityName” is a user-specified name of the entity.
19. A computer-readable information carrier medium configured to provide a software wizard for guided creation of transformation documents, the wizard comprising:
a load routine that retrieves a tree of input entities from an input document;
a selection routine that allows a user to select input entities for inclusion in an output document, and that further allows the user to choose a non-XML output document format; and
a field definition routine that allows a user to create an ordered list of fields from a list of selected input entities; and
a translation routine that converts the output list into a transformation document.
20. The medium of
21. The medium of
22. The medium of claims 21, wherein the field definition routine prompts the user to enter parameters of each field, wherein the parameters include a delimiter character and a quote character.
23. The medium of
24. The medium of claims 23, wherein the field definition routine prompts the user to enter parameters of each field, and wherein the parameters include a field size and a pad character.
25. The medium of claims 24, wherein the parameters further include an indication of which side pad characters are to be added to a field value having a size smaller than the field size.
26. The medium of
a new field declaration routine that allows the user to specify a name and formula for a new field to be added to the field list.
27. The medium of
28. The medium of
29. The medium of
30. A computer configured to create a transformation document in response to user input, the computer comprising:
a user output device;
a processor; and
a memory that includes a software application which configures the processor to display a series of screens on the user output device to gather input from the user, and further configures the processor to create a transformation document in response to said input,
wherein the series of screens includes:
a load screen that prompts the user for an input document name; and
a select screen that shows entities of the input document in tree form and allows the user to select input document entities for inclusion in the transformation document,
wherein the software application constructs the transformation document according to the following pattern:
wherein “IncludeFile.xsl” is a filename for a library of standardized routines, and
wherein “TemplateNamex” is a name for a template that specifies an action for a corresponding entity.
31. The computer of
32. The computer of
35. The computer of
wherein “strextractor” is a name of a library routine that produces a delimited field, wherein “VariableNamex” is a name of a variable that stores a value for the delimited field, “DelimChar” is a character that separates values in the output file, and “QuoteChar” is a character that encloses values in the output file.
36. The computer of
wherein “Testx” is a user specified test.
1. Field of the Invention
This invention generally relates to automatic code-generation systems and methods for creating transform documents. More specifically, this invention relates to a software wizard (i.e. a structured, graphical user interface) that guides users wanting to generate extensible stylesheet language (“XSL”) transformation documents.
2. Description of the Related Art
The World Wide Web Consortium (“W3C”, www.w3.org) has created several international industry standards designed to facilitate the transfer of information between software applications, including those applications running in different operating systems on different computers. One of these standards is the extensible markup language (“XML”).
XML documents are text documents, with embedded data tags to label and structure the data. The data tags may be of three types: an opening tag, a closing tag, or a composite tag. (A composite tag is simply abbreviated form of an opening tag immediately followed by a closing tag, and will not be discussed further.) The opening and closing tags define the boundaries of data elements in XML documents. Each opening tag must have a corresponding closing tag. Data elements can be nested, but they cannot otherwise overlap.
Data elements include the opening and closing tags and any values (“element values”) or elements (hereafter termed “sub-elements” or “nested elements”) enclosed by the opening and closing tags. In addition to defining the boundaries of the data element, the tags also specify the name of the data element (“element name”). Further, the opening tag may specify the name and values of one or more attributes for the data element (“attribute name” and “attribute value”, respectively). The term “entities” is hereafter used to refer to elements and attributes collectively, so the term “entity name” could refer to the name of either an element or an attribute.
XML files can be mapped to a tree data structure, with nested elements being children of the elements in which they nest. Further details regarding XML can be found in C. Ashbacher, Sams Teach Yourself XML in 24 Hours, Sams Publishing: Indianapolis, ®2000, which is hereby fully incorporated herein by reference.
A primary advantage of XML is extensibility. That is, the tags are user-defined. One consequent advantage of this is human readability. The tags generally indicate the meaning of the elements they enclose, so it is easy for a reader to identify the data. This makes it much easier for programmers to extract desired data values from an XML file. Another advantage is that creating XML files takes only slightly more effort than creating normal text files.
Once W3C created the standard data language XML, they proceeded to create a standard transformation language for processing it, and called it the extensible stylesheet language (“XSL”). The XSL standard was originally intended as a way to specify a presentation format (page layout, font size, etc.) for data in XML documents. However, XSL specification includes another W3C specification called XPath, which in turn provides a transform engine called XSL-Transform, or “XSLT”. XSLT is used to convert XML documents into other forms, such as other XML documents, hyper-text markup language (“HTML”) documents, rich text format (“RTF”) documents, portable data format (“PDF”) documents, and plain-text documents. Further details regarding XSLT can be found in S. Holzner, Inside XSLT, New Riders:Boston, ®2001, which is hereby fully incorporated herein by reference.
The transformation process shown in
However, because XML is powerful, human readable, and can be easily understood and employed, there exists a wide audience of people that employ XML and that wish to employ XSLT. Unfortunately, many of these people lack knowledge of XSL or lack the time to author their own XSL transformation documents. A need exists for a way to enable programmers familiar with XML but less fluent in XSL to generate XSL documents easily and rapidly. Even experienced XSL programmers would benefit from a tool that automates the transformation document authoring process, as such a tool would create standardized XSL code that is compliant with a wide range of XSLT engines and that increases consistency, maintainability, and reusability of the transformation documents.
The problems outlined above are in large measure addressed by a system and method for generating XSL transformation documents. In one embodiment, a computer executes a software wizard. The wizard presents a series of screens to lead the user through the authoring process. The series of screens may include a load screen, a select screen, a new element screen, a conditional screen, a view screen, and a finish screen. The load screen prompts the user for an input document name. The wizard then retrieves the XML elements from the input document and preferably presents them to the user in an easy-to-understand tree form on the select screen. The select screen allows the user to select input document entities from the tree for inclusion in the output document. The new element screen allows the user to create new entities for inclusion in the output document. These entities are accumulated in an output list. The conditional screen allows the user to create entities based on specified conditions. The view screen allows the user to review the tentative XSL code as a transformation document that will accomplish the user's purpose. The finish screen preferably allows the user to test the transformation document on the input document and to view the resulting output document. In addition, the software wizard preferably allows the user to specify output document formats, and allows the user to re-order output entities for fixed-length and delimited output documents. At each step in the authoring process, the user is allowed to return to earlier screens to correct or modify or add to previous actions. The result is a powerful and intuitive tool for achieving the advantages of automatic code generation for XSL transformation documents.
A better understanding of the present invention can be obtained when the following detailed description of the preferred embodiment is considered in conjunction with the following drawings, in which:
As used herein, the term “wizard” is defined to mean a special-purpose software application designed to guide a user through a series of steps to accomplish a task. As such, it may be implemented as a stand-alone utility, or as a component included in a larger software application. The present invention contemplates a wizard for authoring XSL transformation documents. The user may invoke the wizard on a computer system such as the one shown in
The computer system as shown in
The wizard application may be stored on removable information storage media 230, on internal information storage media (e.g. hard drive, ROM, RAM), and/or on remote information storage media (e.g. on other computers, servers, network disks). If stored on remote information storage media, the wizard application may be retrieved via information communication media (e.g. phone lines, networks, the Internet, wireless signals, infrared signals). The term “information carrier media” as used herein includes all types of information storage media and information communication media.
IOH 211 is a chip that provides support for existing bus protocols, thereby allowing existing peripherals to interface with computer 200 without redesign. IOH 211 preferably provides an integrated drive electronics (IDE) bus interface, a PCI bus interface, a low pin count (LPC) bus interface, and one or more universal serial bus (USB) interfaces. In addition to the bus interfaces, the IOH 211 may also provide a network interface. A representative example of an IOH chip 211 is described in further detail in the Intel® 82801BA I/O Controller Hub 2 (ICH2) datasheet, dated October 2000, which is hereby incorporated by reference.
A Super I/O chip (SIO) 212 is coupled to the IOH chip 211 via the LPC bus. The SIO chip 212 provides support for basic input/output devices, such as a serial port, an infrared (IR) port, a parallel port, a floppy disk controller, a musical instrument digital interface (MIDI), a game port, a keyboard interface (for keyboard 210), and a mouse interface. An representative example of an SIO chip 112 is described in further detail in the National Semiconductor PC87366 128-Pin LPC SuperI/O datasheet, dated Jan. 11, 1999, which is hereby incorporated by reference.
To invoke the wizard on computer 200, the user may enter a command on keyboard 210, or click an icon using mouse 240. The input initiates a chain of events that cause the processor 202 to retrieve the wizard from an information carrier medium specified or implied by the command. The wizard is copied to system memory 206. Processor 202 then retrieves and executes instructions in the wizard application. Under the control of the wizard application, the processor 202 provides a graphical user interface (GUI) that prompts the user for additional input using a series of screens such as those discussed below. Upon receiving input from the user, the processor 202 performs additional tasks specified by the wizard application, generally resulting in the creation of an XSL transformation document which is typically stored in internal information storage media.
The wizard 302 preferably allows the user 304 to test the transformation document 106 on the input document 104. This optional step produces a test output document 306 that the user can review to determine if it is satisfactory. If it is unsatisfactory, the user 304 can move back into the process development portion of the wizard and make revisions.
In initially working through the authoring process with wizard 302, the user 304 may wish to rely on an example output document 308 as a guide. The example output document 308 may be a manually constructed mock-up of the desired transformation results from input document 104. It is expected that as the user 304 becomes familiar with the operation of wizard 302, the example output document 308 will be unnecessary.
After the user invokes the wizard in block 402, the wizard shows an introduction screen (
In block 406, the user specifies the file name of input document 104, and may optionally specify the name of an existing transformation document 106. The wizard loads the files and displays information from the input document 104. If the user specifies an existing transformation document, the user can perform additional actions, including invocation of a database (“DB”) map definition wizard in block 407. Otherwise, the user progresses to block 408.
In block 407, a separate DB Map wizard is executed. The DB Map wizard allows users to build an XML mapping file for a proprietary, third party tool (XMLDBMS) which can then be used to extract information from an XML document (e.g. input document 102, or output document 108) for use with most popular database software packages. The operation of the DB Map wizard is beyond the scope of this disclosure.
When the user moves forward to block 408, the wizard shows the selection screen (
In block 410, the wizard shows the creation screen (
When the user moves forward to block 412, the wizard shows the definition screen (
Moving forward to block 414, the wizard shows a conditional screen (
In block 416, the wizard shows an “if logic” screen (
In block 418, the wizard shows a “choose logic” screen (
From block 418, the user can move forward to a view screen (
The user can progress from block 422 to block 424, where the wizard shows the finish screen (
Returning now to block 430, if the user has indicated that the output document 108 should have a fixed length format, then the wizard displays a fixed-length file definition screen (
In block 432, the wizard presents a new entity definition screen (
In block 434, the wizard presents a define conditional logic screen (
At any point in the process, the user can return to an earlier block, and the information that has already been entered will be retained. This allows the user to remove, modify or add elements to the output list.
In the preferred embodiment, the wizard 302 is written in Visual Basic. Each of the screens is an event-driven module that responds to user input. As the user clicks a mouse or types keys on a keyboard, the wizard calls modules to implement the various options offered by the currently-displayed screen. Each of the screens and corresponding modules are discussed in turn below. The relationship between user actions and the created XSL transformation document will also be described.
Further included in the welcome screen 502 are the progress display 526, the screen label 530, the screen message 532, the source window 534, and the work window 536. Progress display 526 includes a list of the wizard screens in order. Next to each screen is an indicator that changes color as the user reaches that step of the authoring process. In
The source window 534 is intended to display the contents of the input document 104, but at this point in the authoring process, the window is empty. The work window 536 is intended to display prompts and entry fields for the current step of the authoring process. Here, the work window 536 preferably displays a welcoming image, e.g. a company logo.
To aid and increase the comfort level of the user, the structure of the welcome screen 502 is preferably preserved throughout each of the steps in the authoring process. Accordingly, the title bar 504 and navigation bar 514 are preferably preserved unchanged in each of the remaining screens, although some of the buttons (e.g. the back button) may be disabled if unsuitable in the current context. Similarly, the progress display 526, screen label 530, screen message 532, and work screen 536 are preferably present in each of the remaining screens, with their content updated as appropriate to the current context. The source window 534 (once the input document is loaded) allows the user to view elements from the input document 104. This window remains available for the user throughout the authoring process. It is described further below.
The only user actions allowed in the welcome screen 502 are those presented in the navigation bar 514.
Pressing the documentation button 516 invokes the documentation routine 604. In block 606, this routine opens the default web browser in a separate window and provides the browser with a link to the W3C website (www.w3.org) where documentation for XML and XSL may be accessed and reviewed. These are primarily reference materials intended for those users wanting to understand nuances of certain language structures. The routine then terminates.
Clicking the help icon 518 triggers the help routine 608. In block 610, this routine opens a help viewer with a pointer to a local help file, and provides the viewer with the current position in the authoring process. The routine terminates after opening the viewer. The help viewer is opened in a separate window, and preferably is able to use the information from the wizard to provide relevant advice to the user. The help viewer may also allow searching if the user is seeking other advice regarding the operation of the wizard.
Pressing the shell button 519 initiates the shell routine 622. In block 624, the wizard presents a query box that allows the user to enter a command. The wizard then in block 626 executes the command in a separate window. This allows the user to invoke, among other things, a text editor, a browser, and alternative XSLT engines. When entering a command, the user is preferably allowed to use abbreviations for the name of the input document file (e.g. “$2”) and transform document file (e.g. “$1”). If the names of these files have been previously provided to the wizard, the wizard will substitute the full pathnames of the files for the abbreviations.
Pressing the back button 520 (when enabled) invokes the back routine 612. The back routine in block 614 moves the wizard back to a previous screen, and then terminates. Similarly, pressing the next button 522 invokes the next routine 616, which in block 618 moves the wizard forward to the next screen in the authoring process.
Pressing the close button 524 initiates the close routine 620. The close routine 620 shuts down the wizard application.
Each of the routines in collection 602 is also made available in each of the remaining screens. Later figures will show additional routines that exist in collection 602.
Referring to both
Alternatively, the user can specify a transformation file in field 708 and press button 710. This initiates transformation document load routine 814. In block 816, the routine determines if the transformation document file exists, and if not, generates an error message in block 818. If the transformation document file is found, the routine in block 820 loads the transformation file and terminates.
If both the input and transformation documents have been loaded, the user can press one of the transform, edit, or database map buttons. Pressing the transform button 712 invokes the transform routine 822. In block 824, the routine verifies that both files have been loaded. If not, an error message is provided in block 826, and the routine terminates. Otherwise, in block 828 an XSLT engine is called to apply the transformation document to the input document, thereby generating an output document. The routine preferably displays the output document in a separate window before terminating.
Pressing edit button 714 initiates the edit routine 830. In block 832, the routine calls a text editor and provides the name of the transformation document. (Only the transformation document may be edited, not the input document). The user then uses the editor in the normal manner, saving his work and exiting when done. When the editor terminates, the routine re-loads the newly-edited transformation document in block 834 and terminates.
Pressing database map button 716 starts the database map routine 836. The database map routine launches a separate wizard that allows the user to map XML data to any commonly used database format using a proprietary, third party software package (XMLDBMS).
The XML tree 906 is shown in outline format. Each element of the input file may have attributes, element values, and sub-elements. Those entities having one or more attributes, element values, and/or sub-elements are shown with an adjacent plus/minus icon, while those entities not having any attributes, element values, or sub-elements are shown without any such icon. The icon is shown with a plus (“+”) if the element has attributes, element values, or sub-elements that are not shown, and shown with a minus (“−”) if all of the element's attributes, element values, and sub-elements are shown. A user can click the icon to change its state. Clicking a plus icon for an element causes the wizard to expand the tree 906 by showing all the attributes, element values, and sub-elements of that element. These sub-elements are indented below the element, and are connected to the element by a (possibly branching) line. Conversely, clicking a minus icon for an element causes the wizard to reduce the tree by hiding all the attributes, element values, and sub-elements of the element. These operations are provided by the expand/reduce routine 1003 in collection 602 (see
Referring to both
The output list is shown in display field 908. An illustrative list is shown in
After this step, there are three types of entities in the output list: the root node, element nodes, and attribute nodes. Element nodes and attribute nodes can be sub-entities of the root node or other element nodes. When the wizard creates the transformation document, it will begin with the root node and work its way down the list. For XML output documents (fixed-length format and delimited format output documents are described further below), the wizard transcribes the root node as follows in the transformation document:
The wizard translates element nodes as follows (a node named “Request” is used as an example):
If the element node has any attribute nodes, the values are inserted at the indicated point. (Attributes are inserted only at “ATTRIBUTES (IF ANY) INSERTED HERE”, not at SUB-ELEMENTS (IF ANY) INSERTED HERE). For example, if a node named “Connect” has as a sub-entity an attribute node named “Disconnect” with a attribute value “No”, the wizard will generate the following in the transformation document:
To create a new element, the user enters the name for the new entity in box 1104, selects a node type (also termed an action type) 1106, selects a parent node from the output list (i.e. the new entity will be a sub-entity of the entity selected from the list) in scroll box 1108, and presses the add button 1110. This invokes the add new entity routine 1204 (
The new entity list is displayed in field 1112. By double-clicking on entities in the field 1112, the user invokes remove new entity routine 1212, which simply removes the entity from the new-entity list in block 1214.
There are five possible new node types. These are: Token Replace, Copy Whole, Concatenate, Strip, and Constant Value. Token replace is used for replacing one or more characters in an element value with other characters. Copy Whole is used for copying an element of the input document to the output document, along with all of the sub-entities of that element. Concatenate is used for combining element values together. Strip is used for removing characters from an element value in the input document. Constant Value is used for inserting a constant value in the output document.
Once the user has entered the information requested, the user presses add button 1308. This invokes routine 1408. In block 1410, the routine inserts the newly-defined entity in the output list. Note that newly added elements will also appear as potential parent elements in scroll box 1108 (
Accordingly, the output list may now contain five additional element types. When creating the transformation document, the wizard translates these elements as follows.
A Token Replace element named “RequestID” that is to replace occurrences of “TP” with “SP” will be translated as follows:
A Copy Whole element named “NewConnect” that is to copy an input document element named “Connect”, along with all the sub-elements of Connect, will be translated as follows:
A Concatenate element named “Combined” that is to be a concatenation of two input document elements named “First” and “Second” will be translated as follows:
A Strip element named “Stripped” that is to be the first letter of an input document element named “MiddleName” will be translated as follows:
A Constant Value element named “ConstantValue” that is to contain the value “ANY VALUE” will be translated as follows:
The wizard translates the element with an attached “if” condition in the following manner. Assume the element name is “State”, with a constant element value “Texas”, and has no sub-elements. Further assume that the condition is “=‘TX’”. The following code appears in the transformation document:
Once the user finishes defining each of the conditions for the current “choose” structure, the user presses the add to output button 1914. This invokes add-to-output routine 2008. In block 2010, the routine adds a new element to the output list, and makes each of the elements in the accumulate box a child of the new element. In block 2012, the user-defined conditions are attached to the corresponding choose-type child elements.
The wizard translates the choose parent element as follows:
Each of the children of the choose parent is then translated in similar fashion to the “if”-type elements, substituting “when” for “if”:
Thus far, the discussion has concentrated on the preferred path when an XML output document is desired. The XSL code excerpts provided herein have been based on a “for-each” design style. It has been discovered that a template-based approach may be preferred for output documents having fixed-width and delimited formats. A separate set of wizard screens has been provided for facilitating the design of the transformation documents for these output files.
Pressing the fixed length button 718 on the selection screen 902 (
To redefine an entity as a field, the user enters a field size (i.e. the number of characters) in entry box 2406, selects a pad side using radio buttons 2408, and enters a pad character in entry box 2410. If the value of the entity has fewer characters than the field size, the value is padded by adding pad characters on the side specified by radio buttons 2408. Once the field size 2406, pad side 2408, and pad character 2410 have been specified, the user presses add field button 2412 or shortcut button 2416 to finish the field redefinition. The new field will be added to the bottom of the field list 2414. This process can be repeated to redefine each of the entities in list 2404. The shortcut key 2418 allows a user to remove a field from the field list 2414 and return it to the available entity list 2404. Shortcut key 2420 removes all of the fields from field list 2414 and places them in the available entity list 2404. These key provide an easy way to remedy errors.
Insert linefeed checkbox 2422 allows the user to specify that a linefeed should be added at the end of the file. By default, linefeeds are only inserted between rows (all of the fields taken together form one row). The order of fields in the list 2414 indicate the field order. Arrow buttons 2424, 2426 allow a user to shift a selected field higher or lower in the field order.
Pressing the transform button 2428 causes the wizard to generate the transformation document and to apply the transformation document to the input document to generate the fixed length output file. The fixed length output file is preferably shown in a separate window for the user to inspect. The view XSL button 2430 causes the wizard to generate the transformation document and display it in a separate window for the user's inspection. The user can save the transformation document from this separate window.
The wizard provides the following transformation document skeleton for fixed length files:
The global variable definitions are discussed further below. The field routines can be to determine and show a field value in an output document, or they may simply be to evaluate an intermediate variable value. The latter option is discussed further below. Fields that are simply redefined entities from the input document are determined in routines. Assume that the name of the redefined entity is “/request/connect/resident/name”. The routine for this field is invoked using the following code:
This same code is used for attributes redefined as fields. Attribute names are indicated using an @ sign. For example:
The field routines that are invoked must be defined. They are preferably defined using the following pattern. Assume that the name of the redefined entity is “/request/connect/resident /name”, that the pad character is “#”, and that the field size is 27.
The conversion of the element to a fixed length field is handled by a library function “strextractor” that is contained in the include file “fixlenggen.xsl”. An example of an include file for delimited output files (not fixed length output files) is provided in an attached appendix. New field button 2432 is used to create new fields in the field list 2414, and conditional button 2434 is used to attach conditions to whichever field is selected. The new field button 2432 causes the wizard to present new field declaration screen 2502. This screen has different variations shown in
Show option 2511 is a yes/no radio button selection. If the show option is selected, the output document will have a field that shows the value of this variable. If the show option is deselected, no corresponding field appears in the output document. This may be desired if the variable is used only for intermediate calculations and does not provide a desired output result. The scope option offers global/local scope options. Global variables can be referred to anywhere in the transformation document, whereas local variables can only be used locally.
Field parameter entry boxes are provided for the field size 2513, the justification 2514, and the pad character 2516. The OK button 2518 completes the definition of the new variable and causes it to be added to the field list 2414 as the user is returned to screen 2402. The cancel button 2520 aborts the definition of the new variable and returns the user to screen 2402.
The necessary parameter for the concatenate type of variable is a list of available entities and values in the order that they are to be concatenated. An entry box 2510 is provided for this purpose.
A global variable definition of a variable called “state” might appear as follows:
The code for a new variable of the concatenate type, assuming a variable name “FullName”, a formula of “first,‘ ’,last”, a local scope, and a selected show option, would appear in the transformation document as follows:
If the show option had been de-selected, the “strextractor” routine call would have been omitted.
The screen for a new constant variable looks essentially identical to
Note that the variable declaration for FirstInitial to is absent. This is due to selecting the Global scope option. The variable declaration is:
Referring momentarily back to
The conditional logic structure for fixed-length files is the when-type structure. Accordingly, the user may add additional tests by pressing the plus button 2916, and may specify in entry box 2914 an action to take if none of the test conditions evaluate to true (the “otherwise” action”). The user may type the desired action in box 2914, or may select from a list of pre-programmed options such as “fill field with pad character”. A list of the test conditions entered so far is provided in list 2918, and the number of conditions 2920 is provided. The field size and pad character are provided at 2926. When finished, the user presses the OK button 2922. If the user wishes to leave this screen without finishing, the cancel button 2924 is used. Two examples of the conditional code are provided below. The first has the conditions inside the template call.
And now, outside the template call:
In addition to the fixed-length format, the wizard also supports the delimited format. In the delimited format, the fields are not restricted to fixed-lengths. Rather, they can be of any length, and a delimiting character is used to separate the fields. In addition, the fields may be enclosed by pairs of any specified quote characters (e.g. single quotes, double quotes, parenthesis, brackets, etc.). The procedure that the wizard leads the user through for delimited files is nearly identical to that for the fixed length files. The required information on screen 2402 (
The underlying data structure for the output list used by the wizard to accumulate the information for the XSL transformation document is preferably an array. In the preferred embodiment, each of the array elements includes a set of 26 fields that simplify the implementation of the wizard, while at the same time making it possible to support the creation of various new element types and the creation of conditional element. The array element fields are individually named and described below.
Unique ID. This field is a unique identifier of the element, which is reset (i.e. not preserved) when the transformation document is re-loaded. It may simply be the ordinal number of the element in the array.
Element/Attribute Name. This field is a string value that stores the name of this element in XML format.
Variable Name. If this element is a new element, this field is a string value that stores the name of the element. Otherwise, it defaults to the empty (null) string.
Alias. This field is a string value that stores any alias for the original name of the element in the input document. Aliasing is used to handle keyword tags if the input document is an XSLT document. When creating a transformation document, the wizard will insert an alias definition and substitute the alias for the original name. This defaults to the empty (null) string.
Full Path. This field is a string value that stores the full path of the element in XPath form. Note that this path information is defined by the input document structure, not the transformation document structure. The path includes the original name of the element. If this is a new element, this field defaults to the empty (null) string.
Levels. This field represents the nesting level (i.e. the number of layers in the full path) of the element. This value for the root element is 1. For sub-elements of the root element, this value is 2. For sub-sub-elements, this value is 3, and so on.
Node Key. This field stores the unique number of the element in the tree view (see
Node Tag. This field is a string value that stores the tag (i.e. the name of the element and the attributes) as shown in the tree view (see
Parent's Unique ID. This field stores the “Unique ID” identifier value of the parent for this element.
Parent. This field is a string value that stores the name of the parent element for this element.
Parent Key. This field stores the unique tree-view number of the parent for this element.
Number of Children. This field stores the number of sub-elements of this element.
Children. This field is a string value that stores a pipe-delimited (the pipe character “|” separates the values) of Unique ID values for the sub-elements of this element.
Children XSL. This is a string value that stores the sub-elements of this element as a complete XSL fragment.
Loop. This field tracks the nesting level of the “xsl:for-each” loop elements.
Sort Order. This field stores the sorted order of the entity list.
Calculation Type. This field stores the selected new element type (1=constant, 2=concatenation, 3=strip, 4=replace, 5=copy whole).
Conditional Type. This field stores the selected condition type (1=if, 2=choose).
Conditional Logic. This field stores the conditional expression to be evaluated.
Conditional XSL. This field stores the condition in complete XSL form.
Process Flag. This field is used by the wizard when generating the transformation document code to indicate whether this element has been processed or not.
Size of Column. This field is used to specify the size of an element having a fixed output width.
Justification. This field is used to specify whether the value for a fixed-size element should be padded on the left or right side.
Pad Character. This field is used to specify the character used to pad the values of fixed-size elements. This defaults to the space character “ ”.
Quote Character. This field is used to specify whether the single quote character or the double quote character should be used for delimited-output elements having string values.
Delimiter. This field is used to specify the delimiter character used to separate the values of delimited-output elements.
Output elements that the user selects to be conditional elements will be assigned a conditional type, and the condition formula provided by the user will be stored in the Conditional Logic field of the element. When the wizard later creates a XSL code for the transformation document, the condition code is stored in the Conditional XSL field, and translated in the fashion described after the description of
Note that the screens described above are representative only, and are not limiting in any fashion. Variations in style, structure, and content, may be employed without departing from the spirit of the invention. The invention contemplates various color schemes, layouts, and procedure variations.
It is further noted that the contemplated embodiment includes a sub-wizard for converting fixed-length input files and delimited input files into XML input documents. The user can then author a transformation document that can be applied to other similarly converted input documents.
The wizard offers numerous advantages relative to manual authoring of a transformation document. One advantage is code standardization. Although there are many ways to accomplish a given task in XSLT, the manner in which the wizard translates elements into XSL transform code is predetermined, and will not vary from document to document. The wizard may use a standardized library of transcription fragments, so that the method a particular element is translated is written in modular form and can be modified with ease. The library can be designed to ensure compliance with a wide range of XSLT engines, so that the transformation documents need not be modified when a different XSLT engine is used. Another substantial advantage is that many typographical and syntax errors are completely eliminated. Most of the transcription document is constructed from automatic transcription fragments, and only a small portion is constructed from manually entered text. Further, because the manually entered text is entered one piece at a time, the user is able to concentrate on each piece in isolation, and is more able to identify and avoid potential errors.
Numerous variations and modifications will become apparent to those skilled in the art once the above disclosure is fully appreciated. For example, the wizard may be adapted to generate Xpointer documents instead of (or in addition to) XSL transformation documents. It is intended that the following claims be interpreted to embrace all such variations and modifications.
An illustrative include file, “delimiter.xsl”, is provided below. This is the include file that the generated transform file requests when the output file is in a delimited format.