You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Introduction

Some functionalities are either not supported or too difficult to express using the DPath expression language. While it is possible to add desired functionality to the codebase, some may be applicable to only a small dataset and won't have widespread use. It also leaves the burden of implementing said functionalities on the Daffodil developers. We would like Daffodil to be able to register and execute external/user defined functions in DPath expressions.

Use Cases/Examples

A trivial use case would be adding a replace function callable from a DPath expression. In the DFDL Schema, we might call  something like the below; Where the function will return "Hello_World" if the element resolves to "Hello World". 

dfdl:choiceDispatchKey="{ sdf:replace(xs:string(header/MessageIdentifier/MessageTextFormatIdentifier), ' ', '_') }"

Another use case would be implementing normalizing elevation above Mean-Sea-Level (MSL) to Height-Above-Ellipsoid (HAE) for Link16F1 data. In the DFDL schema, we might call something like the below; where the functions will return the result of the conversion.

dfdl:outputValueCalc="{ mhdf:convert_to_hae(xs:int(../land_point_track_initial_word/composite_elevation/raw), xs:int(../land_point_track_continuation_word_3/hae_adjustment/raw), xs:float(../land_point_track_initial_word/composite_elevation/scaling_factor)) }"

The function prototype for use cases would look something like

  • No labels