Source Documents and XML Instances

As described previously, Stylus Studio uses the source documents you specify to display a structure you can use to create mappings to the target structure. In addition to the document structure, Stylus Studio needs document content information in order to compose a correct XSLT stylesheet. You provide this information by associating a XML instance to each source document you specify.

Types of associations

Source documents can have one of three associations, each of which has implications for the XPath expressions written by Stylus Studio, which uses these documents when it composes the XSLT stylesheet. A source document can be associated with

l Itself. That is, the document represented by structure displayed on the Mapper tab and the XML instance are one in the same. In this situation, Stylus Studio generates the document() function in the XSLT stylesheet. For example:
l The XML document specified in the XSLT scenario. Only one source document can be associated with the XSLT scenario. In this situation, Stylus Studio does not generate the document() function in the XSLT stylesheet. In this situation, the document() function is not necessary because Stylus Studio uses the XSLT input document specified in the Scenario Properties dialog box.
By default, Stylus Studio uses the first XML document you add to the XSLT mapper as the source XML for the XSLT scenario, as shown here:
The document specified in the Source XML URL field on the Scenario Properties dialog box is the document to which the XSLT is applied when you preview the XSLT. You can select this association for another XML document if you choose, but only one source document may have this association.
l Some other XML instance. A XSD or DTD document used as a mapper source document must always be associated with an XML instance. In this situation, Stylus Studio generates the document() function in the XSLT stylesheet when accessing nodes of the document structure.

Source document icons

Stylus Studio uses different document icons to indicate how a source document structure is related to corresponding XML document content.

How to change a source document association

To change a source document association:
1. Click the Mapper tab if necessary.
2. Right click the source document whose association you want to change.
The source document shortcut menu appears.
3. Click Associate With, and then select the document you want to associate with the source document.
 
Free Stylus Studio XML Training: