You can use multiple schema sources in your SPS. This enables you to combine data from different XML documents in the output. For example, in one XML document you can have the structure of an organization, with its various departments. In another XML document you can have the listing of personnel in the various departments. In the output, the organizational structure data (first XML document) and the personnel data (second XML document) can be combined.
|Note:||If, across the multiple schemas used, there are two or more global elements that have the same expanded QName, there will be a naming conflict and one or more of the involved schema documents will be rendered invalid. You must therefore ensure that no two global elements across the multiple schemas have the same expanded QName. Local elements across multiple schemas may have the same expanded QName as other local elements, and will not cause any naming conflict.|
In order to combine the dynamic XML data from different documents, you first add to the SPS the different schemas that are involved. You do this in the Design Overview sidebar (screenshot below). This creates a tree for each schema in the Schema Tree sidebar (screenshot below). You can choose the Working XML File, Template XML File, and Root elements for each added schema (see screenshot below and the topic Design Overview sidebar). The global elements in all the added schemas are listed in the All Global Elements tree of the Schema Tree sidebar, and are available for creation as global templates.
Note that XML signatures can only be enabled for the main source.
Each schema source is identified by a parameter of the form $XML1 (DTD or XML Schemas) or $DB1 (DB-based schema) or $USER1 (user-defined schema). These three kinds of schemas can be combined in a single SPS (see screenshot below). Note, however, that, while any number of DTDs and/or XML Schemas can be added to an SPS, only one each of a DB-based schema and a user-defined schema can be added.
Of all the schemas added to the SPS, one can be designated as the main schema, and, in both the Design Overview and Schema Tree sidebars, this is indicated with the the word (main) next to the main schema. The document node of the XML document corresponding to the main schema will be the starting point of the transformation. To select the main schema, right-click the schema in the Design Overview sidebar, and select Set as Main Schema.
Within the main template, nodes from different schemas are added to the design by dragging the nodes from their respective schema trees into the main template. A global template is created in the same way as with a single schema. It can be copied or used by a local template, or used instead of the built-in template when invoked via a rest-of-contents instruction from the main template.
Each schema added to the SPS is identified by a parameter. For example, $XML (for DTDs or XML Schemas) or $DB (DB-based schema) or $USER (user-defined schema). In StyleVision, the Working XML File that is associated with each schema is known to the application, so the correct document nodes are accessed, thus enabling the display of data from the XML sources in Authentic View and output previews. However, when you generate XSLT stylesheets from the SPS, no XML file associations are contained in the stylesheet. In order to associate an XML file with each schema in the XSLT stylesheet, you must pass the location of each XML file as the value of the corresponding schema parameter. For example, the schema parameter, $XML, according to the screenshot above, would have a value of "[path]NanonullOrg.xml".
Note: The following points should be noted.
•For DB-based schemas, it is the XML file generated from the DB (via File | Save Generated Files) that should be passed as the value of the $DB parameter.
•Any value passed for the main schema parameter will be ignored. The XSLT stylesheet will use as its starting point the document node of the XML document that is being transformed.