Setting the XQuery Node Data Sources

Although the XQuery code was specified with default data sources, we want the XQuery to use the data sources we defined in the two ConvertToXML nodes we created in Configuring Data Sources. We do this by connecting the output ports on the ConvertToXML nodes to the input ports on the XQuery node.

To set an XQuery node's data sources:
1. With the pointer over the Get books catalog from txt file ConvertToXML node, drag and drop the output port on the allBooks input port on the Extract full order information XQuery node.
2. Repeat this procedure, connecting the output port from the Get order from EDIFACT request ConvertToXML node to the ediOrder input port on the Extract full order information XQuery node.

Default and Specified Port Values

As you can see in Figure 472, an input port can have both a default value, and a value provided by another node's output port. Note, however, that an output port's default value is never used if a pipe is connected to the port - the pipe either supplies a value or it does not, but the default value is ignored.

An Alternate Way to Create ConvertToXML Nodes

It should be noted that when you add an XQuery or an XSLT document to an XML pipeline, Stylus Studio creates other nodes required to support the resulting XQuery or XSLT node, based on the XQuery or XSLT definition. For example, since createFullOrder.xquery was defined to use Stylus Studio's built-in converters to create XML data source documents, simply dragging and dropping the createFullOrder.xquery on the XML pipeline canvas would have automatically created the XQuery node and both ConvertToXML nodes, one for each data source specified in the XQuery code.

We will see this functionality in action later, when we add another XQuery document to the XML pipeline. (See Add createReport.xquery for more information.)

 
Free Stylus Studio XML Training: