Search manual:

- Main page
- Introduction
- Hello, world!
- Basics
  - How to write the layout
  - Structure of the data file and the layout rules
  - Outputting objects
  - Grid
  - Areas on the page (PositioningArea)
  - File organization
  - Hyphenation / language settings
  - Using fonts
  - Text formats
  - Text formatting
  - Colors
- Programming
- Image inclusion
- Tables
- Advanced topics
  - Bookmarks
  - Creation of XML structures
  - Print output / crop marks
  - Using CSS with the speedata Publisher
  - Groups (virtual objects)
  - Virtual pages
  - Rotation of contents
  - Sorting data
  - Wrap around images
  - Page types
  - Starting the Publisher via the Hotfolder
  - Lua-Filter / pre-processing
  - Schema validation
  - Quality assurance and PDF comparison
  - Troubleshooting / Debugging
  - Server mode (REST API)
  - Control of the layout when calling the Publisher
  - Create and use images with MetaPost
- Cookbook
  - Thumb index
  - Embed multipage PDF files
  - Layout optimization using groups
  - Imitate bulleted lists
  - Automatically generated directories
  - Create table of contents in one go
  - Page numbers: Page x of y
- Installation instructions
- File name in the Publisher
- speedata Publisher defaults
- Running the speedata publisher on the command line
- How to configure the speedata publisher
- Lenghts and units
- XPath- and Layoutfunctions
- Internal variables
- Associate XML editor with schema
  - Visual Studio Code
  - OxygenXML
- Changelog
- Glossary
- Compatibility with other software
- Command reference
  - Attribute index
  - A
  - Action
  - AddSearchpath
  - AtPageCreation
  - AtPageShipout
  - AttachFile
  - Attribute
  - B
  - Barcode
  - Bold
  - BoldItalic
  - Bookmark
  - Box
  - Br
  - Case
  - Circle
  - ClearPage
  - Clip
  - Color
  - Column
  - Columns
  - Compatibility
  - Contents
  - Copy-of
  - DefineColor
  - DefineColorprofile
  - DefineFontalias
  - DefineFontfamily
  - DefineGraphic
  - DefineMatter
  - DefineTextformat
  - Element
  - Fallback
  - Fontface
  - ForAll
  - Frame
  - Grid
  - Group
  - Groupcontents
  - HSpace
  - Hyphenation
  - I
  - Image
  - Include
  - Initial
  - InsertPages
  - Italic
  - Layout
  - Li
  - LoadDataset
  - LoadFontfile
  - Loop
  - Makeindex
  - Margin
  - Mark
  - Message
  - NewPage
  - NextFrame
  - NextRow
  - NoBreak
  - Ol
  - Options
  - Otherwise
  - Output
  - Overlay
  - Pageformat
  - Pagetype
  - Paragraph
  - PDFOptions
  - PlaceObject
  - Position
  - PositioningArea
  - PositioningFrame
  - ProcessNode
  - Record
  - Regular
  - Rule
  - SaveDataset
  - SavePages
  - SetGrid
  - SetVariable
  - SortSequence
  - Stylesheet
  - Span
  - Sub
  - Sup
  - Switch
  - Table
  - TableNewPage
  - Tablefoot
  - Tablehead
  - Tablerule
  - Td
  - Text
  - Textblock
  - Tr
  - Trace
  - Transformation
  - U
  - Ul
  - Until
  - URL
  - Value
  - VSpace
  - While

Version 4.12.1
Search manual

- Main page
- Introduction
- Hello, world!
- Basics
  - How to write the layout
  - Structure of the data file and the layout rules
  - Outputting objects
  - Grid
  - Areas on the page (PositioningArea)
  - File organization
  - Hyphenation / language settings
  - Using fonts
  - Text formats
  - Text formatting
  - Colors
- Programming
- Image inclusion
- Tables
- Advanced topics
  - Bookmarks
  - Creation of XML structures
  - Print output / crop marks
  - Using CSS with the speedata Publisher
  - Groups (virtual objects)
  - Virtual pages
  - Rotation of contents
  - Sorting data
  - Wrap around images
  - Page types
  - Starting the Publisher via the Hotfolder
  - Lua-Filter / pre-processing
  - Schema validation
  - Quality assurance and PDF comparison
  - Troubleshooting / Debugging
  - Server mode (REST API)
  - Control of the layout when calling the Publisher
  - Create and use images with MetaPost
- Cookbook
  - Thumb index
  - Embed multipage PDF files
  - Layout optimization using groups
  - Imitate bulleted lists
  - Automatically generated directories
  - Create table of contents in one go
  - Page numbers: Page x of y
- Installation instructions
- File name in the Publisher
- speedata Publisher defaults
- Running the speedata publisher on the command line
- How to configure the speedata publisher
- Lenghts and units
- XPath- and Layoutfunctions
- Internal variables
- Associate XML editor with schema
  - Visual Studio Code
  - OxygenXML
- Changelog
- Glossary
- Compatibility with other software
- Command reference
  - Attribute index
  - A
  - Action
  - AddSearchpath
  - AtPageCreation
  - AtPageShipout
  - AttachFile
  - Attribute
  - B
  - Barcode
  - Bold
  - BoldItalic
  - Bookmark
  - Box
  - Br
  - Case
  - Circle
  - ClearPage
  - Clip
  - Color
  - Column
  - Columns
  - Compatibility
  - Contents
  - Copy-of
  - DefineColor
  - DefineColorprofile
  - DefineFontalias
  - DefineFontfamily
  - DefineGraphic
  - DefineMatter
  - DefineTextformat
  - Element
  - Fallback
  - Fontface
  - ForAll
  - Frame
  - Grid
  - Group
  - Groupcontents
  - HSpace
  - Hyphenation
  - I
  - Image
  - Include
  - Initial
  - InsertPages
  - Italic
  - Layout
  - Li
  - LoadDataset
  - LoadFontfile
  - Loop
  - Makeindex
  - Margin
  - Mark
  - Message
  - NewPage
  - NextFrame
  - NextRow
  - NoBreak
  - Ol
  - Options
  - Otherwise
  - Output
  - Overlay
  - Pageformat
  - Pagetype
  - Paragraph
  - PDFOptions
  - PlaceObject
  - Position
  - PositioningArea
  - PositioningFrame
  - ProcessNode
  - Record
  - Regular
  - Rule
  - SaveDataset
  - SavePages
  - SetGrid
  - SetVariable
  - SortSequence
  - Stylesheet
  - Span
  - Sub
  - Sup
  - Switch
  - Table
  - TableNewPage
  - Tablefoot
  - Tablehead
  - Tablerule
  - Td
  - Text
  - Textblock
  - Tr
  - Trace
  - Transformation
  - U
  - Ul
  - Until
  - URL
  - Value
  - VSpace
  - While

- Dieses Handbuch auf Deutsch

# Using CSS with the speedata Publisher

CSS (Cascading Stylesheets) is a language mainly used on the web to determine the appearance of objects. The idea is to separate formatting from content. On the web - so the pure teaching - the content is described in HTML, while the appearance is determined by CSS. With the speedata Publisher the separation is even clearer. The data usually contains no information about the appearance, while the layout rules have no information about the data.

The speedata Publisher relies exclusively on the built-in language when formatting the objects. Some elements can be designed using CSS. In the Publisher this is only rudimentary: Currently the commands `<Box>`, `<Circle>`, `<Frame>`, `<Paragraph>`, `<Rule>`, `<Td>`, `<Tablerule>` and `<U>` can be formatted via CSS. The Command Reference lists the commands with the associated attributes that can be accessed via CSS functionality.

| The CSS implementation in the speedata Publisher has more the character of a "proof of concept" or prototype. The commands and properties that can be controlled via CSS are very limited.

A CSS stylesheet can be available and integrated as an external file. Alternatively, one can write CSS instructions directly into the layout rules. `<Stylesheet>` is the command for both variants:

    <Layout xmlns="urn:speedata.de:2009/publisher/en"
      xmlns:sd="urn:speedata:2009/publisher/functions/en">

      <Stylesheet filename="style.css"/>

      <Record element="data">
        <PlaceObject>
          <Textblock>
            <Paragraph>
              <Value>Test</Value>
            </Paragraph>
          </Textblock>
        </PlaceObject>
      </Record>

    </Layout>

with the following CSS file:

    p {
    	color: red;
    }

results in the word "Test" in the PDF in the color red.

If the CSS statements are inserted directly, the syntax is as follows:

      <Stylesheet>
        p {
          color: red;
        }
      </Stylesheet>

### Selectors

As known from HTML, the CSS instructions are assigned to certain elements with so-called selectors.

    <Table>
      <Tr minheight="4">
        <Td class="myclass" id="myid">
          <Paragraph>
            <Value>Hallo Welt</Value>
          </Paragraph>
        </Td>
      </Tr>
    </Table>

The table cell in the example above could be accessed via the following selectors:

    #myid {
      vertical-align: top ;
    }

    .myclass {
      vertical-align: top ;
    }

and

    td {
      vertical-align: top ;
    }

The first case is via the 'id' attribute, which must be unique in the layout rules. The second case is addressed via the class `class="…​"`. The class can be the same for several elements in the layout set of rules. The third case refers to all elements 'Td' in the layout set of rules. Here the usual specificity rules for CSS apply, but `!important' is not supported.

## CSS and and elements in data

Text markup in the data works as follows:

    <p>Text, Text, Text <b>bold</b>, Text Text</p>

The Publisher will ensure that the text within the 'b' element appears in bold.

You can also add CSS styles to your own elements. For example, if you have the following data

    <data>hello <green>green</green> world</data>

you can use CSS to color the element:

    <Layout
      xmlns="urn:speedata.de:2009/publisher/en"
      xmlns:sd="urn:speedata:2009/publisher/functions/en">

      <Stylesheet>
        green {
          color: green;
        }
      </Stylesheet>

      <Record element="data">
        <PlaceObject>
          <Textblock>
            <Paragraph>
              <Value select="."/>
            </Paragraph>
          </Textblock>
        </PlaceObject>
      </Record>
    </Layout>

Elements in data can now be colored

Currently, only the attributes underline and color (`text-decoration: underline;` and `color: …​`) can be set via CSS.

- Print output / crop marks
- Groups (virtual objects)