File-type and folder-type global resources are assigned differently. In any one of the usage scenarios below, clicking the Global Resources button displays the Open Global Resource dialog (screenshot below).
Manage Global Resources: Displays the Manage Global Resources dialog.
Selecting a file-type global resource assigns the file. Selecting a folder-type global resource causes an Open dialog to open, in which you can browse for the required file. The path to the selected file is entered relative to the folder resource. So if a folder-type global resource were to have two configurations, each pointing to different folders, files having the same name but in different folders could be targeted via the two configurations. This could be useful for testing purposes.
You can switch to the file dialog or the URL dialog by clicking the respective button at the bottom of the dialog. The Manage Global Resources icon in the top right-hand corner pops up the Manage Global Resources dialog.
File-type and folder-type global resources can be used in the following scenarios:
A global resource can be opened in XMLSpy with the File | Open (Switch to Global Resource) command and can be edited. In the case of a file-type global resource, the file is opened directly. In the case of a folder-type global resource, an Open dialog pops up with the associated folder selected. You can then browse for the required file in descendant folders. One advantage of addressing files for editing via global resources is that related files can be saved under different configurations of a single global resource and accessed merely by changing configurations. Any editing changes would have to be saved before changing the configuration.
A newly created file can be saved as a global resource. Also, an already existing file can be opened and then saved as a global resource. When you click the File | Save or File | Save As commands, the Save dialog appears. Click the Global Resource button to access the available global resources (screenshot below), which are the aliases defined in the current Global Resources XML File.
Select an alias and then click Save. If the alias is a file alias, the file will be saved directly. If the alias is a folder alias, a dialog will appear that prompts for the name of the file under which the file is to be saved. In either case the file will be saved to the location that was defined for the currently active configuration.
|Note:||Each configuration points to a specific file location, which is specified in the definition of that configuration. If the file you are saving as a global resource does not have the same filetype extension as the file at the current file location of the configuration, then there might be editing and validation errors when this global resource is opened in XMLSpy. This is because XMLSpy will open the file assuming the filetype specified in the definition of the configuration.|
XSLT files can be assigned to XML documents and XML files to XSLT documents via global resources.. When the commands for assigning XSLT files (XSL/XQuery | Assign XSL and XSL/XQuery | Assign XSL:FO) and XML files (XSL/XQuery | Assign Sample XML) are clicked the assignment dialog pops up. Clicking the Browse button pops up the Open dialog, in which you can switch to the Open Global Resource dialog and select the required global resource. A major advantage of using a global resource to specify files for XSLT transformations is that the XSLT file (or XML file) can be changed for a transformation merely by changing the active configuration in XMLSpy; no new file assignments have to be made each time a transformation is required with a different file. When an XSLT transformation is started, it will use the file/s associated with the active configuration.
Clicking the command XSL/XQuery | XSL Transformation or XSL/XQuery | XSL:FO Transformation or XSL/XQuery | XQuery Execution pops up a dialog in which you can browse for the required XSLT, XQuery, or XML file. Click the Browse button and then the Global Resource button to pop up the Open Global Resource dialog (screenshot at top of section). The file that is associated with the currently active configuration of the selected global resource is used for the transformation.
When assigning a StyleVision stylesheet to an XML file (Authentic | Assign StyleVision Stylesheet), you can select a global resource to locate the stylesheet. Click the Browse button and then the Switch to Global Resource button to pop up the Open Global Resource dialog (screenshot at top of section). With a global resource selected as the assignment, the Authentic View of the XML document can be changed merely by changing the active configuration in XMLSpy.