Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explore refactoring XProc choose/when/otherwise idiom into conditional sequences #12

Open
Conal-Tuohy opened this issue Oct 26, 2015 · 0 comments

Comments

@Conal-Tuohy
Copy link
Owner

Many XProc-Z pipelines consist of nested conditional control structures containing subpipelines. If the subpipelines are written inline, and have their own conditional controls, then indenting can become excessive and overall comprehensibility reduced. One way to deal with this is to declare new pipelines and call them from the subpipelines.

Another way to deal with the issue is to replace the choose/when/otherwise idiom by a custom conditional step which performs a test and, depending on the result, copies its default input sequence to one or other of its output sequences. The subpipelines which were previously children of the when and otherwise become steps at the same level as the choice step, and connected to the appropriate output port of the conditional step. Useful conditional steps might include method matchers (with output ports GET, PUT, POST, etc.), URI pattern matchers (with output ports matched and unmatched), boolean expression evaluators (with ports true and false), etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant