Defining Global Resources
Altova Global Resources are defined in the Manage Global Resources dialog, which can be accessed in two ways:
•Click the menu command Tools | Global Resources.
•Click the Manage Global Resources icon in the Global Resources toolbar (screenshot below).
The Global Resources Definitions file
Information about global resources is stored in an XML file called the Global Resources Definitions file. This file is created when the first global resource is defined in the Manage Global Resources dialog (screenshot below) and saved.
When you open the Manage Global Resources dialog for the first time, the default location and name of the Global Resources Definitions file is specified in the Definitions File text box (see screenshot above):
This file is set as the default Global Resources Definitions file for all Altova applications. So a global resource can be saved from any Altova application to this file and will be immediately available to all other Altova applications as a global resource. To define and save a global resource to the Global Resources Definitions file, add the global resource in the Manage Global Resources dialog and click OK to save.
To select an already existing Global Resources Definitions file to be the active definitions file of a particular Altova application, browse for it via the Browse button of the Definitions File text box (see screenshot above).
|Note:||You can name the Global Resources Definitions file anything you like and save it to any location accessible to your Altova applications. All you need to do in each application, is specify this file as the Global Resources Definitions file for that application (in the Definitions File text box). The resources become global across Altova products when you use a single definitions file across all Altova products.|
|Note:||You can also create multiple Global Resources Definitions files. However, only one of these can be active at any time in a given Altova application, and only the definitions contained in this file will be available to the application. The availability of resources can therefore be restricted or made to overlap across products as required.|
Managing global resources: adding, editing, deleting, saving
In the Manage Global Resources dialog (screenshot above), you can add a global resource to the selected Global Resources Definitions file, or edit or delete a selected global resource. The Global Resources Definitions file organizes the global resources you add into groups: of files, folders, and databases (see screenshot above).
To add a global resource, click the Add button and define the global resource in the appropriate Global Resource dialog that pops up (see the descriptions of files, folders, and databases in the sub-sections of this section). After you define a global resource and save it (by clicking OK in the Manage Global Resources dialog), the global resource is added to the library of global definitions in the selected Global Resources Definitions file. The global resource will be identified by an alias.
To edit a global resource, select it and click Edit. This pops up the relevant Global Resource dialog, in which you can make the necessary changes (see the descriptions of files, folders, and databases in the sub-sections of this section).
To delete a global resource, select it and click Delete.
After you finish adding, editing, or deleting, make sure to click OK in the Manage Global Resources dialog to save your modifications to the Global Resources Definitions file.
Relating global resources to alias names via configurations
Defining a global resource involves mapping an alias name to a resource (file, folder, or database). A single alias name can be mapped to multiple resources. Each mapping is called a configuration. A single alias name can therefore be associated with several resources via different configurations (screenshot below).
In an Altova application, you can then assign aliases instead of files. For each alias you can switch between the resources mapped to that alias simply by changing the application's active Global Resource configuration (active configuration). For example, in Altova's XMLSpy application, if you wish to run an XSLT transformation on the XML document MyXML.xml, you can assign the alias MyXSLT to it as the global resource to be used for XSLT transformations. In XMLSpy you can then change the active configuration to use different XSLT files. If Configuration-1 maps First.xslt to MyXSLT and Configuration-1 is selected as the active configuration, then First.xslt will be used for the transformation. In this way multiple configurations can be used to access multiple resources via a single alias. This mechanism can be useful when testing and comparing resources. Furthermore, since global resources can be used across Altova products, resources can be tested and compared across multiple Altova products as well.