A mapping using Global Resources will behave differently in each environment where it is run, as shown below.
Global Resources in XSLT, XSLT2, XQuery
When you generate XSLT or XSLT2 code and the mapping uses Global Resources, this does not affect the generated XSLT stylesheet in any way. With or without Global Resources, the input and output files are not a permanent assignment and can be specified flexibly anyway when you run the XSLT stylesheet in your XSLT processor. The same applies for generated XQuery code.
An exception to this is the DoTransform.bat file generated for RaptorXML execution. Any Global Resources used by the mapping will be resolved to actual paths in DoTransform.bat, taking into account the value (configuration) which is currently selected from the Global Resource drop-down list.
For information about supplying Global Resources to RaptorXML, refer to the RaptorXML documentation (see https://www.altova.com/documentation.html).
Global Resources in C#, C++, Java
When you generate C#, C++, or Java program code, any Global Resources used by the mapping will be resolved. For example, a file or folder alias defined as Global Resource will be converted to the actual file or folder path. If a particular Global Resource configuration is selected from the Global Resources drop-down list, then the code will be generated for the selected configuration. The Messages window provides information as to how exactly a Global Resource was resolved, for example:
To generate code for a particular Global Resource configuration, select it from the Global Resource drop-down list before generating code. Alternatively, if you generate code from the command line, supply the GLOBALRESOURCEFILE and GLOBALRESOURCECONFIG parameters at the command line (see also MapForce Command Line Interface).
It is not possible to switch or refer to Global Resources from generated code (instead, you can modify the code to change the input or output file path).
Note: In C# or Java, you can change not only the path but also the data type of input or output, see Changing the data type of the mapping input/output (C#, Java).
Global Resources in MapForce Server
When you compile a mapping to a MapForce Server execution file (.mfx), any Global Resources references used by the mapping are preserved as such. In MapForce Server, the following is required to run an .mfx file compiled from a mapping which uses Global Resources:
|1.||The path to the Global Resource XML file (that is, the file where Global Resources are defined, see The Global Resources XML File).|
|2.||The Global Resource configuration name. The name of the default configuration is "Default". If you created additional configurations, as explained in Creating Global Resources, then the desired configuration must be called by its corresponding name.|
The Global Resource file path and the name of the configuration can be specified as follows:
|•||If you run the mapping through the command line interface, set the options --globalresourceconfig and --globalresourcefile after the run command, for example:|
C:\Program Files (x86)\Altova\MapForceServer2019\bin\MapForceServer.exe run SomeMapping.mfx --globalresourcefile="C:\Users\me\Documents\Altova\GlobalResources.xml" --globalresourceconfig="Default"
|•||If you run the mapping through the MapForce Server API, call the method SetOptions two times before calling the Run method. The first call is required to supply the Global Resource XML file path as option, and the second one is required to supply the Global Resource configuration name.|
For more information, refer to the MapForce Server documentation (see https://www.altova.com/documentation.html).
© 2019 Altova GmbH