Choose Nodes

A Choose node uses XPath expressions to evaluate one or more conditions based on its input to direct the flow of XML pipeline processing. The Choose node uses XPath 2.0 to evaulate the XPath expressions defined for it.

Figure 423. Choose Node in retrieveData.pipeline

Input Ports

The Choose node can have one or more input ports; by default, it has a single input port, named Input #0. You use the XPath # property to express a "true" condition - that is, a condition that must be met in order for processing to continue. The Choose node in retrieveData.pipeline, for example, uses the XPath expression . castable as xs:double to check whether or not the user ID it is given as its input is numeric.

The initial context node for each XPath # expression is the data input from Input #0. For additional input ports ( Input #1, Input #2, and so on), data is available to the XPath expression as $var1, $var2, and so on.

The Choose node evaulates XPath#0. If XPath#0 is true, it sends data from Input #0 to Output #0. If XPath#0 is false, it evaluates XPath#1. If XPath#1 is true, it sends data from Input #0 to Output #1, and so on. If none of the XPath # expressions is true, the data from Input #0 is sent to Output `no match' port.

Adding Input Ports

To add an input port to a Choose node:
1. Display the Properties window if it is not already open ( View > Properties).
2. Click the Choose node in the XML pipeline diagram.
3. Change the value for the Number of inputs property.

A new input port is added, named Input #1.

4. Optionally, add an output port for the new input port.

Output Ports

By default, a Choose node has two output ports:

  • Output#0, which is enabled when the condition defined by the corresponding property, XPath #0, is met (the "true" condition)
  • Output `no match', the default "else" condition, which is enabled if an input evaluates to "false"

You can add additional output ports, which you might want to do if you have added an input port. The output port that corresponds to the "true" condition always makes the first input available to its connecting pipe.

Each output port must have a value specified for it. You can

  • Use the Copy to URL property to write the output to a file system
  • Pipe the output to another node (for more processing if the condition evaluates to "true", or to a Stop node if the condition evaluates to "false", for example)
  • Or both

Adding Output Ports

To add an output port to a Choose node:
1. Display the Properties window if it is not already open ( View > Properties).
2. Click the Choose node in the XML pipeline diagram.
3. Change the value for the Number of choices property.

A new output port is added, named Output #1.

Updating Relational Data Using Stylus Studio

Updating Relational Data Using Stylus Studio

How to Build PDF Forms using Stylus Studio

Learn how to build PDF Forms using Stylus Studio and the RenderX XEP FO processor

XSL-List Blog

XSL-List is a discussion forum on the Extensible Stylesheet Language (XSL), covering the XSL specification, XSL processors, tools, user questions, trends and more. Bookmark this RSS or ATOM feed now!

Government Agencies That Use Stylus Studio

Government agencies all around the nation are pledging their allegiance to Stylus Studio. Come see which government agencies are using the only XML IDE by the people and for the people.

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member