Previous Up Next

XML Pipelines

A Guide to XProc

Norman Walsh

Edited by

Richard Hamilton

29 Aug 2010

Table of Contents

I. Introduction
1. Introduction
1. What's a pipeline?
2. Why pipelines?
3. Processing Model
4. Streaming
5. Anatomy of a pipeline
6. Running XProc Pipelines
7. Interoperability
2. Pipeline Terminology
1. Primary ports
2. The default readable port
3. Errors and Exceptions
3. Steps and Connections
4. XPath Expressions and XProc Functions
1. p:system-property
2. p:step-available
3. p:value-available
4. p:iteration-position
5. p:iteration-size
6. p:base-uri
7. p:resolve-uri
8. p:version-available
9. p:xpath-version-available
5. Pipeline Inputs
1. p:input
2. p:pipe
3. p:inline
3.1. Excluding inline prefixes
4. p:document
5. p:data
6. p:empty
7. External documents, step outputs, and caching
6. Pipeline Outputs and Serialization
1. p:output
2. Serialization
2.1. p:serialization
7. Options, Variables, and Parameters
1. Options
1.1. p:option
1.2. p:with-option
2. Variables
2.1. p:variable
3. Parameters
3.1. Parameter Port Bindings
3.2. p:with-param
3.3. Order and precedence of parameters
3.4. Controlling in-scope namespaces
3.5. p:namespaces
8. Pipeline Libraries
1. p:library
2. p:import
9. Ancillary Information
1. p:documentation
2. p:pipeinfo
3. p:log
II. Reference
I. Standard XProc Compound Steps
p:choose - Selects one of a number of alternative pipelines
p:declare-step - Declares an XProc pipeline
p:for-each - Iterates over a sequence of documents
p:group - Groups a sequence of steps together
p:pipeline - Declares an XProc pipeline
p:try - Catches and provides recover from dynamic errors
p:viewport - Processes inner portions of a document
II. Standard XProc Steps
p:add-attribute - Adds a single attribute to the selected element (or elements)
p:add-xml-base - Adds explicit xml:base attributes
p:compare - Compares two documents for equality
p:count - Counts the number of documents that appear in a sequence
p:delete - Deletes matching nodes
p:directory-list - Lists the files, directories, and other contents of a directory on the filesystem
p:error - Causes an error
p:escape-markup - Escapes XML markup
p:exec - Runs an external command
p:filter - Filters documents with a dynamically constructed select expression
p:hash - Computes a cryptographic hash and inserts it into a document
p:http-request - Interact with other systems over HTTP
p:identity - Passes its input through unchanged
p:insert - Inserts content into a document
p:label-elements - Adds an attribute (often xml:id) to matching elements
p:load - Loads a document from a URI
p:make-absolute-uris - Resolves relative URIs to absolute URIs in the source document
p:namespace-rename - Changes the URI associated with a namespace binding
p:pack - Merges two document sequences
p:parameters - Converts step parameters into XML
p:rename - Renames elements, attributes, or processing instructions
p:replace - Replaces matching content
p:set-attributes - Sets a number of attributes at once
p:sink - Discards its input
p:split-sequence - Divides a sequence of documents into two sequences
p:store - Stores a document (usually on the filesystem)
p:string-replace - Replaces matched nodes with the result of evaluating an XPath expression
p:unescape-markup - Converts “escaped XML” back into real XML
p:unwrap - Removes an element, but not its content
p:uuid - Generates a UUID and inserts it into a document
p:validate-with-relax-ng - Validates a document using a RELAX NG grammar
p:validate-with-schematron - Validates a document using a Schematron schema
p:validate-with-xml-schema - Validates a document using W3C XML Schema
p:wrap-sequence - Places an element wrapper around a sequence of documents
p:wrap - Adds a wrapper around matching nodes
p:www-form-urldecode - Decodes URL encoded form data
p:www-form-urlencode - Encodes parameters into URL encoded form data
p:xinclude - Performs XInclude processing
p:xquery - Performs XQuery processing
p:xsl-formatter - Performs XSL FO processing
p:xslt - Performs XSLT processing
III. File Utilities
cxf:copy - Copies a file
cxf:delete - Deletes a file
cxf:head - Returns the first few lines of text file
cxf:info - Returns information about a file or directory
cxf:mkdir - Creates a directory
cxf:move - Moves (renames) a file or directory
cxf:tail - Returns the last few lines of a text file
cxf:tempfile - Creates a temporary file
cxf:touch - Update the modification time of a file
IV. Operating System Utilities
cxo:info - Returns information about the operating system
cxo:cwd - Returns the current working directory of the processor
cxo:env - Returns information about the environment
V. General Utilities
ex:recursive-directory-list - Performs p:directory-list recursively
III. Extending XML Calabash
A. Introduction to XML Calabash
B. Writing XML Calabash Extension Steps

List of Figures

2.1. A step
2.2. A pipeline

List of Examples

7.1. A simple pipeline with options
7.2. Explicit parameter pipeline
7.3. Fully explicit parameter pipeline
7.4. Multiple parameter inputs