Mapping between XML files

You can use the XML mapping editor to map one or more source XML documents to a single target XML document.

After defining the mappings, you can generate an XSLT script. The generated script can then be used to combine and transform any set of XML documents conforming to the original set of source DTD or XML schemas.

The following instructions were written for the Resource perspective, but they will also work in many other perspectives.

The steps that you would typically follow to map your XML files and generate an XSLT file are as follows:

  1. Create a project...

    File | New | Project | Simple | Project

    ...and a folder...

    File | New | Folder

    ...to hold your XML, XSD, DTD and generated files.

  2. Select the folder and create a new XML to XML mapping...

    File | New | Other | XML | XML to XML Mapping

    If you cannot see the XML option, select the Show All Wizards check box.

  3. Specify or import your source files and target file, then identify the root element for any of the DTD or XSD files that you specified.

  4. In the XML to XML mapping editor, map the source and target files by mapping nodes, defining functions, and grouping elements. You can also specify sort keys and create xsl:choose instructions.

  5. Generate the XSLT script.

Once you have generated your XSLT script, you can apply it to an XML file by selecting the XML and XSL files in the Navigator view and selecting...

Run | XSL Transformation

...from the pop-up menu.

 

 

See Also

XML to XML mapping editor
The XML to XML mapping editor is a visual tool used to map one or more source XML documents to a single target XML document.

Specifying source and target files
You can specify either DTD, XML, or XML schema (XSD) files as your source and target files.

Editing an XML to XML mapping
After you have created an XML to XML mapping, you can open it in the XML to XML mapping editor by double-clicking it in the Navigator view.

Generating XSLT script
After you complete your mappings in the XML to XML mapping editor, you can generate an XSLT script.