XProc 3.0 Tutorial
What is XProc?
XProc is a declarative programming language with an XML syntax for processing data in pipelines.
- XProc is based on the concept of pipelines.
- Pipelines take data as input and generate output data.
- A pipeline consists of steps which perform various actions on the data.
- These actions range from reading and writing data, Web requests and complex transformations and validations.
- XProc is mainly focused on manipulating XML but can handle HTML, JSON, text and binary data as well.
Why should I use XProc?
Many programmers combine XML processing steps such as XSLT transformations, XQuery queries, and schema validations with some form of glue code. Scripting and programming languages are usually used for this, most of them usually offer only poor support for XML. Frequently, the code is not declarative, depends on installed tools and lacks reusability and interoperability. XProc has several advantages over this approach:
- XProc provides a declarative syntax and a high level of abstraction to write complex pipelines.
- XProc offers a large step library for checking and manipulating XML data.
- Build your own step library: Your Proc pipelines can be reused as custom steps in other XProc pipelines.
- The powerful XML expression and query language XPath is included.
- Modern XProc processors allow to process pipelines more efficiently with parallel execution and caching
What is this tutorial about?
This tutorial provides an introduction into the fundamentals of XProc 3.0 like pipelines, ports and steps. You learn how to write your own pipelines and set up an XProc processor to execute your pipelines. Advanced programming concepts such as conditionals, iterations, and error handling are covered. Each step of the XProc step library is described and illustrated with code examples to start your journey.
What is this tutorial not?
This tutorial should not be confused with a full-fledged programmer reference. I want to keep the barriers low and not overwhelm readers with all the peculiarities and nuances that are not essential to start coding with XProc 3.0. Speaking of the version number, the tutorial does not touch the not so subtle differences to prior versions. People who used XProc before will notice the changes anyways.
Lessons
- Fundamentals
- XPath in XProc
- Advanced Concepts
- Frequently Used Steps
- Further Reading