Hi Folks,
I am seeking a powerful, declarative XML language for expressing reversible transformations.
Here is an example to illustrate what I mean by reversible transformation. Input files contain an integer
denoting a machine: 0 denotes Intel 386, 1 denotes x86, 2 denotes ARMv7. Here is an input file transformed to XML:
1
à
foo à
<machine>x86</machine>
where foo is some (to-be-determined) declarative, XML language.
Here is the reverse transformation, from XML to original input format:
<machine>x86</machine>
à
foo à 1
To do this reversible transformation, foo must have (declaratively) captured the mapping from integers
to strings (e.g., 1 -> x86).
That level of reversible transformation is already possible using the declarative, XML language Data
Format Description Language (DFDL). DFDL calls these transformations parsing and unparsing.
Here is an example of a more advanced reversible transformation. An input file has this:
W014404 1217
where:
W means West
014404 means 14 degrees, 40.4 minutes
1217 means the month and year of variation (e.g., December 2017)
The input file is transformed to this XML:
<magneticVariation>
<magneticVariationEW>West</magneticVariationEW>
<magneticVariationValue>15.0</magneticVariationValue>
</magneticVariation>
The reverse transformation takes the XML back to the original input format.
To do this reversible transformation, a language must have (declaratively) expressed:
-
the mapping from characters to strings (e.g., W -> West)
-
the mapping from degrees/minutes to decimal degrees (e.g., 014404 -> 15.0)
-
the mapping from month/year of variation to null (e.g., 1217 -> null)
That kind of reversible transformation requires a powerful language. Unfortunately, DFDL cannot (yet) express that kind of reversible transformation.
Do you know of a powerful, declarative, XML language for expressing reversible transformations?
/Roger