Edit online

You can activate parts of your CSS by using custom transformation parameters that start with the args.css.param. prefix.

These parameters are recognized by the publishing pipeline and are forwarded as synthetic attributes on the root element of the merged map. The last part of the parameter name will become the attribute name, while the value of the parameter will be become the attribute value. The namespace of these synthetic attributes is: http://www.oxygenxml.com/extensions/publishing/dita/css/params.

Notes:
  • Use only Latin alphanumeric characters for parameter names.
  • You can set multiple styling parameters at the same time.

How to Limit the Depth of the TOC Using a Parameter

In the following example, a custom parameter is used to switch from a full depth table of contents to a flat one that shows only the titles of the first-level topics (such as chapters, preface, notices).

The custom parameter is:

args.css.param.only-chapters-in-toc="yes"
The CSS that hides the topicrefs at level 2 or more:
@namespace a "http://www.oxygenxml.com/extensions/publishing/dita/css/params"; 

:root[a|only-chapters-in-toc='yes'] *[class ~= "toc/toc"] 
         > *[class ~= "map/topicref"]> *[class ~= "map/topicref"] {
  display:none;
}
The selector :root[a|only-chapters-in-toc='yes'] makes the rule activate only when the attribute is set.

How to Change the Page Size Using a Parameter

In the next example, a custom parameter is used to modify the page size. The parameter is defined in the transformation scenario:
args.css.param.page-size="A4"

Then in the CSS, the attribute value is extracted and used:

@page {
    size: oxy_xpath('/*/@*[local-name()="page-size"]');
}