XML Pipeline Components

Every XML pipeline consists of a number of components that represent some aspect of XML processing. Typically, an XML pipeline will contain components that represent

  • XML transformations (such as XQuery or XSLT)
  • Source documents and data (an XML, or XML data provided by a Web service, for example)
  • A flow that identifies the processing stages performed in the XML pipeline (whether XML output goes directly to an XSLT transformation for processing, or is first validated using XML Schema, for example)

You also specify values for the input and output ports on these nodes, which determines the flow of the processing defined in the XML pipeline.

This section reviews the components you can include in an XML pipeline.

Transformations

A transformation is an operation that takes an input, performs an action on it, and returns an output. Examples of XML transformations include XQuery and XSLT. Transformation output can be a finished product - XSLT that creates an HTML report, for example - or it can be something that is passed along to another operation for additional processing - XQuery that specifies FO post-processing of the XML it generates, or output passed to an XML Schema for validation, for example.

You can include the following transformations in an XML pipeline in Stylus Studio:

  • XQuery - standard XQuery query, including scenario properties
  • XSLT - standard XSLT transformation, including scenario properties
  • XSL-FO - XSL-FO processing of XML using Apache FOP or RenderX XEP
  • Pipeline - include one pipeline in another
  • HTML Tidy - converts HTML input to XHTML
  • XML Parser - converts text input to XML
  • XML Serializer - converts XML input to text

Flow Control

Flow control nodes control the flow of an XML pipeline. For example, you might choose to use a Stop node to display a message when the XML pipeline encounters an error condition - such as when it requires an XML document fails validation against its XML Schema.

You can use the following nodes to control the flow of an XML pipeline in Stylus Studio

  • Choose - one or more IF conditions, and an ELSE condition
  • Stop - stops XML pipeline processing, if, for example, generated XML does not validate against a given XML Schema
  • Validate - uses XML Schema to validate XML
  • Warning - displays a warning message in output, but allows XML pipeline processing to continue

Data Sources

Data source nodes are used to specify the XML data that is to be processed. For example, your XML pipeline might begin by processing raw XML, or it might require that non-XML data (such as a text file or a relational table) first be converted to XML prior to additional processing.

You can use the following nodes to specify data sources in an XML pipeline:

  • ConvertToXML - specifies an operation that converts a flat file (CSV, binary, and so on) or EDI message type to XML.
  • ConvertFromXML - specifies an operation that converts XML to some other format (CSV, binary, and so on).
  • Pipeline Input - specifies an external input to an XML pipeline that includes the XML pipeline in which this node is defined.
  • Pipeline Output - specifies an external outout to an XML pipeline that includes the XML pipeline in which this node is defined.

Tip

 

You can also provide a data source by specifying the Default Value property on that node's input port. For example, you could specify the URL of an XML document in this way.

Input and Output Ports

XML pipeline nodes are connected to each other by one or more pipes. The pipes represent the flow of XML data from one operation or transformation in the XML pipeline to another. Pipes connect to a node's input and output ports, which are found on most nodes representing XML pipeline components. (Not all nodes have both input and output ports.)

  • You use the input port to specify the expected source for the node. You can specify a default value, or you can connect another node's output port to it with a pipe. For example, you might specify the input port for an XQuery node using the URL for an XML document, or as the output from a ConvertToXML node. If a pipe is connected to an input port, any default value is ignored.
  • You use the output port to specify what to do with result from the node's processing. You can also specify output ports explicitly or implicitly. For example, you might specify the URL to which you want the output of a node be copied, you might link the output to a Validate node's input port, or you might do both.

You specify the flow of an XML pipeline's processing by linking one node's output port to another node's input port.

 
Free Stylus Studio XML Training:
W3C Member