Design Approaches

Stylus Studio supports bottom-up and top-down approaches to designing XML pipelines. The approach you take depends largely on personal preference, but it can also be influenced by factors such as whether, for example, your XML pipeline will use existing transformations (like XQuery or XSLT) or you will build them specifically for use in the XML pipeline.

The following section is intended to give you some ideas for XML pipeline design.

Understand the Requirements

Regardless of which approach you choose, you should understand the goal of the XML pipeline before you start building it. For example, you should know

For the purposes of describing bottom-up and top-down design approaches in this section, imagine that the requirement for our XML pipeline is to reder data in a text file as PDF.

Bottom-Up Design

In a bottom-up design approach, you already have the individual components, or most of them, that you will link together to form your XML pipeline. If we were using a bottom-up design approach to create an XML pipeline for the use case described in Understand the Requirements, we would:

Using a bottom-up design approach, we would then use these source files to build our XML pipeline using the following steps:

1. Create a new XML pipeline document.
2. Create a ConvertToXML node to handle the conversion of CSV to XML. We would specify the source .txt file as the ConvertToXML node's input, and choose the Comma-Separated Values built-in converter to convert the text to XML.
3. Drag our XQuery document from the File Explorer or Project window and drop it on the XML pipeline canvas. This would automatically create and specify the XML pipeline's XQuery node for our XML pipeline. Also, because the XQuery was defined to perform XSL-FO post-processing, Stylus Studio automatically would create an XSL-FO node in the XML pipeline.
4. Connect the output port from the ConvertToXML node to the input port of the XQuery node. This instructs the XML pipeline to use the converted text file (now XML) as input for the XQuery transformation.
5. Specify a URL for the XSL-FO node's output port.

When you use a bottom-up approach, Stylus Studio leverages as much of the existing information in the documents you use to build the XML pipeline as possible. Depending on your design environment, you might need to alter the paths specified for input and output nodes, source documents, and so on, and you will typically have to link the nodes in your XML pipeline by creating pipes between appropriate output and input nodes.

Top-Down Design

When you use a top-down design approach, you do not have any pre-existing components - XSLT or XQuery documents, for example - or they might not be completely specified. In this situation, you use the XML Pipeline Editor to sketch a design, and then fill in the details once you have them. Returning to the use case described in Understand the Requirements, we would sketch our XML pipeline by:

1. Creating a new XML pipeline document.
2. Dragging a ConvertToXML icon from the Toolbox pane and dropping it on the canvas.
3. Dragging an XQuery icon from the Toolbox pane and dropping it on the canvas.
4. Dragging an XSL-FO icon from the Toolbox pane and dropping it on the canvas.
5. Connecting the ConvertToXML's output port to the input port of the XQuery node.
6. Connecting the XQuery node's output port to the input port of the XSL-FO node.

The top-down approach results in a rough outline of placeholder nodes of the desired XML pipeline - an abstract or conceptual representation of the code we want to generate to perform XML processing. The next steps would be to:

1. Identify the source document for the ConvertToXML node, and selecting the built-in Stylus Studio converter to be used to convert that source file's data to XML.
2. Creating an XQuery document that

Once these documents are created, they can be used to define nodes that represent them in the XML pipeline. You can do this

 
Free Stylus Studio XML Training: