Skip to main content

Problem:

How can I use Altova MapForce to generate import and export stylesheets?

Resolution:

Start a new Mapforce project.

Add the Schema (XSD) document that describes the input XML document. For the import (to COBOL) stylesheet, this was the XSD document you obtain from the external standard or specification. As you add this Schema document, Mapforce asks if you would like to add an XML instance document.  If you have a sample XML document that complies with the schema, add it here.

Add the schema that describes the output XML document. For the import (to COBOL) this is .xsd file created by the cobtoxml utility. As you add this Schema document, Mapforce asks if you would like to add an XML instance document, to which you respond 'No' since this is the output schema. (Notice that Mapforce does not distinguish between the input and output schema as you add the schema documents. Instead, it relies on the direction in which you connect the documents in the next step.)

The schema documents are displayed as tree structures in two boxes. Expand the tree structures to expose the XML elements that are of interest. Notice the direction of the arrowheads beside each element. You describe the mapping (or translation) from the input to the output document by a click-and-drag operation from the arrowhead on the right side of the input document element to the arrowhead on the left side of the output document element.

You may check the stylesheet that will be generated by clicking on the 'XSLT' tab at the bottom of the mapping window.

When the mapping is complete you may check the output by clicking on the 'Output' tab at the bottom of the mapping window. At this point, Mapforce applies the stylesheet it has generated to the XML instance document (i.e. the sample input document) and displays the result in the window. You can inspect the result and make changes to the map as necessary.

When you are satisfied with the XSLT output, choose Generate code in XSLT from the File menu.

Finally, save the Mapforce project itself. The project is saved in an XML document with the .mfd extension.

    

Old KB# 7434