Skip to main content

Generating ATL and XSLT from the same weaving model

This example generates XSLT and ATL transformations from the same weaving model. It contains two ATL HOTs (higher-order transformations). The first HOT transforms a weaving model into an ATL model. The second HOT transforms a weaving model into an XSLT model.


Loading the weaving model into AMW:
The weaving model (models/FK2Nested_AMW.ecore) must be loaded using the wizard to be able to create the metadata file in the workspace.
This step does not need to be executed to produce the HOTs.
Left metamodel: metamodels/FKMetaSchema.ecore.
Right metamodel: metamodels/NestedMetaSchema.ecore.


Executing the HOT:
The file hot/AMWtoATL.atl is a higher-order transformation. There is a launch configuration file with the input and output models.
The transformation produces a transformation model output_atl/ATL-model.ecore. The output model must be extracted into the ATL technical space (i.e., produce an ATL file). The model may be extracted by right-clicking in the ecore model in the "AM3 Resource Navigator" view and by clicking in "Extract ATL-0.2 model into ATL-0.2 file". This action produces the ATL-model.atl file.
When using ATL versions before "January 13, 2006", use AMWtoATL_old.atl to be compatible with previous versions of the ATL metamodel.

Executing the transformation:
The ATL-model.atl transformation transforms the models/libraryFK.ecore model (conforms to metamodels/FKMetaSchema.ecore) into models/libraryNested.ecore (conforms to metamodels/NestedMetaSchema.ecore). Use the launch configuration that is provided in the .zip file.


Executing the HOT:
There is an Ant Script (/generateXSLT.xml) that automatically produces the XSLT file. It executes the following actions:

  • executes the ATL HOT (hot/AMWtoXSLT.atl) that produces an XSLT model (hot/XSLTout.ecore) conforming to the XSLT metamodel (metamodels/XSLT.ecore),
  • transforms the XSLT model into a XML model (models/XMLModel_XSLT.ecore),
  • extracts the XML model into the XML technical space, i.e., into a XSLT transformation (xslt/FK2Nested.xslt).
    Remark: The 'XML2Text.atl' transformation must be modified to use the local path of the output XSLT.

Executing the transformation:
The XSLT transformation takes as input a XML file (xslt/libraryFK.ecore) and produces the xslt/output.xml file.
Remark: We used XMLSpy as XSLT engine.

These transformations can be executed separatedly as well. Each transformartion has a predefined "launch configuration" file.

Back to the top