docx2hub:single-tree docx-single-tree
docx2hub/xpl/single-tree.xpl
Import URI: single-tree.xpl
Input Ports
Name | Documentation | Connections |
---|---|---|
sourceⓅ | This is to prevent any other default readable port to be connected with the xslt port. | |
xslt |
|
Output Ports
Name | Documentation | Connections |
---|---|---|
resultⓅ | ||
params | ||
zip-manifest |
Options
Name | Documentation | Default |
---|---|---|
docxⓇ | OS name (preferably with full path, may not resolve if only a relative path is given), file:, http:, or https: URL. The file will be fetched first if it is an HTTP URL. | |
debug | 'no' | |
debug-dir-uri | 'file:/tmp/debug' | |
srcpaths | 'no' | |
unwrap-tooltip-links | 'no' | |
hub-version | '1.2' | |
fail-on-error | 'no' | |
field-vars | 'no' | |
extract-dir | Directory (OS path, not file: URL) to which the file will be unzipped. If option is empty string, will be '.tmp' appended to OS file path. | '' |
no-srcpaths-for-text-runs-threshold | In order to speed up conversion for long documents, if more w:r elements are found, they won’t receive a srcpath of their own. In principle, srcpath generation may be sped up by computing them more efficiently, building on a tunnelled parameter that contains the parent element’s already-computed srcpath. | '40000' |
Subpipeline
Step | Inputs | Outputs | Options | ||
---|---|---|---|---|---|
p:variable basename | replace($docx, '^(.+?)([^/\\]+)\.do[ct][mx]$', '$2') | ||||
tr:file-uri locate-docx |
| result | filename = $docx | ||
tr:unzip unzip | result | zip = /c:result/@os-path dest-dir = if ($extract-dir = '') then concat(/c:result/@os-path, '.tmp') else $extract-dir overwrite = 'yes' | |||
p:choose d70e71 | |||||
name(/*) eq 'c:error' | |||||
cx:message d70e75 | result | message = 'docx2hub error on unzipping. ', //text(), ' ' | |||
p:otherwise | |||||
p:identity d70e83 | result | ||||
p:load document | result | href = concat( /c:files/@xml:base, (/c:files/c:file/@name[matches(., '^word/document\d?.xml$')])[1] ) | |||
p:sink d70e90 | |||||
p:xslt zip-manifest |
| result | |||
p:sink d70e127 |
| ||||
p:add-attribute error-msg-file-path |
| result | attribute-name = 'value' match = '/c:param' attribute-value = replace(static-base-uri(), '/[^/]+$', '') | ||
p:add-attribute local-href |
| result | attribute-name = 'value' match = '/c:param' attribute-value = /c:result/@local-href | ||
p:add-attribute extract-dir-uri |
| result | attribute-name = 'value' match = '/c:param' attribute-value = /c:files/@xml:base | ||
p:in-scope-names vars | |||||
p:insert params |
| result | position = 'last-child' | ||
tr:store-debug d70e182 | result | pipeline-step = concat('docx2hub/', $basename, '/00-params') active = $debug base-uri = $debug-dir-uri | |||
p:sink d70e190 | |||||
tr:xslt-mode d70e191 | result | msg = 'yes' mode = 'insert-xpath' prefix = concat('docx2hub/', $basename, '/01') debug = $debug debug-dir-uri = $debug-dir-uri | |||
p:choose apply-changemarkup | |||||
exists(//w:del | //w:moveFrom | //w:ins) | |||||
tr:xslt-mode d70e233 |
| result | msg = 'yes' mode = 'docx2hub:apply-changemarkup' prefix = concat('docx2hub/', $basename, '/02') debug = $debug debug-dir-uri = $debug-dir-uri | ||
p:otherwise | |||||
p:identity d70e263 | result | ||||
p:add-attribute d70e266 |
| result | attribute-name = 'xml:base' match = '/*' attribute-value = /c:files/@xml:base |