epub:create-ops create-ops

epubtools/modules/create-ops/xpl/create-ops.xpl

Import URI: http://transpect.le-tex.de/epubtools/modules/create-ops/xpl/create-ops.xpl

Input Ports

NameDocumentationConnections

source

conf

/hierarchy – may be included in /epub-config

meta

/epub-config

Output Ports

NameDocumentationConnections

result

files

report

Options

NameDocumentationDefault

base-uri

target

'EPUB2'

css-filename

'stylesheet.css'

use-svg

'yes'

terminate-on-error

'yes'

debug

'no'

debug-dir-uri

'debug'

Subpipeline

Hashed file names are patched into the HTML before split

StepInputsOutputsOptions

p:group copy-resources

p:variable targetdir

source on create-ops

replace($base-uri, '^(.*[/])+(.*)', '$1')

p:variable css-handling

meta on create-ops

(/epub-config/@css-handling, 'regenerated-per-split')[1]

letex:store-debug d83e72

source

conf on create-ops

result

pipeline-step = 'epubtools/hierarchy'

active = $debug

base-uri = $debug-dir-uri

p:choose image-info

/epub-config/cover/@href

p:add-attribute resolve-href

If it is a relative URI, resolve it wrt the HTML source.

source

meta on create-ops

result

attribute-name = 'href'

match = '/epub-config/cover'

attribute-value = resolve-uri($href, base-uri())

letex:image-identify ii

source

result on resolve-href

result

href = /epub-config/cover/@href

p:sink sink1

source

result on ii

p:otherwise

p:identity i

source

 <c:error>No /epub-config/cover/@href given</c:error>      

result

p:sink sink1-5

source

result on i

letex:store-debug d83e161

source

result

pipeline-step = 'epubtools/create-ops/cover-image-info'

active = $debug

base-uri = $debug-dir-uri

p:sink sink2

source

result on d83e161

letex:store-debug d83e170

source

meta-with-uri-resolved-cover-href on image-info

result

pipeline-step = 'epubtools/epub-config'

active = $debug

base-uri = $debug-dir-uri

p:sink sink2a

source

result on d83e170

p:xslt attach-cover

If there is not yet a div with an id 'epub-cover-image-container', it will be inserted into the body as a first child.

source

source on create-ops

meta-with-uri-resolved-cover-href on image-info

report on image-info

stylesheet

p:document../xsl/attach-cover.xsl

result

letex:store-debug d83e212

source

result on attach-cover

result

pipeline-step = 'epubtools/create-ops/cover-attached'

active = $debug

base-uri = $debug-dir-uri

css:parse css-parse0

source

result on d83e212

stylesheet

This stylesheet overwrites certain css:expand templates or variables. This is done because CSS3 isn't supported completely.

In that stylesheet text-decoration and other porperties can be changed to supported values. When CSS3 is supported it might be necessary to use this input port dynamically.

p:documenthttp://transpect.le-tex.de/css-expand/xsl/css2-1-parser.xsl

result

debug = $debug

debug-dir-uri = $debug-dir-uri

p:add-attribute css-parse1

source

result on css-parse0

result

match = '/*'

attribute-name = 'xml:base'

attribute-value = concat( $targetdir, 'epub/OEBPS/styles/', $css-filename)

p:viewport resolve-resource-uris

p:sink sink3

source

p:xslt strip-style-element

Remove style elements as their content has been parsed and will be re-serialized into the new stylesheet.css. Any links to CSS files are stripped as their content has also been parsed.

As a collateral, also strips @srcpath

source

result on attach-cover

stylesheet

p:document../xsl/strip-style-element.xsl

parameters

p:empty

result

letex:store-debug d83e296

source

result on strip-style-element

result

pipeline-step = 'epubtools/create-ops/strip-style'

extension = 'html'

active = $debug

base-uri = $debug-dir-uri

p:sink sink4

source

result on d83e296

p:xslt generate-filelist

source

result on strip-style-element

result on resolve-resource-uris

stylesheet

p:document../xsl/extract-filerefs.xsl

result

letex:store-debug d83e327

source

result on generate-filelist

result

pipeline-step = 'epubtools/create-ops/filelist'

active = $debug

base-uri = $debug-dir-uri

p:sink d83e334

source

result on d83e327

p:xslt css-parse

source

result on resolve-resource-uris

result on generate-filelist

parameters

p:empty

stylesheet

p:document../xsl/add-local-resource-paths-to-css.xsl

result

letex:store-debug d83e354

source

result on css-parse

result

pipeline-step = 'epubtools/create-ops/parse-css'

active = $debug

base-uri = $debug-dir-uri

p:sink d83e361

source

result on d83e354

p:viewport file-iteration

result on generate-filelist

p:variable uri

(/c:file/@href, /c:file/@oebps-name)[1]

p:choose http-or-file

matches($uri, 'https?:')

p:add-attribute d83e399

source

 <c:request method="GET"/>

result

match = '/c:request'

attribute-name = 'href'

attribute-value = $uri

p:try http-request

p:group d83e414

p:http-request d83e418

source

result on d83e399

result

letex:store-debug d83e420

source

result on d83e418

result

pipeline-step = concat('epubtools/create-ops/http-requests/', c:file/@name)

active = $debug

base-uri = $debug-dir-uri

p:catch catch

error

p:identity d83e437

source

error on catch

result

p:sink sink5

source

p:add-attribute d83e450

source

current on file-iteration

result

attribute-name = 'query-hash'

match = '/*'

attribute-value = ''

p:hash hashing

source

result on d83e450

parameters

p:empty

result

algorithm = 'crc'

match = '@query-hash'

value = /*/@query-string

p:sink sink6

source

result on hashing

p:xslt apply-hash

source

result on hashing

result on http-request

parameters

p:empty

stylesheet

p:document../xsl/apply-hash.xsl

result

letex:store-debug d83e488

source

result on apply-hash

result

pipeline-step = concat('epubtools/create-ops/files/', c:file/@name)

active = $debug

base-uri = $debug-dir-uri

p:store store-http-resource

source

result on http-request

result

href = c:file/@target-filename

letex:store-debug d83e514

source

result on apply-hash

result

pipeline-step = concat('epubtools/create-ops/filelist-after-patch/', c:file/@name)

active = $debug

base-uri = $debug-dir-uri

p:sink d83e531

source

result on d83e514

p:otherwise

p:try try-copy

p:group d83e543

cxf:info file-exists

result

href = c:file/@local-href

p:for-each copy

result on file-exists

cxf:copy cp

result

fail-on-error = if ($terminate-on-error = 'yes') then 'true' else 'false'

target = c:file/@target-filename

href = c:file/@local-href

p:catch catch

error

letex:store-debug d83e589

source

error on catch

result

pipeline-step = 'epubtools/create-ops/copy-error'

active = $debug

base-uri = $debug-dir-uri

p:store dummy

source
<dummy>1</dummy>

result

method = 'text'

href = c:file/@target-filename

p:add-attribute is-text-file

source

current on file-iteration

result

attribute-name = 'media-type'

attribute-value = 'text/plain'

match = '/c:file'

p:add-attribute is-error

source

result on is-text-file

result

match = '/*'

attribute-name = 'error'

attribute-value = 'File not found (or copying failed for another reason)'

p:sink sink6-5

source

p:sink sink7

source

p:validate-with-relax-ng validate-metadata-conf

source

meta-with-uri-resolved-cover-href on copy-resources

schema

p:documenthttp://transpect.le-tex.de/epubtools/schema/metadata-conf/metadata-conf.rng

result

assert-valid = if ($terminate-on-error = 'yes') then 'true' else 'false'

letex:store-debug d83e648

source

result on validate-metadata-conf

result

pipeline-step = 'epubtools/create-ops/validate-metadata-conf'

extension = 'xml'

active = $debug

base-uri = $debug-dir-uri

p:sink sink-valhierarchy

source

result on d83e648

p:xslt patch-http-hrefs

source

html on copy-resources

result on copy-resources

parameters

p:empty

stylesheet

p:document../xsl/patch-http-hrefs.xsl

result

letex:store-debug d83e677

source

result on patch-http-hrefs

result

pipeline-step = 'epubtools/create-ops/pre-split'

extension = 'html'

active = $debug

base-uri = $debug-dir-uri

epub:html-splitter html-splitter

source

result on d83e677

conf

conf on create-ops

meta

meta-with-uri-resolved-cover-href on copy-resources

css-xml

css-xml on copy-resources

result

base-uri = $base-uri

target = $target

debug = $debug

debug-dir-uri = $debug-dir-uri

p:wrap-sequence wrap-file-uris

source

result on copy-resources

files on html-splitter

result

wrapper = 'cx:document'

letex:store-debug d83e718

source

result on wrap-file-uris

result

pipeline-step = 'epubtools/create-ops/wrap-file-uris'

active = $debug

base-uri = $debug-dir-uri

p:sink sink10

source

result on d83e718

letex:store-debug d83e725

source

result on html-splitter

result

pipeline-step = 'epubtools/create-ops/wrap-files'

active = $debug

base-uri = $debug-dir-uri

p:sink d83e736

source

result on d83e725

Used by