Step css-cascade {http://www.daisy.org/ns/pipeline/xproc}

Cascade and inline CSS and SCSS style sheets in XML.

Inlining is done with style attributes with the syntax described in braille CSS.

Defined in: http://www.daisy.org/pipeline/modules/css-utils/library.xpl

Input Ports

Port Description
source primary
source.in-memory sequence

The input fileset containing content and style files, if a d:fileset document is received on the source port. Otherwise, the document that is received on the source port is interpreted as the only content document, and the source.in-memory port is checked for style files.

Style sheets can be associated with the source in several ways: linked (using an xml-stylesheet processing instruction or a link element), embedded (using a style element) and/or inlined (using style attributes).

Style sheets that are linked to from the source document, or included via the 'user-stylesheet' option, must either exist on disk, or must be part of the source fileset.

parameters parameter

Parameters that are passed to SCSS style sheets (as global variables). They are also passed to XSLT transformations that are included from CSS through @xslt rules.

Output Ports

Port Description
result primary
result.in-memory sequence

The output fileset, if a d:fileset document was received on the source port. Otherwise, the result port holds the only output content document, and the result.in-memory port is empty.

All styles are parsed, validated, normalized, cascaded and finally serialized into style attributes.

Shorthand declarations such as margin: a b c d are decomposed as margin-top: a; margin-right: b; margin-bottom: c; margin-left: d.

'before' and 'after' rules are serialized as &::before { ... } and &::after { ... }.

'page' properties are replaced with the corresponding named 'page' rules (without the page type selector). If the root element does not have a 'page' property, the default page rule is inserted. 'page' rules are serialized as @page { ... } @page:left { ... } @page:right { ... }. The declarations that named page rules inherit from the default page rule are made explicit. The declarations that 'left' and 'right' page rules inherit from their principal page rule are also made explicit.

'volume' rules are serialized as @volume { ... } @volume:first { ... } @volume:last { ... } @volume:nth(...) { ... } @volume:nth-last(...) { ... } and inserted for the root element. The declarations that '@volume:first' etc. inherit from the principal volume rule are made explicit. ':nth(1)' and ':nth-last(1)' are normalized to ':first' and ':last'. A special '@volume:only' rule, which is a combination of the '@volume:first' and '@volume:last' rules, is created for the case that there is only a single volume.

result.parameters

A c:param-set document containing all the parameters specified on the parameters input port and parameters option, augmented with any global variables declared in SCSS style sheets. Variables that are declared later take precedence, except if they are declared with !default.

Options

Local Name Namespace URI Default Description
parameters map{}

This option may contain additional style sheet parameters, either as a map item, or in serialized form (Sass map). The parameters specified through this option and the ones specified through the "parameters" port are merged.

content-type 'text/html application/xhtml+xml application/x-dtbook+xml'

The type of document to be processed. Other input documents will be left unchanged.

Ignored if the source port holds a document that is not a d:fileset.

user-stylesheet ''

Space separated list of URIs, absolute or relative to source. Applied prior to all style sheets defined within the source, but after any user agent style sheets.

include-user-agent-stylesheet false()

Whether or not to include style sheets defined by the user agent for the given content document type (content-type option) and output medium (media option).

type 'text/css text/x-scss'

The type of associated style sheets to apply. May be a space separated list. Allowed values are "text/css" and "text/x-scss". If omitted, all CSS and SCSS style sheets are applied.

media 'embossed'

The target medium type as a media query. All rules that are contained in a style sheet that matches the specified medium are included. Supported media types are "embossed", "speech" and "print". When the target medium is "embossed", CSS is interpreted according to the rules of braille CSS. Supported media features are 'width' and 'height' In addition, '(counter-support: none)' can be used to transform lists to preformatted lists.

attribute-name 'style'

Name of attribute to use for inlined styles. Default name is 'style'.

multiple-attributes false()

Cascade the styles into multiple attributes per element. In this case the namespace and prefix of attribute-name are used for the attributes, the local part is ignored.