Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In this case, you get a XML Infoset that looks like

Code Block
 <dfdl:Table1>
  <Sensor><Boeing747>VeryHigh</Boeing747><Drone2>High</Drone2>...</Sensor>
  <InstrumentRead><Boeing747>High</Boeing747><Drone2>NS</Drone2>...</InstrumentRead>
  ...
</dfdl:table>

This table is referenced using a function call:

Code Block
dfdl:callFunction("tns:AltitudePrecisionTable", ../AltitudeSource, ../Platform)

The dfdl:inputValueCalc expression can be used to populate an element with this value.

To achieve the inverse lookup at unparse time requires a different table, or requires that the ../Platform and ../AltitudeSource elements are themselves members of the Infoset, so they need not be computed.

Now, the above works only if the param values are acceptable as the NCNames of elements. That would be common, but not universally true.

If not, then a more complex table and query is needed, and the non-NCName values must appear as the values of elements e.g.,

Code Block
<dfdl:KVTable>
  <Pair>
    <Key>Sensor</Key>
    <Value><Pair><Key>Boeing747</Key><Value>VeryHigh</Value></Pair><Pair>...
  </Pair>
  ...
</dfdl:table>

Then we want the xpath to be:

Code Block
Pair[Key eq $AltitudeSource]/Value/Pair[Key eq $Platform]/Value

to compute the value. This is potentially less performant, as it's not obvious that the lookup of Pair where the Key element has a specific value is going to be O(1) i.e., constant time.