cascade

Libraries to implement a transpect cascade configuration

Repository
Git URL https://github.com/transpect/cascade.git
SVN URL https://github.com/transpect/cascade
Base URI http://transpect.io/cascade/

Source ⬇

tr:clades-from-filename-stdout

This step provides the clades of one filename as separated tokens.

Import

<p:import href="http://transpect.io/cascade/xpl/clades-from-filename-stdout.xpl"/>

Dependencies

Synopsis

<tr:clades-from-filename-stdout xmlns:tr="http://transpect.io">
  <p:input port="conf"/>
  <p:output port="result" sequence="true"/>
  <p:option name="filename"/>
  <p:option name="separator" select="'
'"/>
  <p:option name="get-full-path" select="'no'"/>
  <p:option name="order" select="'ascending'"/>
  <p:option name="exclude-filter" select="''"/>
  <p:option name="debug" select="'yes'"/>
  <p:option name="debug-dir-uri" select="'debug'"/>
  <p:option name="status-dir-uri" select="'status'"/>
</tr:clades-from-filename-stdout>

tr:directory-loop

The step performs a recursive directory listing and looks for parameter documents named 'params.xml'. The parameter documents are included in the XML directory listing.

Import

<p:import href="http://transpect.io/cascade/xpl/directory-loop.xpl"/>

Dependencies

Synopsis

<tr:directory-loop xmlns:tr="http://transpect.io">
  <p:output port="result"/>
  <p:option name="depth" select="-1"/>
  <p:option name="path" required="true"/>
  <p:option name="exclude-filter"/>
</tr:directory-loop>

tr:identity-fallback

Import

<p:import href="http://transpect.io/cascade/xpl/dynamic-transformation-identity-fallback.xpl"/>

Synopsis

<tr:identity-fallback xmlns:tr="http://transpect.io">
  <p:input port="source" primary="true"/>
  <p:input port="stylesheet"/>
  <p:input port="meta"/>
  <p:input port="parameters" primary="true"/>
  <p:output port="result" primary="true"/>
  <p:option name="debug" required="false" select="'no'"/>
  <p:option name="debug-dir-uri"/>
</tr:identity-fallback>

tr:dynamic-transformation-pipeline

This encapsulates the dynamic loading of an XSLT stylesheet and an XPL pipeline and execution of the pipeline. Dynamic loading means that the most specific (specificity tr: work, series, publisher, common) XSL and XPL files will be loaded. The pipeline usually consists of transformations with the same dynamically loaded stylesheet in different modes, according to the dynamically loaded pipeline (that consists of tr:xslt-mode steps). The pipeline may have multiple documents on the source and result ports. The transformation will be applied to each document in turn.

Additional input files that will be passed to each transformation may be sent to the additional-input port. They must be wrapped in cx:document with the appropriate port name of the dynamically executed pipeline. Even if you don’t have additional inputs, make sure to always include the additional-inputs port when invoking tr:dynamic-transformation-pipeline. Connect it to p:empty by default. Please note the difference between a sequence of source documents (will be transformed one by one) and a sequence of additional files (will be available to the dynamically loaded pipeline and will typically be used as additional input documents for some of the tr:xslt-mode steps therein, thus making it available via the default collection in each transformation).

There is a limitation that additional inputs are limited to single documents per port. If you have a sequence, you’ll have to wrap it into a custom element before wrapping it in the cx:document.

There is also an options port. You may submit options in a cx:options document with cx:option entries (with name and value attributes). These options will be merged with the debug and debug-dir-uri options and passed on to the dynamically loaded pipeline. Before preparing a cx:options document, check whether the options can be read in the dynamically invoked pipeline from the primary parameter port.

Import

<p:import href="http://transpect.io/cascade/xpl/dynamic-transformation-pipeline.xpl"/>

Dependencies

Synopsis

<tr:dynamic-transformation-pipeline xmlns:tr="http://transpect.io">
  <p:input port="source" sequence="true" primary="true"/>
  <p:input port="additional-inputs" sequence="true" primary="false"/>
  <p:input port="options" sequence="true"/>
  <p:input port="paths" primary="true"/>
  <p:output port="report" sequence="true"/>
  <p:output port="result" sequence="true" primary="true"/>
  <p:option name="load"/>
  <p:option name="fallback-xsl" required="false" select="'http://transpect.io/cascade/xsl/dynamic-transformation-identity-fallback.xsl'"/>
  <p:option name="fallback-xpl" required="false" select="''"/>
  <p:option name="debug" required="false" select="'no'"/>
  <p:option name="debug-dir-uri" required="false" select="'debug'"/>
</tr:dynamic-transformation-pipeline>

tr:get-clades-from-dirs

This step converts a transpect clades document from the output of tr:directory-loop. The clades document can be used as input for the tr:paths step.

Parameter sets can be stored as params.xml in the corresponding directory. There are predefined parameters which are used to control how the clades are generated.

<c:param-set xmlns:c="http://www.w3.org/ns/xproc-step">
<c:param name="exclude-filter" value="'(xsl|xpl|schematron)'"/><-- exclude directories from cascade -->
<c:param name="clade-role" value="global"/><-- assign a specific clade role to the directory -->
</c:param-set>

Import

<p:import href="http://transpect.io/cascade/xpl/get-clades-from-dirs.xpl"/>

Dependencies

Synopsis

<tr:get-clades-from-dirs xmlns:tr="http://transpect.io">
  <p:input port="params"/>
  <p:output port="result" primary="true"/>
  <p:output port="directory-param-sets" primary="false"/>
  <p:option name="resolve-params" select="'yes'"/>
  <p:option name="debug" select="'yes'"/>
  <p:option name="debug-dir-uri" select="'debug'"/>
  <p:option name="status-dir-uri" select="concat($debug-dir-uri, '/status')"/>
</tr:get-clades-from-dirs>

tr:load-cascaded

Loads the most specific XML file $filename from a sequence of paths, supplied as parameters on the paths port ($s9y1-path, $s9y2-path, …, in descending specificity). The XML file can be an XProc pipeline, an XSLT stylesheet, a Schematron schema, an XHTML file, whatever. If no document named {$filename} is found at a given path, it checks whether {$filename}.xsl exists. If it exist, the main template of this XSL is invoked and this should return the document that was originally expected at {$filename}. If neither a proper {$filename} nor {$filename}.xsl can be found under any of the paths, and if a non-empty option $fallback is specified, the fallback file will be used.

Import

<p:import href="http://transpect.io/cascade/xpl/load-cascaded.xpl"/>

Dependencies

Synopsis

<tr:load-cascaded xmlns:tr="http://transpect.io">
  <p:input port="paths" primary="true"/>
  <p:input port="source" sequence="true" primary="true"/>
  <p:input port="catalog" sequence="true"/>
  <p:output port="result" primary="true"/>
  <p:option name="filename" required="true"/>
  <p:option name="required" required="false" select="'yes'"/>
  <p:option name="fallback" required="false" select="''"/>
  <p:option name="set-xml-base-attribute" required="false" select="'yes'"/>
  <p:option name="debug" required="false" select="'no'"/>
  <p:option name="debug-dir-uri"/>
</tr:load-cascaded>

tr:load-cascaded-binary

Import

<p:import href="http://transpect.io/cascade/xpl/load-cascaded.xpl"/>

Dependencies

Synopsis

<tr:load-cascaded-binary xmlns:tr="http://transpect.io">
  <p:input port="paths" primary="true"/>
  <p:output port="result" primary="true"/>
  <p:option name="filename" required="true"/>
  <p:option name="required" required="false" select="'yes'"/>
  <p:option name="fallback" required="false" select="''"/>
  <p:option name="result-with-file-prefix" required="false" select="'no'"/>
  <p:option name="debug" required="false" select="'no'"/>
  <p:option name="debug-dir-uri"/>
</tr:load-cascaded-binary>

tr:load-whole-cascade

Loads all documents of a specific name from the path cascade. With the default order of 'least-specific-first', the most generic document will be first, the most specific last. The option 'order' may be set to 'most-specific-first'.

Import

<p:import href="http://transpect.io/cascade/xpl/load-cascaded.xpl"/>

Synopsis

<tr:load-whole-cascade xmlns:tr="http://transpect.io">
  <p:input port="paths" primary="true"/>
  <p:output port="result" sequence="true" primary="true"/>
  <p:option name="filename" required="true"/>
  <p:option name="order" select="'least-specific-first'"/>
</tr:load-whole-cascade>

tr:paths-for-files-xml

An implementation of paths-for-files which provides XML output

Import

<p:import href="http://transpect.io/cascade/xpl/paths-for-files-xml.xpl"/>

Dependencies

Synopsis

<tr:paths-for-files-xml xmlns:tr="http://transpect.io">
  <p:input port="conf"/>
  <p:output port="result"/>
  <p:option name="filenames"/>
</tr:paths-for-files-xml>

tr:paths-for-files

Will calculate the content repository locations for a space separated sequence of flat filenames. The filenames must adhere to the naming conventions, e.g., 101026_04711_RAT.idml or 101027_00123_ADHOC_fig_2-3.pdf.

Import

<p:import href="http://transpect.io/cascade/xpl/paths-for-files.xpl"/>

Dependencies

Synopsis

<tr:paths-for-files xmlns:tr="http://transpect.io">
  <p:input port="conf" primary="true"/>
  <p:output port="result" primary="true"/>
  <p:option name="filenames" required="true"/>
  <p:option name="clades" select="''"/>
  <p:option name="debug" required="false" select="'no'"/>
  <p:option name="debug-dir-uri" required="false" select="resolve-uri('debug')"/>
  <p:option name="status-dir-uri" required="false" select="'status?enabled=false'"/>
  <p:option name="fail-on-error" select="'false'"/>
</tr:paths-for-files>

tr:paths

This step provides the transpect cascade paths document for a given filename. The filename is passed with the file option.

The step takes two inputs. First, the step expects a transpect clades configuration. Clades are a hierarchical structure of configuration layers. These layers are typically represented as directories on the filesystem, where transpect steps search for overrides. Second, the step takes an XSLT stylesheet. The stylesheet imports the paths.xsl and is used to override some of its functions, especially for detecting clades based upon file names or other strings.

A RelaxNG schema for the clades configuration is here: ../schema/cascade.rng.

Import

<p:import href="http://transpect.io/cascade/xpl/paths.xpl"/>

Dependencies

Synopsis

<tr:paths xmlns:tr="http://transpect.io">
  <p:input port="conf"/>
  <p:input port="stylesheet" primary="true"/>
  <p:input port="params" sequence="true"/>
  <p:output port="result" primary="true"/>
  <p:output port="report" sequence="true" primary="false"/>
  <p:option name="debug" select="'no'"/>
  <p:option name="debug-dir-uri" select="'debug'"/>
  <p:option name="status-dir-uri" select="'status?enabled=false'"/>
  <p:option name="interface-language" select="'en'"/>
  <p:option name="clades" select="''"/>
  <p:option name="file" required="true"/>
  <p:option name="pipeline" select="'unknown'"/>
  <p:option name="progress" select="'no'"/>
  <p:option name="progress-to-stdout" required="false" select="'no'"/>
  <p:option name="determine-transpect-project-version" required="false" select="'no'"/>
</tr:paths>

GitHub sync date: 2024-04-23+02:00