XML Professional Publisher: Styling Content with CSS

for use with XPP 9.2 June 2018 Notice © SDL Group 1999, 2003-2005, 2009, 2012-2018. All rights reserved. Printed in U.S.A. SDL Group has prepared this document for use by its personnel, licensees, and customers. The information contained herein is the property of SDL and shall not, in whole or in part, be reproduced, translated, or converted to any electronic or machine-readable form without prior written approval from SDL. Printed copies are also covered by this notice and subject to any applicable confidentiality agreements. The information contained in this document does not constitute a warranty of performance. Further, SDL reserves the right to revise this document and to make changes from time to time in the content thereof. SDL assumes no liability for losses incurred as a result of out-of-date or incorrect information contained in this document. Trademark Notice See the Trademark file at http://docs.sdl.com for trademark information. U.S. Government Restricted Rights Legend Use, duplication or disclosure by the government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013 or other similar regulations of other governmental agencies, which designate software and documentation as proprietary. Contractor or manufacturer is SDL Group, 201 Edgewater Drive, Wakefield, MA 01880-6216.

ii Contents

Chapter 1 CSS Styling in XPP

Styling and Composition ...... 1-2 Styling ...... 1-2 Composition and Pagination ...... 1-2

Tag Processing ...... 1-5

Chapter 2 Creating CSS Styles

Invoking CSS-XML Mode ...... 2-2 Specifying a text editor for existing CSS and XyPerl files ..... 2-3 Specifying XPP style libraries used for XyPerl and ...... 2-3 Specifying a style bundle ...... 2-4 Including external CSS style sheets ...... 2-4 Creating a CSS style sheet ...... 2-4 Creating a XyPerl script ...... 2-5

Chapter 3 CSS Fundamentals

CSS Style Sheets ...... 3-2

CSS Tag Selectors ...... 3-4

CSS3 attr() function ...... 3-8 Attr() Function Type or Unit Keywords ...... 3-9 Unsupported Properties ...... 3-10

Styling Content with CSS Contents iii Using the CSS3 Attr() Function ...... 3-10

Style Inheritance and the Cascade ...... 3-12 The Cascade Effect ...... 3-14 XPP End Tag Restore ...... 3-14

XPP-Supported CSS Properties ...... 3-15

Chapter 4 Practical CSS

Generated Text and Pseudo-Elements ...... 4-2 Syntax ...... 4-2 Structural Pseudo-Classes ...... 4-5 Counters ...... 4-7

Accessing Perl ...... 4-8 Perl in CSS Selectors ...... 4-8 Perl Examples ...... 4-10 XyMacros in CSS ...... 4-11 XyPerl in Processing Instructions ...... 4-12 Chaining XyPerl Functions ...... 4-14

CSS Lists ...... 4-16 Simple Lists ...... 4-16 User-Defined Lists ...... 4-16 Formatting Lists ...... 4-17 Simple List Examples ...... 4-17 User-Styled List Examples ...... 4-22

HTML5 Tables ...... 4-27 Overview ...... 4-27 Tabular Attributes ...... 4-28 Using HTML5 Tables and CALS Tables in the Same Division . 4-29

CALS Table Styling in CSS ...... 4-31

CSS Fonts ...... 4-32 Font Workflow ...... 4-33 Creating a FAST ...... 4-34 Font Selection ...... 4-34 Importing Font Information for Use with CSS ...... 4-35 Changing CSS Fonts by Using XyMacros ...... 4-36

CSS Cross-referencing ...... 4-38 Marking an Element for Cross-referencing ...... 4-38 Inserting a Reference to a Marked Element ...... 4-38

iv Contents Styling Content with CSS Chapter 5 CSS Paged Media

Styling Paged Media in XPP ...... 5-2 XPP Page Sequence Selection ...... 5-2 XPP Page Layout ...... 5-5 XPP-specific CSS Properties in @page Rules ...... 5-9 Unsupported CSS3 Generated Content Features ...... 5-19 The XPP css2pagespecs.pl Utility ...... 5-19 CSS @page Rules Mapping to XPP Page Sequence Tables ..... 5-20

XML and CSS Examples ...... 5-22 Example 1: Main Content and Table of Contents ...... 5-22 Example 2: Rotated Page ...... 5-24

Chapter 6 Exporting and Archiving

Exporting an XPP Division in CSS-XML Mode ...... 6-2

Archiving and Restoring CSS and XyPerl Styles ...... 6-4

Appendix A Styling Modes

Comparing XML Mode to CSS-XML Mode ...... A-2

Appendix B Unicode Character Set

Unicode Characters ...... B-2

Appendix C Unsupported CSS Properties

Unsupported CSS Properties ...... C-2

Appendix D Tabular Styles and CSS

CALS table formatting ...... D-2

Styling Content with CSS Contents v Tables

3-1 CSS Selector Rules ...... 3-4 3-2 CSS Tag Selector Examples ...... 3-5 3-3 Units of Measurement ...... 3-15 3-4 XPP-Supported CSS Properties ...... 3-16

4-1 CSS Font Property and Variant Names and Their Allowable Values ...... 4-35

5-1 CSS 3-defined Page Sizes ...... 5-6 5-2 CSS Page-margin Boxes ...... 5-7 5-3 XPP-specific CSS Properties in @page Rules ...... 5-9 5-4 XPP-specific Page Sequence CSS Properties ...... 5-10 5-5 XPP-specific Page Layout CSS Properties ...... 5-16 5-6 CSS Page Sequencing @page Rules Mapped to XPP ...... 5-20 5-6 CSS Page Sequencing @page Rules Mapped to XPP ...... 5-21 5-7 Sample at_bundle.map File ...... 5-21

A-1 Mode Comparisons ...... A-2

C-1 Unsupported CSS Properties ...... C-2

vi Contents Styling Content with CSS About This Manual

Styling Content with CSS describes how to use Cascading Style Sheets (CSS) to format content in XPP divisions as an alternative to using the Item Format (if) spec. Many CSS properties are supported in XPP and there are custom extensions to access native XPP formatting capabilities not available in CSS.

Styling Content with CSS About This Manual vii Where Do I Start?

...... Where Do I Start?

This document is for users responsible for setting up document styles for the XPP publishing application.

If you need to... Then read ... Understand CSS Styling in XPP Chapter 1 Create CSS Styles Chapter 2 Explore CSS Fundamentals Chapter 3 Practice CSS Chapter 4 Work with CSS paged media Chapter 5 Export or Archive XPP Jobs that use CSS Chapter 6 Understand the difference between modes in XPP Appendix A Review the Unicode Character Set Appendix B Review CSS Properties that are not supported in XPP Appendix C Tabular Styles and CSS Appendix D

viii About This Manual Styling Content with CSS Conventions Used in This Manual

...... Conventions Used in This Manual

This manual uses a set of symbolic, typographic, and terminology conventions to categorize specific information. Take a few moments to become familiar with these conventions before you use this manual.

Convention Description Bold Bold type, used in procedures, indicates the object of the action. It may be a menu option, a push button, or a field, and so forth. For example, “select Open” means select the menu option called Open. Position cursor means to move the cursor to a specific location. Enter appropriate information means that you enter information that is appropriate for your site or for the specific job. Bold may be used elsewhere in the manual to denote emphasis. Key Capital first letter and the word “key” indicates a key on the keyboard. Capital first letter and the words “Softkey Menu” indicate the menu pad to the right of the XyView. Unless otherwise indicated, this manual assumes that you press the Enter key at the end of a command line. Key+Key This sequence indicates a Shortcut Key combination. Hold down the first key while also pressing the second key, that is ALT+F4 means to hold down the Alt key while also pressing the F4 key. Message A monospaced typeface indicates an application’s response to your action. For example, “the message Enter Value appears” means that the application displays the words “Enter Value.” Italics In running text, an italic typeface indicates a new term; for example, “The replacement string of characters is the output string.” In a system message, a field entry, or an argument to a command, an italic typeface indicates a variable. For example, filename is a variable in the message “Can’t open filename.” Italics are also used for the names of programs, such as Perl. “ ” Quotation marks indicate that you should enter exactly what the instructions tell you to enter. For example, type “yes” means to type the letter y, the letter e, and the letter s. ÒÚ Reverse-video square brackets represent tags in standard XPP. Tags are general-purpose commands defined in the Item Format Spec and embedded in a document. They generally format logical components of text, such as chapter openings, headers, or lists. For example, the tag for beginning a chapter might be Ò chap Ú.

Styling Content with CSS About This Manual ix Conventions Used in This Manual

Convention Description Ô  Reverse-video angle brackets represent XPP-supplied macros (XyMacros) and user-defined macros. XyMacros are commands embedded in text to set or change formatting or typographic style. For example, the XyMacro to end a page is Ô ep . Reverse-video angle brackets also represent tags when you use XPP in either XML, SGML, or CSS-XML mode. Note that when in XML, SGML, or CSS-XML mode, XPP does not use the conventional reverse-video square brackets. Ô?xxx Reverse-video angle brackets with a beginning question mark represent macros when using XPP in SGML mode. Ô?xxx? Reverse-video angle brackets with a beginning and ending question mark represent macros when using XPP in XML or CSS-XML mode.

x About This Manual Styling Content with CSS For More Information

...... For More Information

This document is part of the XML Professional Publisher standard document set for new and experienced users, which consists of the following documents (among others):

• Creating Pickups describes how to create pickups and pickup elements. Topics include: understanding pickups, creating and controlling pickup elements, checking the status of pickups, outputting pending pickups, and troubleshooting. • Dictionaries and Spell Check describes XPP concepts and procedures to perform hyphenation and spelling tasks. Topics include: building and activating exception dictionaries, specifying algorithms and main dictionaries for up to 34 languages, and running Spell Check interactively, in the background, via job processing, and from the command line. • Managing Document Styles describes how to set up and maintain style specs for XPP. Topics include: managing spec libraries, managing master and local specs, and editing style specs (including the Job Ticket and the Division Ticket). • Mastering Tables describes how to design, create, edit, and maintain tables in XPP. Topics include: working with tables; tabular XyMacros; setting up and maintaining the five tabular specs—general columns (t1), gutters (t2), ruling (t3), alignment (t4), composition (t5); and status, tips, and troubleshooting. • Tints, Color, and Pattern Management describes how to produce elements filled with tints and patterns, and text with color. Topics include: an overview of the feature; setting up tints, patterns, and colors; producing filled rectangles, circles and ellipses; producing filled tabular elements, filled blocks, and special effects text; and outputting tints, patterns and colors. • User Guide introduces XPP concepts, describes the user interface, and provides information about performing publishing tasks for the beginning user. Topics include: getting started, entering and editing text, using search and replace, creating footnotes, composing divisions interactively and in the background, job processing, printing divisions, and using Edit Trace. An appendix describes the status information available in XPP, ranging from Block to Tabular status. • XPP Command Line Utilities lists and provides reference information for the XPP utilities that can be run directly on the operating system.

Styling Content with CSS About This Manual xi For More Information

• XyMacros provides a complete reference to the XPP general XyMacros, tabular XyMacros, and system variables. Topics include: an overview of XyMacros and their syntax; using the Macro List utility; XyMacro arguments, including arithmetic, relative and conditional operators, conditional statements, X-registers, number registers, text registers, and preprocess operators; system variables, general XyMacros, tabular XyMacros, and the relationship of XyMacros to style specs. Includes alphabetical listings of XyMacros and system variables.

Other XPP documents describe such topics as:

• Installation, Release Notes, system administration and converting data. • Optional applications, such as CITI, Loose-leaf, Mark Trace, and Math.

Refer to the XPP Document List for details on document titles and descriptions.

xii About This Manual Styling Content with CSS Chapter 1

CSS Styling in XPP

XPP supports styling XPP content using Cascading Style Sheets

This chapter explains the following:

• Styling and Composition • Tag Processing

Styling Content with CSS CSS Styling in XPP 1-1 Styling and Composition

...... Styling and Composition

Styling

XPP supports Cascading Style Sheets (CSS) for styling XML documents and publications. When a division is placed in CSS-XML mode, CSS replaces the Item Format (if) spec for styling content. You can specify your styling and layout using CSS properties, or you can continue to specify your styling in structured XML mode, via the Item Format (if) spec.

Refer to ″XPP-Supported CSS Properties″ on Page 3-15 for a list of CSS properties that XPP supports. Refer to Appendix C ″Unsupported CSS Properties″ on Page D-4 for a list of CSS properties that XPP does not support, such as float-based layouts and other Web-centric statements.

Important! You cannot mix modes within a division. You can, however, use both XML and CSS-XML modes within different divisions in the same job.

To execute certain functions in CSS-XML mode (tables, XyPerl scripts, Processing Instructions, XyMacros) XPP provides a conduit between CSS-XML mode and structured XML mode by invoking XPP-specific, extended CSS properties.

Refer to Appendix A ″Styling Modes″ on Page A-2 to learn about how CSS style sheet rules can replace styling rules specified in the Item Format spec.

Composition and Pagination

While using CSS for content styling, you will continue to use the following XPP specs to format your content:

• Hyphenation and Justification (hj) • Hung Punctuation (ht) • Page Sequencing (ps) • Page Layout (pl) • Pagination Tries (pt) • Page Columns (pc) • Exception Macros (xx)

You edit these style files using the sdedit program.

1-2 CSS Styling in XPP Styling Content with CSS Styling and Composition

Extended Properties°

Some XPP style concepts are not available in CSS and have to be mapped to extended CSS properties, which begin with -xpp-, where the -xpp- prefix identifies this as an XPP-specific extended CSS property. For example:

para { display: -xpp-line; font-family: Helvetica; font-style: normal; font-variant: small-caps; font-size: 10pt; -xpp-font-width: 9pt; /*condense font*/ -xpp-hj-table: 3;

}

XPP provides the following two pass-throughs (conduits) between CSS-XML mode and the XPP formatting functionality available in XML mode: • -xpp-perl • -xpp-macro

Refer to ″Accessing Perl″ on Page 4-8 for more information.

Escape Sequences A period (.) or a colon (:) are valid characters for XML element names, but CSS may interpret these as a class selector or a pseudo-class selector. If an element name contains one of these characters, you must escape the character by preceding it with a back-slash (\) so it will be interpreted properly. For example: line\.break {text-align: attr(xpp\:ta integer, inherit);}

Pseudo-elements

Pseudo-elements are special modifiers to CSS tag selectors. They have an additional content: property that specifies text that is to be computer generated, or calls Perl functions or XPP macros that extend formatting capabilities. XPP supports the:before and:after pseudo- elements. Refer to ″Generated Text and Pseudo-elements″ on Page 4-2 for more information.

Styling Content with CSS CSS Styling in XPP 1-3 Styling and Composition

XyPerl

Declaring a content: property of -xpp-perl in the:before and :after pseudo elements will execute the requested Perl function. This is done by searching for the named XyPerl function in the bundlename.pl file, which may be located at the job or style library level, or at the system level. Refer to ″Accessing Perl″ on Page 4-8 for more information.

XyMacros

Declaring a display: property of -xpp-macro processes the corresponding named item as an XPP XyMacro. You should use XyMacros only when working with tables and math functions. Refer to ″Macro Examples″ on Page 4-11 for more information.

1-4 CSS Styling in XPP Styling Content with CSS Tag Processing

...... Tag Processing

When the tag for a new element is encountered, CSS selector rules determine the style properties at that point in the division. More than one selector can be active at a time with a precedence order determined by the CSS inheritance and cascade rules.

The CSS processor will determine the composition parameters based on all of the CSS selectors that apply to a tag. After the end tag is processed, the style reverts to the definition of the style of the parent (if inherited). Additionally, for block content the start tag is examined to determine if it should start a new line, a block, or a page using the -xpp-line, -xpp-block, or-xpp-page extended XPP properties, respectively.

Styling Content with CSS CSS Styling in XPP 1-5 Tag Processing

1-6 CSS Styling in XPP Styling Content with CSS Chapter 2

Creating CSS Styles

This chapter describes the following concepts:

• Invoking CSS-XML Mode • Specifying XPP style libraries used for XyPerl and CSS files • Specifying a text editor for editing CSS and XyPerl files • Specifying a style bundle • Creating a CSS style sheet • Creating a XyPerl script

Styling Content with CSS Creating CSS Styles 2-1 Invoking CSS-XML Mode

...... Invoking CSS-XML Mode

To complement the existing XML processing mode in XPP, the CSS-XML mode is used to process CSS styles. In the CSS-XML mode, the Item Format (if) spec is replaced with CSS style sheets. CSS tag selectors replace Xpath statements to select tags based on their location in the structured XML division. Based on the selected CSS tag, composition style properties apply across all active CSS style files. The order and precedence determine the final output result. The tag name and its location within the XML structure determine the composition style properties that apply to the tagged content.

XPP provides custom CSS extensions for style properties that have no CSS equivalent. CSS :before and :after pseudo-elements support generated content and counters. Other CSS style files can be included, via the @import rule. XPP processes CSS files first at the job level, then at the style library level.

To invoke CSS-XML mode from a Job ticket

1. Start PathFinder. Click Start > All Programs > XML Professional Publisher > XPP > XPP PathFinder.

2. From the left pane of PathFinder, expand the job for your publication, and then click Job Ticket. 3. In the right pane, right-click the job, and then click Edit from the pop-up menu.

4. In the Enable XML or SGML field, click - from the drop-down list. 5. In the SoftKey menu, click Store/Exit.

To invoke CSS-XML mode from a Div ticket

1. Start PathFinder. Click Start > All Programs > XML Professional Publisher > XPP > XPP PathFinder.

2. From the left pane of PathFinder, click the job for your publication.

3. In the right pane, right-click the Div, and then click Division Ticket from the pop-up menu. 4. In the Enable XML or SGML field, click css-xml from the drop-down list. If css-xml is enabled at the Job level, you could also choose default in the Enable XML or SGML field.

2-2 Creating CSS Styles Styling Content with CSS Invoking CSS-XML Mode

Specifying a text editor for existing CSS and XyPerl files Set the following environment variables to identify an external editor that will launch when you edit CSS or XyPerl files.

• Perl: XYV_PERL_EDITOR • CSS: XYV_CSS_EDITOR The desired editor will be launched for the associated file type when you edit it from PathFinder or from inside the Xyview editor. If the XYV_PERL_EDITOR or XYV_CSS_EDITOR environment variables are not defined on Windows, XPP uses the ‘file association.’ If the XYV_PERL_EDITOR or the XYV_CSS_EDITOR environment variables are not defined on Linux or Unix, XPP uses the editor defined in the XYV_TEXT_EDITOR environment variable (the fallback on Linux/Unix when there is no file association). If the XYV_TEXT_EDITOR environment variable is not defined on Linux or Unix, XPP will default to the ’gedit’ system program.

Specifying XPP style libraries used for XyPerl and CSS files The default CSS and PL files are named sys.css and sys.pl, respectively. The sys.css file imports xpp.css, which is a system-wide file that contains anything you want to include automatically when a default CSS file is created. We deliver xpp.css with table and math -xpp-macro definitions, in addition to empty.css. All four of these files are contained in XYV_STYLES/xylibrary/Lsyslib. Therefore, they will never overwrite Lsyslib versions when you upgrade your XPP installation. For new installs, these files are copied to Lsyslib as initial templates. For styling CALS tables in CSS-XML divisions, we deliver cals_table.css to Lsyslib. For styling HTML5 tables in CSS-XML divisions, we deliver html_table.css to Lsyslib. We also deliver _t5_cals.sde, _t1_cals.sde, _t5_html.sde and _t1_html.sde for styling CALS and HTML5 tables in CSS-XML. You must copy the appropriate t1 and t5 files to a local style library to use them. You can use PathFinder to create CSS and Perl files at the Library or Job level. You can edit, move, delete, and rename these files to suit your needs.

To start PathFinder, click Start > All Programs > XML Professional Publisher > XPP > PathFinder.

Styling Content with CSS Creating CSS Styles 2-3 Invoking CSS-XML Mode

Specifying a style bundle

Although maintained separately, CSS and XyPerl files are considered part of the style bundle. For example, creating a style bundle automatically creates CSS (my_cust.css) and XyPerl (my_cust.pl) files where ″my_cust″ is the style bundle name.

To specify a style bundle

1. In the left pane of PathFinder under DOCUMENTS, navigate to the desired job and then click the desired job ticket.

2. In the right pane, right-click on a job and click Edit. The Local job ticket opens.

3. In the Standard Style field, enter the name of your style bundle.

Important!

The style ″bundle″ name in a CSS-XML division is used in the Perl script (.pl) at the package; line. In this case, the bundle name must be a valid Perl identifier composed of any combination of letters, digits, and underscores. Also, the Perl identifier must start with a letter or an underscore.

Including external CSS style sheets

Additional style files can be added to the CSS style sheet using the @import rule. This lets you build up a collection of CSS rules for reuse. The @import rule must precede any CSS Selector statements.

Creating a CSS style sheet

To create a CSS style sheet in a job

1. In the left pane of PathFinder under DOCUMENTS, navigate to and then click the desired job. 2. In the left pane, right-click on the job, and then click New Style File from the pop-up list.

3. In the style types list, click CSS. A new CSS style sheet is copied from Lsyslib to the job. It contains @import url(’xpp.css’); as the first entry of the file, along with any boilerplate styling that you may have added. File ″new″ appears in right pane highlighted for renaming.

2-4 Creating CSS Styles Styling Content with CSS Invoking CSS-XML Mode

4. Rename this file to the bundle name.

5. Double-click on the file or right-click and then click Edit from the pop-up menu to open the file in the editor.

To create a CSS style sheet in a library

1. In the left pane of PathFinder under STYLE LIBRARIES, navigate to a style library that begins with ″L.″

2. Right-click on the library name, and then click New.

3. In the style types list, click CSS. File ″new″ appears in right pane highlighted for renaming.

4. Rename this file to the bundle name.

5. Double-click on the file or right-click and then click Edit from the pop-up menu to open the file in the editor.

A new CSS style sheet is copied from Lsyslib to the style library. It contains @import url(’xpp.css’); as the first entry of the file, along with any boilerplate styling that you may have added.

To include an external style file in a library-level CSS style sheet

1. In the left pane of PathFinder under STYLE LIBRARIES, expand the appropriate library that begins with ″L″ and then click CSS.

2. In the right pane, right-click on a CSS bundle name and then click Edit. The CSS style sheet opens in your CSS editor.

3. Enter CSS style rules, as needed.

4. At the top of the file, below the @import url(’xpp.css’); statement, enter a similar statement that points to the location of your external CSS style library. For example, @import url(’my_custom.css’);

Creating a XyPerl script

To create a new XyPerl script in a job

1. In the left pane of PathFinder under DOCUMENTS, navigate to the desired job. 2. Right-click on the job, and then click New Style File from the pop-up list.

Styling Content with CSS Creating CSS Styles 2-5 Invoking CSS-XML Mode

3. In the style types list, click Perl. A new Perl script template is copied from the Lsyslib folder to the job. It contains #!/etc/xyvision/common/perl/bin/perl as the first entry of the file, along with any boilerplate Perl statements that you may have added. File ″new″ appears in right pane highlighted for renaming. 4. Rename this file to the bundle name.

5. Double-click on the file or right-click and then click Edit from the pop-up menu to open the file in the editor.

To create a XyPerl script in a library

1. In the left pane of PathFinder under STYLE LIBRARIES, navigate to a library that begins with ″L.″

2. Right-click on the library name, and then click New. 3. In the list of style types, click Perl. A new Perl script template is copied to the folder; it contains #!/etc/ xyvision/common/perl/bin/perl as the first entry of the file. File ″new″ appears in right pane highlighted for renaming.

4. Rename this file to the bundle name.

5. Double-click on the file or right-click and then click Edit from the pop-up menu to open the file in the editor.

Important! The Perl style file used in css-xml mode must have a package description that is the same name as the style bundle.

Example For a style bundle named ″sample″, the sample.pl Perl file should reflect:

use strict; package sample;

2-6 Creating CSS Styles Styling Content with CSS Chapter 3

CSS Fundamentals

This chapter discusses the concepts of:

• CSS Style Sheets • CSS Tag Selectors • CSS3 attr() function • Style Inheritance and the Cascade • XPP-Supported CSS Properties

Styling Content with CSS CSS Fundamentals 3-1 CSS Style Sheets

...... CSS Style Sheets

This section presents an overview of CSS style sheets. Some of the examples build on previous ones.

Browse to http://www.w3schools.com/css/default.asp for more information about CSS. A rule in a CSS style sheet consists of a name-value pair labeled property and value. Multiple name-value pairs comprise a declaration block. Each pair must end with a semicolon. You associate these name-value pairs with tags and attributes in your XML division. You save your CSS style information in one or more style sheets.

Important: To use CSS for styling content, XPP must be in CSS-XML mode and use a style bundle. Refer to “Invoking CSS-XML mode” on Page 2-6 and “Specifying a Style Bundle” on Page 2-4, respectively.

Examples:

• Styles the content of all para elements in blue. para { color:blue; } • Styles the content of all para elements in blue in a 24-point font size. para { color:blue; font-size:24pt; } • Styles all head elements in 24pt, Arial, black: head { font-size: 24pt; font-family: Arial; color: black; }

3-2 CSS Fundamentals Styling Content with CSS CSS Style Sheets

• Styles all elements with a class of titlemod to be colored blue. .titlemod { color: blue; } In your CSS stylesheet, if you have both this selector and the one from the previous example, and if your XML has ..., then the head will be rendered 24pt Arial in blue, as the color from the .titlemod selector overrides the color from the head selector because, according to CSS rules, a class attribute has a higher selectivity.

The CSS Styles any element with an id attribute of ″3794″ to be colored red. #3794 { color:red; } This example combines this selector with those selectors from the two previous examples. If your XML content has . . . , your head element will be rendered in 24pt Arial red because an id selector has the highest selectivity of all the CSS selectors.

Styling Content with CSS CSS Fundamentals 3-3 CSS Tag Selectors

...... CSS Tag Selectors

This section presents examples of common CSS tag selectors, also known as XML element (and attribute) selectors. This list is not exhaustive. Each tag’s purpose is listed first, followed by CSS code, followed by the XML implementation. The tags available to you are governed by the XML DTD or XML Schema used at your site, and may differ from these examples. Therefore, in this section, tag is a proxy for any XML tag.

Refer to ″Generated Text and Pseudo-Elements″ on Page 4-2 for information on pseudo-class and element selectors.

Tip! In a web browser, search for “CSS Tag Selectors” and “CSS Attribute Selectors” for more in-depth explanations and examples.

Table 3-1 CSS Selector Rules

This CSS Selector{ Selects All {

type instances of the named element. tag para {{; {; {;}

group instances of multiple named elements. tag, tag, tag volume, chapter, section {{; {; {;}

descendant instances of chapter only when it is descendant tag tag tag (immediate or not) of section, which in turn must be a descendant (immediate or not) of volume. volume section chapter {{; {; {;}

child instances of chapter only when it is a descendant tag > tag (immediate) of volume or section. section > chapter {{; {; {;} volume > chapter {{; {; {;}

class elements with a matching class attribute value tag.class-name para.intro {{; {; {;} matches

id elements with a matching id attribute value. tag#id-name para#copyright {{; {; {;} matches

attribute elements qualified with a matching attribute name. tag[attr] para[lang] {{; {; {;}

universal elements in the division or job. * *{{; {; {;} Note: SDL does not recommend using the universal selector as it affects all elements and, when applied, adversely affects composition performance.

3-4 CSS Fundamentals Styling Content with CSS CSS Tag Selectors

Table 3-2 CSS Tag Selector Examples

CSS tag or attribute selector Function

head { The type selector selects any named element. font-size: 24pt; Example: Renders all head elements with a } larger than normal font size. {

volume, chapter, The group tag selector lets you apply the same section { style to a named set of elements, regardless of font-family: sans- any attributes they may contain. serif; font-weight: Example: Renders the volume, chapter, and bold; section elements in a sans-serif, bold font. } { {

{

section title { Example: The descendant selector selects only font-weight: bold; elements that are descendants of a named } ancestor element. Renders title elements that are descendants of section elements in bold. (unaffected)

bold ...

image > caption The child selector selects the named child { element. font-size: 10pt; Example: A caption element that is a child of an } image tag will be rendered in a 10 point font size. A caption element that is not a child of the image element will be unaffected. {

*{ The universal selector selects all elements. font-family: Helvetica; Example: Renders all elements in the Helvetica } font. Note: SDL does not recommend using the universal selector as it affects all elements and, when applied, adversely affects composition performance.

Styling Content with CSS CSS Fundamentals 3-5 CSS Tag Selectors

Table 3-2 CSS Tag Selector Examples (Continued)

CSS tag or attribute selector Function

.legal { The class selector selects any element with a font-size: 8pt; font- named class attribute. variant: small-caps; Example: Renders any element with a class of } legal in fine print, in small caps. { -or-

{

ol[myliststyle]{ The attribute selector selects any element with a font-style: italic; named attribute, regardless of the attribute’s } value. Example: Renders the list item in italics for the ol element with an attribute of myliststyle. Other ol elements without the myliststyle attribute will not match this selector.

    {

#v { The id selector selects an element with a named text-transform: id attribute. The id selector is used for only a uppercase; single instance of an element. If both a class } selector and an id selector are applied to an element, the styling from the id selector takes precedence. Example: Renders the index element with an id of v as uppercase. {

para[level=″beginner″]{ This attribute selector selects a specified element color: green; with a named attribute and value. } Example: Renders the contents of the para element with a ″level″ attribute of beginner in a green typeface. Other para elements with the same attribute but a different value will be unaffected. {

para[color^=″red″]{ This attribute selector selects a para element color: red; with a named attribute starting with a certain } value (prefix), red in this case. Example: Renders the contents of the para element with a color of redwood because it matches the color attribute prefix of red. Other para elements with the same attribute but a different value (not starting with red) will be unaffected.

3-6 CSS Fundamentals Styling Content with CSS CSS Tag Selectors

Table 3-2 CSS Tag Selector Examples (Continued)

CSS tag or attribute selector Function

{

topicref[TOC$=″no″]{ This attribute selector selects a topicref display: none; element with a named attribute, TOC, ending } (suffix) in a specific value. Example: Suppresses the contents of the topicref element from displaying in the table of contents. {

topicref This attribute selector selects a topicref [TOC*=″chap″]{ element with a named substring of a specific display: -xpp-line; value. } Example: Start a new line before processing the contents of this element. {

chapter This attribute selector selects a chapter with a [type~=″frontmatter″]{ type attribute of ″frontmatter″ from a space- font-weight: bold; delimited list, and renders the contents of the } ″frontmatter″ chapter element in bold. Example: {

para[lang|=″en″]{ This attribute selector selects a para element color: red; with a lang attribute that equals ″en″, or is } prefixed with en-. Example: Renders the contents of the para element with a lang attribute of en-us in red. {

Styling Content with CSS CSS Fundamentals 3-7 CSS3 attr() function

...... CSS3 attr() function

You can add the attr()function as a component value in properties applied to an element or a pseudo-element. The function returns the value of an attribute on the element. If used on a pseudo-element, the function returns the value of the attribute on the pseudo-element’s originating element. The computed value of the attr()expression is the value of the attribute with the specified name on the element, according to the rules in ″Attr() Function Type or Unit Keywords″ on Page 3-9.

In CSS3, the attr()expression can return many different types, but not every type, such as, counters, named strings, quotes, or keyword values such as auto, nowrap or baseline. This is by design as the intent of the attr()expression is not to describe a presentation language’s formatting using CSS, but to enable CSS to account for semantic data.

The syntax for the attr()expression is: attr(name type-or-unit [,fallback]) where name is the attribute name.

The optional type-or-unit argument is a keyword drawn from the following list that indicates how to interpret the attibute value, and defines a type for the attr()expression. If omitted, string is implied. The optional fallback argument represents a fallback value, which is used if the named attribute is missing, or its value cannot be parsed into the given type, or is invalid, or out of range for the property. If it’s absent, the default value of inherit is used.

The attr()expression is valid only if:

• the attr()expression’s type is valid where the expression is placed. • the fallback is valid where the expression is placed. • the fallback does not contain another attr()expression.

If the fallback value is invalid, then the attr() expression will fail to parse. When that happens, the CSS declaration will be ignored. The default value does not have to be of the type given. For instance, if the type required of the attribute by the author is pc, the default could still be auto, as in width:attr(size pc, auto);

If the specified attribute exists on the element, the value of the attribute must be parsed as required by the argument as defined in ″Attr() Function Type or Unit Keywords″ on Page 3-9.

3-8 CSS Fundamentals Styling Content with CSS CSS3 attr() function

Unless the type is string, leading and trailing white space around the attribute value is ignored. The resulting value is the attr() expression’s value. If the value did not parse as required, the attr()expression’s value is its fallback value.

Attr() Function Type or Unit Keywords The attribute type-or-unit value... • color must parse as a color name or a color number. Currently, XPP supports only the 8 standard color names: {black, white, red, green, blue, cyan, magenta, yellow}. If the attribute value is a number, it is interpreted as a color number from the XPP color control spec, as if entered using the -xppc(#) function. • integer must parse as a NUMBER CSS token, and be successfully interpreted as an integer. • length must parse as a DIMENSION CSS token, and be successfully interpreted as a valid XPP length value. An example is 12pc. Notice that the number is immediately followed by a valid XPP unit designator such as em|ex|px|cm|in|pt|pc|co|do|% • number must parse as a NUMBER CSS token, and is interpreted as a number. • string is taken as the contents of a CSS string. • url is taken as the contents of a CSS string. It is interpreted as a quoted string within the url()notation. • em|ex|px|cm|in|pt|pc|co|do|\% (unit) Must parse as a NUMBER CSS token, and is interpreted as a valid XPP length value using the specified unit designator.

Styling Content with CSS CSS Fundamentals 3-9 CSS3 attr() function

Unsupported Properties The following CSS properties do not support, or partially support, the CSS3 attr()function:

• The attr() function within the content property remains unchanged; that is, it takes only a single argument, and it always generates a string. Also within the content property, the counter-increment and counter-reset functions do not support the attr() function. • The font shorthand property does not support the attr() function. • The list-style-image property does not support the attr() function. • The -xpp-export-class property does not support the attr() function

Using the CSS3 Attr() Function This section provides practical examples of defining CSS property values using the CSS3 attr()function. Tip! Refer to ″XPP Supported CSS Properties″ on Page 3-15 for additional property information, and ″Attr() Function Type or Unit Keywords″ on Page 3-9 for keyword rules.

color This example uses the ″color″ type to parse the ″my_color″ attribute as either a named color or as an integer, which is interpreted as -xppc(#). The fallback value is XPP color #59 from XPP’s Color Control spec.

The CSS para[my_color] { color: attr(my_color color, -xppc(59)); }

The XML

This renders in the color red This renders in the color #333

3-10 CSS Fundamentals Styling Content with CSS CSS3 attr() function

font-size The first CSS rule uses the ″length″ type or unit to parse the ″sizelen″ attribute as a number followed by a valid XPP unit designator. The second CSS rule uses the ″pt″ type or unit to parse the ″sizept″ attribute as a number, which is then interpreted as a length dimension by adding the ″pt″ unit designator.

The CSS

para[sizelen]{ font-size: attr(sizelen length, 14pt); } para[sizept] { font-size: attr(sizept pt, 10pt); }

The XML

This is 24pt This is 75% of the parent tag’s font-size This is 18pt

Styling Content with CSS CSS Fundamentals 3-11 Style Inheritance and the Cascade

...... Style Inheritance and the Cascade

Many, but not all, CSS properties are automatically inherited from those properties specified on a parent element. This can save you time by reducing the number of styles that you need to define.

Tip! In a web browser, search for “CSS style inheritance,” “CSS cascade,” or “CSS specificity” for more in-depth explanations and examples. Also, refer to “Tabular Styles in CSS” on Page D-1 for more information on inherited properties.

Consider this XML fragment for a DITA ″Concept″ topic type:

The CSS concept { color: black; font-weight: normal; } conbody { color: blue; } section { color: red; margin-left: 2pt; } .hide_me { display: none; }

3-12 CSS Fundamentals Styling Content with CSS Style Inheritance and the Cascade

The XML Tagging This is my sample Concept topic. tommytechwriter

This is my first paragraph

This is my second paragraph

This is my section (includes paragraphs three and four).

This is my third paragraph

This is my fourth paragraph

This is my fifth paragraph

• All elements inherit the value of the font-weight property from the concept element. The first two paragraphs after the conbody tag will be blue. • The first and second paragraphs inherit the color:blue property and value from the conbody element. • The title element, and the third and fifth paragraphs inherit the color: red property and value from the section element. • The fourth paragraph also inherits the color: red property and value from the section element, but it will not display because the .hide_me class tag is applied to the containing paragraph and its output is suppressed. • Unlike margin values specified in the Item Format (if) spec, which use absolute values, the margin-left CSS property is implemented as a relative value, relative to the prevailing left margin.

Tip! Refer to “XPP-supported CSS Properties” on Page 3-15 to learn more about inherited properties.

Styling Content with CSS CSS Fundamentals 3-13 Style Inheritance and the Cascade

The Cascade Effect If multiple style sheets are specified, the property from the last style sheet in the list will take precedence over style definitions for a tag in a style sheet before it. Refer to “Including External CSS Style Sheets” on Page 2-4 for more information. At a tag level, the style information used is based on the following precedence:

1. !important (when applied to a tag or tags, this rule overrides all other applied rules)

2. ID

3. Class

4. Tag

XPP End Tag Restore Not all properties are restored when an XML end tag is processed. The following XPP (CSS) properties are restored:

• Font family (CSS font-family) • Font variant (CSS font-style and font-weight) • Font height (CSS font-size) • Font width (CSS -xpp-font-width) • Case mode (CSS font-variant) • Track kerning (CSS -xpp-kerning-track) • Color (CSS color, -xpp-pattern) • Hyphenation language (CSS -xpp-hyphenation-table) • Kerning pairs (CSS -xpp-pair-kerning) • Underlining (CSS -xpp-underline-style)

3-14 CSS Fundamentals Styling Content with CSS XPP-Supported CSS Properties

...... XPP-Supported CSS Properties

You specify property measurements in either length or percentage in the following units:

Table 3-3 Units of Measurement

Unit Purpose Example

px Pixels {font-size: 12px;} Dots per inch as measured on a computer monitor. Note: XPP converts pixels based on the formula: 1 pixel = 0.75 points.

% Percentage {line-height: 150%;} Percentage of some value

co ciceros {font-size: 1co;}

do didots {font-size: 11.223do;}

em em {font-size: 1.5em;} Calculated height of a uppercase If a parent element has a 12pt font ‘m’ equal to the current font-size. size, then a child element can use a relative size, such as 1.5em. This would result in an 18pt font size.

ex ex {line-height: 1.2ex;} Calculated height of a lowercase x

in Inches

cm Centimeters

mm Millimeters

pt Points content: -xpp-perl (xymacro,box,’1pt’,’6pt’,’6pt’);

pc Picas content: -xpp-perl (xymacro,box,’1pc’,’6pc’,’6pc’);

Note: During composition, XPP normalizes units of measure to Microns.

You cannot use the following qualifiers in CSS style sheets:

• kyus (k) • microns (n)

Styling Content with CSS CSS Fundamentals 3-15 XPP-Supported CSS Properties

Note: In CSS files, dimensions in the form x.y for picas and ciceros, such as 10.6pc, are interpreted as decimal fractions. Fractional values for picas and ciceros units in CSS files are not interpreted as with the XyMacro syntax for ″picas.points″ and ″ciceros.didots″. For example, 10.6pc is 10 picas + 6/10ths of a pica, not 10 picas and 6 points. This difference is necessary in order to adhere to the standards for interpreting such units in a CSS file.

The following table lists properties and values (including XPP property extensions) that you can use for styling. Unless specifically set, default values are used. ″Inherited?″ Yes means child elements will inherit the same value as was set by the parent element (the default value is used if it is the root element) − the same effect as using the inherit property value.

The ″Value″ column contains CSS keywords, which are depicted in italics. XPP uses the standard W3C CSS keywords, as described in http://www.w3.org/TR/CSS2/syndata.html#values

Table 3-4 XPP-Supported CSS Properties color The color property specifies the color of text.

Initial value black Inherited? yes

Syntax color | -xppc(xpp color rule #) | inherit | attr()

Value Description color Specifies the text color CSS defines a color value using either a keyword or a numerical RGB value. The keywords include black, white, red, green, blue, cyan, magenta, and yellow. inherit Inherits this property value from its parent element. attr(name color[,fallback]) Refer to the CSS3 attr() function section.

-xppc(#) Color rule number from XPP color control spec. content The content property is used with the :before and :after pseudo- elements to insert generated content.

Initial value normal Inherited? no

Syntax normal | none | string | url | counter(name[,style]) | counters(name[,string[,style]]) | attr(identifier) | open-quote | close-quote | no-open-quote |no-close-quote | inherit | -xpp-perl(perl_expression)

3-16 CSS Fundamentals Styling Content with CSS XPP-Supported CSS Properties content The content property is used with the :before and :after pseudo- elements to insert generated content.

Value Description normal Default value. Sets the content, if specified, to normal, which default is ″none″ or nothing. none Sets the content, if specified, to nothing. string Sets the content to the text you specify. url Insert image into content, that is, url (″my_image.png″). counter(name[,style]) Inserts the value of the named counter into the content (using the specified style). counters(name[,string[,style]]) Insert value of named counter for each defined level with each number separated by specified string (default ″.″), using specified style (default decimal). attr(identifier) Sets the content to the value of the attribute whose name is equal to identifier. open-quote Sets the content to be an opening quote. close-quote Sets the content to be a closing quote. no-open-quote Inserts no content, but increments the level of nesting for quotes. no-close-quote Inserts no content, but decrements the level of nesting for quotes. inherit Inherits this property value from its parent element.

-xpp-perl (perl_expression) Evaluate the (perl_expression) and insert the output into the content.

-xpp-perl-mfrag (perl_expression) Evaluate the (perl_expression) and insert the output into the content within a marked fragment (in which tags are interpreted as elements rather than as XyMacros). The -xpp-perl-mfrag must be the last value in the content property of the tag’s :before pseudo element in order for a marked fragment to be generated. counter-increment The counter-increment property increments one or more named counters. The counter-increment property is usually used together with the counter-reset property and the content property.

Initial Value none Inherited? no

Syntax identifier integer | none | inherit

Styling Content with CSS CSS Fundamentals 3-17 XPP-Supported CSS Properties counter-increment The counter-increment property increments one or more named counters. The counter-increment property is usually used together with the counter-reset property and the content property.

Value Description identifier integer Increment the named counter. If the (optional) integer is given, increment the counter by that integer, otherwise by 1. none Default value. No counters will be incremented. inherit Inherits this property value from its parent element. counter-reset The counter-reset property creates or resets one or more counters. The counter-reset property is usually used together with the counter-increment property and the content property.

Initial Value none Inherited? no

Syntax identifier integer | none | inherit

Value Description identifier integer Reset the value of the named counter. If the integer is specified, reset the named counter to that value, otherwise to zero. none Default value. No counters will be reset. inherit Inherits this property value from its parent element. display The display property specifies the type of processing used for an element.

Initial Value inline Inherited? no

Syntax none | inline | block | -xpp-line | -xpp-block | -xpp-page | -xpp-macro | list-item

Value Description none The element will not be displayed. inline Default value. Process an element as an inline element. list-item Process as an item in a list. block Process the same as -xpp-line.

-xpp-line End the current line before processing this element.

3-18 CSS Fundamentals Styling Content with CSS XPP-Supported CSS Properties display The display property specifies the type of processing used for an element.

-xpp-line-suppress Ends the current line and suppresses content.

-xpp-block End the current block before processing this element.

-xpp-page End the current page before processing this element.

-xpp-macro The element will be processed using XPP macros. Examples are CALS table elements (table, tgroup, etc) and MathML elements (math). font-family The font-family property specifies the font for an element. It can hold several font names as a ″fallback″ system. If the first font is not found it tries the next font.

Initial value sans-serif (XPP Font Family 1) Inherited? yes

Syntax family-name, generic-family | inherit | attr()

Value Description family-name A prioritized list of font family names and/or generic family generic-family names. Note: For generic-family XPP supports serif and sans-serif. XPP does not support cursive, fantasy, and monospace. A value of serif translates in XPP to a fixed Font Family value of 0 in the Font Variant (fv) spec and sans-serif translates to a fixed Font Family value of 1. Note: Separate each value with a comma. If a font name contains white space it must be quoted. inherit Inherits this property value from its parent element. attr(name string[,fallback]) Refer to the CSS3 attr() function section. font-size The font-size value sets the size of an element.

Initial Value 12pt Inherited? yes

Syntax length | % (of parent) | inherit | xx-small |x-small | small | medium | large | x-large | xx-large | smaller | larger | attr()

Value Description length Sets the font-xize to a fixed size in px, cm, etc.

% Sets the font-size to a percent of the parent element’s font size.

Styling Content with CSS CSS Fundamentals 3-19 XPP-Supported CSS Properties font-size The font-size value sets the size of an element. xx-small 6.75pt x-small 7.5pt small 9.75pt medium 12pt large 13.5pt x-large 18pt xx-large 24pt smaller Sets the font-size to 80% of the parent font-size. larger Sets the font size to 120% of the parent font-size. inherit Inherits this property value from its parent element. attr(name integer|unit[,fallback]) Refer to the CSS3 attr() function section. font-style The font-style property specifies the font style for text.

Initial Value normal Inherited? yes

Syntax italic | oblique | normal | inherit| attr()

Value Description italic Sets the XPP italic font style. oblique Sets the XPP italic font style. Note: The font could be oblique if the actual font referenced is implemented as an oblique font (rather than a true italic font). However, in the Typesetter Font Map (TSF) spec, the font is specified as italic in the CSS font-style field. normal Normal font style inherit Inherits this property value from its parent element. font-variant The font-variant property specifies what variation text should be displayed in such as small-caps.

Initial Value normal Inherited? yes

Syntax normal | small-caps | inherit| attr()

3-20 CSS Fundamentals Styling Content with CSS XPP-Supported CSS Properties font-variant The font-variant property specifies what variation text should be displayed in such as small-caps.

Value Description normal Normal font variant small-caps Set XPP case mode to select smallcaps. If this font-variant value is used, it will cause the text-transform property value to be ignored. inherit Inherits this property value from its parent element. attr(name integer[,fallback]) Refer to the CSS3 attr() function section. font-weight The font-weight property is used to select a bold XPP font variant.

Initial Value normal Inherited? yes

Syntax normal | bold | inherit| attr()

Value Description normal Selects a normal XPP font variant. bold Selects a bold XPP font variant. inherit Inherits this property value from its parent element attr(name integer[,fallback]) Refer to the CSS3 attr() function section. line-height The line-height property specifies the line height.

Initial Value normal Inherited? yes

Syntax normal | length | number | % (of font-size) | inherit | attr()

Value Description normal A normal line height. This is default. length A fixed line height in px, pt, cm number A number that will be multiplied with the current font size to set the line height.

% A line height that is a percentage of the current font size. inherit Inherits this property value from its parent element.

Styling Content with CSS CSS Fundamentals 3-21 XPP-Supported CSS Properties line-height The line-height property specifies the line height. attr(name length|number| Sets the line-height based on the value of a named attribute. unit[,fallback]) Refer to the CSS3 attr() function section. list-style-image The list-style-image property replaces the list-item marker with an image. Note: Always specify the list-style-type property in addition. This property is used if the image, for some reason, is unavailable.

Initial Value none Inherited? yes

Syntax url | none | inherit

Value Description url That is, list-style-image: url(″mygraphic.png″) will insert the graphic mygraphic.png in place of the list item marker (bullet or number). none No image will be displayed. Instead, the list-style-type property will define what type of list marker will be rendered. This is default. inherit Inherits this property value from its parent element.

Note: XPP does not fetch graphics from the Internet. list-style-position The list-style-position property specifies if the list-item marker should appear inside or outside the content flow.

Initial Value outside Inherited? yes

Syntax inside | outside | inherit

Value Description inside The marker is set in line with the text, such that the marker and any overflow text share the same left margin. outside Keeps the marker to the left of the text. This is default. inherit Inherits this property value from its parent element.

3-22 CSS Fundamentals Styling Content with CSS XPP-Supported CSS Properties list-style-type The list-style-type specifies the type of list-item marker in a list.

Initial Value disc Inherited? yes

Syntax disc | circle | square | decimal | decimal-leading-zero | lower-roman | upper-roman | lower-greek | lower-latin | upper-latin | armenian | georgian | lower-alpha | upper-alpha | -xpp-ans | -xpp-anss | -xpp-anzz | -xpp-lower-aio | -xpp-upper-aio | -xpp-ia | -xpp-ias | -xpp-iass -xpp-iaz | -xpp-iazz | -xpp-ie | -xpp-ies | -xpp-iess | -xpp-iez | -xpp-iezz | -xpp-id | -xpp-ids | -xpp-idss | -xpp-idz | -xpp-idzz | none | inherit

Value Description

Unordered List: disc Default value. The marker is a filled circle. circle The marker is a circle. square The marker is a square.

Ordered List: decimal The marker is a number. decimal-leading-zero The marker is a number with leading zeros (01, 02, 03, etc). lower- roman The marker is a lower-roman (i, ii, iii, iv, etc). upper-roman The marker is upper-roman (I, II, III, IV, etc). lower-greek The marker is lower-greek. lower-latin The marker is lower-latin. upper- latin The marker is upper-latin armenian The marker is traditional Armenian numbering. georgian The marker is traditional Georgian numbering. lower-alpha The marker is lower-alpha (a, b, c, d, etc). upper-alpha The marker is uper-alpha (A, B, C, D, etc).

XPP Ordered List:

-xpp-ans Prints and aligns 1 and 2-digit arabic numerals by inserting a

Styling Content with CSS CSS Fundamentals 3-23 XPP-Supported CSS Properties list-style-type The list-style-type specifies the type of list-item marker in a list.

leading space.

-xpp-anss Prints and aligns 1 to 3-digit arabic numerals by inserting leading spaces.

-xpp-anzz Prints and aligns 1 to 3-digit arabic numerals by inserting leading zeros.

-xpp-lower-aio Prints lowercase alphabetic characters without the letters i and o.

-xpp-upper-aio Prints uppercase alphabetic characters without the letters i and o.

-xpp-ia Prints Indic Arabic numerals.

-xpp-ias Prints and aligns 1 and 2-digit Indic Arabic numerals by inserting a leading space.

-xpp-iass Prints and aligns 1 to 3-digit Indic Arabic numerals by inserting leading spaces.

-xpp-iaz Prints and aligns 1 and 2-digit Indic Arabic numerals by inserting a leading zero.

-xpp-iazz Prints and aligns 1 to 3-digit Indic Arabic numerals by inserting leading zeros.

-xpp-ie Prints Indic Arabic Eastern numerals.

-xpp-ies Prints and aligns 1 and 2-digit Indic Arabic Eastern numerals by inserting a leading space.

-xpp-iess Prints and aligns 1 to 3-digit Indic Arabic Eastern numerals by inserting leading spaces.

-xpp-iez Prints amd aligns 1 and 2-digit IndicArabic Eastern numerals by inserting a leading zero.

-xpp-iezz Prints and aligns 1 to 3-digit Indic Arabic Eastern numerals by inserting leading zeros.

-xpp-id Prints Indic Arabic Devanagari numerals.

-xpp-ids Prints and aligns 1 and 2-digit Indic Arabic Devanagari numerals by inserting a leading space.

-xpp-idss Prints and aligns 1 to 3-digit Indic Arabic Devanagari numerals by inserting leading spaces.

-xpp-idz prints and aligns 1 and 2-digit Indic Arabic Devanagari numerals by inserting a leading zero.

3-24 CSS Fundamentals Styling Content with CSS XPP-Supported CSS Properties list-style-type The list-style-type specifies the type of list-item marker in a list.

-xpp-idzz prints and aligns 1 to 3-digit Indic Arabic Devanagari numerals by inserting leading zeros.

Styling Content with CSS CSS Fundamentals 3-25 XPP-Supported CSS Properties margin The margin shorthand property sets indents for right, left, bottom, and top margins in XPP.

Initial Value 0 Inherited? no

Syntax The margin shorthand property can be used to set some or all margin values with a single statement. Unlike margin values specified in the Item Format (if) spec, which use absolute values, the margin-left, margin- right, margin-top, margin-bottom, and text-indent properties are implemented as relative values, relative to the prevailing left, right, top, and bottom margins or for text- indent relative to the prevailing left margin. SDL recommends you control margins (indents) using the margin-left and margin-right properties. Use the margin-top and margin-bottom properties to control vertical spacing (prelead and postlead), respectively. margin-left The margin-left property sets the left margin of an element relative to the prevailing left margin. Note: Negative values are allowed.

Initial Value 0 Inherited? no

Syntax length | % (of width) | inherit | attr()

Value Description length Specifies a fixed left margin in px, pt, cm, etc. Default is 0px.

% Specifies a left margin in percent of the width of the containing element. inherit Inherits this property value from its parent element. attr(name length|unit[,fallback]) Refer to the CSS3 attr() function section. margin-right The margin-right property sets the right margin of an element relative to the prevailing right margin. Note: Negative values are allowed.

Initial Value 0 Inherited? no

Syntax length | % (of width) | inherit | attr()

Value Description length Specifies a fixed right margin in px, pt, cm, etc. Default is 0px.

% Specifies a right margin in percentage of the width of the

3-26 CSS Fundamentals Styling Content with CSS XPP-Supported CSS Properties margin-right The margin-right property sets the right margin of an element relative to the prevailing right margin. Note: Negative values are allowed.

containing element. inherit Inherits this property value from its parent element. attr(name length|unit[,fallback]) Refer to the CSS3 attr() function section. margin-top The margin-top property sets the top margin of an element relative to the prevailing top margin. Note: Negative values are allowed.

Initial Value 0 Inherited? no

Syntax length | % (of width) | inherit | attr()

Value Description length Specifies a fixed top margin in px, pt, cm, etc. Default is 0px.

% Specifies a top margin in percent of the width of the containing element. inherit Inherits this property value from its parent element. attr(name length|unit[,fallback]) Refer to the CSS3 attr() function section. margin-bottom The margin-bottom property sets the bottom margin of an element relative to the prevailing bottom margin and relative to the last line. If there is is a content-generating :after pseudo- element, the margin-bottom will be applied to the last line of the :after generated content. Note: Negative values are allowed.

Initial Value no Inherited?

Syntax length | % (of width) | inherit | attr()

Styling Content with CSS CSS Fundamentals 3-27 XPP-Supported CSS Properties margin-bottom The margin-bottom property sets the bottom margin of an element relative to the prevailing bottom margin and relative to the last line. If there is is a content-generating :after pseudo- element, the margin-bottom will be applied to the last line of the :after generated content. Note: Negative values are allowed.

Value Description length Specifies a fixed bottom margin in px, pt, cm, etc. Default is 0px.

% Specifies a bottom margin in percent of the width of the containing element. inherit Inherits this property value from its parent element. attr(name length|unit[,fallback]) Refer to the CSS3 attr() function section. quotes The quotes property allows the user to specify matching open/close quote characters which are used by the content/open- quote and content/close-quote functions. The first two values specifies the first level of quotation embedding, the next two values specifies the next level of quote embedding, etc. initial value none Inherited? yes

Syntax string | none | inherit

Value Description string Specify matching open/close quote characters such as quotes: ″″’’; none No quote characters are inserted. inherit Inherit quote characters from parent element. text-align The text-align property specifies the horizontal alignment of text in an element.

Initial value -xpp-justify-last-line-appropriate Inherited? yes

Syntax left | center | right | justify | inherit | attr()|-xpp-justify |-last-line-left | -xpp-justify-last |-line-center | -xpp-justify-last-line-right | -xpp-justify-last-line-left-no-return | -xpp-justify-last-line-center-no-return | -xpp-justify-last-line-right-no-return | -xpp-ragged-left | -xpp-ragged-center | -xpp-ragged-right |-xpp-ragged-left-no-return | -xpp-ragged-center-no-return | -xpp-ragged-right-no-return |

3-28 CSS Fundamentals Styling Content with CSS XPP-Supported CSS Properties text-align The text-align property specifies the horizontal alignment of text in an element.

-xpp-justify-last-line-appropriate | -xpp-ragged-appropriate

Value Description left Aligns the text to the left. center Centers the text. right Aligns the text to the right. justify Stretches the lines so that each line as equal width. inherit Inherits this property value from its parent element. Note: In addition to the default CSS text alignment options, you can specify the following XPP extensions:

-xpp-justify-last-line-left Justifies wrapped lines and quads left at paragraphs and hard returns.

-xpp-justify-last-line-center Justifies wrapped lines and quads center at paragraphs and hard returns.

-xpp-justify-last-line-right Justifies wrapped lines and quads right at paragraphs and hard returns.

-xpp-justify-last-line-left-no- Justifies wrapped lines and quads left at paragraphs. A hard return return acts as a spaceband.

-xpp-justify-last-line-center-no- Justifies wrapped lines and quads center at paragraphs. A hard return return return acts as a spaceband.

-xpp-justify-last-line-right-no- Justifies wrapped lines and quads right at paragraphs. A hard return return acts as a spaceband. xpp-ragged-left Sets text ragged left, quads right wrapped lines, paragraphs, and hard returns.

-xpp-ragged-center Sets text ragged center, quads center wrapped lines, paragraphs, and hard returns.

-xpp-ragged-right Sets text ragged right, quads left wrapped lines, paragraphs, and hard returns.

-xpp-ragged-left-no-return Sets text ragged left, quads right wrapped lines and paragraphs. No quad on hard returns; a hard return acts as a spaceband.

-xpp-ragged-center-no-return Sets text ragged center, quads center wrapped lines and paragraphs. No quad on hard returns; a hard return acts as a spaceband.

Styling Content with CSS CSS Fundamentals 3-29 XPP-Supported CSS Properties text-align The text-align property specifies the horizontal alignment of text in an element.

-xpp-ragged-right-no-return Sets text ragged right, quads left wrapped lines and paragraphs. No quad on hard returns; a hard return acts as a spaceband.

-xpp-justify-last-line- Justify all lines except the last line, which is quadded based on appropriate the writing direction. The last line is quadded left if the writing direction is LTR and quadded right if the writing direction is RTL.

-xpp-ragged-appropriate Justifies ragged according to the writing direction; ragged right if the writing direction is LTR; ragged left if the writing direction is RTL. attr(name integer[,fallback]) Refer to the CSS3 attr() function section text-indent The text-indent property specifies the indentation of the first line in a text block relative to the prevailing left margin. Note: Negative values are allowed. The first line will be indented to the left if the value is negative.

Initial Value 0 Inherited? yes

Syntax length | % (of width) | inherit | attr()

Value Description length Specifies a fixed left first line indent in px, pt, cm, etc. Default is 0px.

% Specifies a left first line indent in percent of the width of the containing element. inherit Inherits this property value from its parent element. attr(name length|unit[,fallback]) Refer to the CSS3 attr() function section. text-transform The text-transform property controls the capitalization of text.

Initial Value none Inherited? yes

Syntax uppercase | lowercase | none | inherit| attr()

Value Description uppercase Transforms all characters to uppercase. lowercase Transforms all characters to lowercase. none No capitalization. The text renders as it is. This is default.

3-30 CSS Fundamentals Styling Content with CSS XPP-Supported CSS Properties text-transform The text-transform property controls the capitalization of text. inherit Inherits this property value from its parent element. attr(name integer[,fallback] Refer to the CSS3 attr() function section.

Note: If you are using the small-caps value for the font-variant property, it will ignore the text-transform property, if specified. vertical-align The vertical-align property sets the vertical alignment of an element.

Initial Value baseline Inherited? yes

Syntax length | % (of line-height) | sub | super | baseline | inherit | attr()

Value Description length Raises or lowers an element by the specific length. Negative values are allowed.

% Raises or lowers an element in a percent of the “line-height” property. Negative values are allowed. sub Aligns the element as if it was subscript. Defaults to 0.29 em. super Aligns the element as if it was superscript. Defaults to 0.58 em. baseline Align the baseline of the element with the baseline of the parent element. This is default. inherit Inherits this property value from its parent element. attr(name length|unit[,fallback]) Refer to the CSS3 attr() function section. width The width property sets the width of an element.

Initial Value auto Inherited? yes

Syntax length | % (of block width) | auto | inherit | attr()

Value Description length Defines the width in px, cm, etc.

% Defines the width as a percentage of the containing block. auto XPP calcuates the width. This is the default.

Styling Content with CSS CSS Fundamentals 3-31 XPP-Supported CSS Properties width The width property sets the width of an element. inherit Inherits this value property from its parent element attr(name length|unit[,fallback]) Refer to the CSS3 attr() function section.

Note: The text-indent property is a single line indent, normally used for paragraph indents. The margin-left property is for the whole element, normally used for a block of text that needs to be indented in relation to its parent.

-xpp-export-class ″class″ of this element, as reported by the XML export program.

Initial value none Inherited? no

Syntax string | none

Value Description string For tags that are like paragraphs, use ″para″. none If this value is used, the XML export programs will use the name of the current element as the XPP export class.

-xpp-ascender-lead The -xpp-ascender-lead property, when specified, overrides the line-height property to specify the leading above the baseline.

Initial value none Inherited? yes

Syntax length |% (font-size) | none | normal | inherit | attr()

Value Description length Sets the ascender leading to the given . For example, 10pt.

% Sets the ascender leading to a percentage of the current . none Sets zero ascender leading. normal Sets the ascender leading based on the ascender height % in the current font variant spec. inherit Inherits this property value from its parent element. attr(name length | unit | Refer to the CSS3 attr() function section. [,fallback])

3-32 CSS Fundamentals Styling Content with CSS XPP-Supported CSS Properties

-xpp-descender-lead The -xpp-descender-lead property, when specified, overrides the line-height property to specify the leading below the baseline.

Initial value none Inherited? yes

Syntax length |% (font-size) | none | normal | inherit | attr()

Value Description length Sets the descender leading to the given . For example, 10pt.

% Sets the descender leading to a percentage of the current . none Sets zero descender leading. normal Sets the descender leading based on the descender height % in the current font variant spec. inherit Inherits this property value from its parent element. attr(name length | unit | Refer to the CSS3 attr() function section. [,fallback])

-xpp-extra-lead The -xpp-extra-lead property sets the value of leading between lines, in addition to the ascender and descender leading.

Initial Value none Inherited? yes

Syntax length | % of font size | none | inherit | attr()

Value Description length For example, -xpp-extra-lead: 2pt; will add two points of XPP extra lead to each line of text within this element

% Added extra leading as a percentage of the font size. none No extra leading. inherit Inherits this property value from its parent element. attr(name length|unit[,fallback]) Refer to the CSS3 attr() function section.

Styling Content with CSS CSS Fundamentals 3-33 XPP-Supported CSS Properties

-xpp-font-width The –xpp-font-width property extension is used to specify a font width that is different from the font height.

Initial Value same Inherited? no

Syntax length | % of font size | same | inherit | attr()

Value Description length Font width value in units.

% Font width as a percentage. same Font width is the same as the font height. inherit Inherits this property value from its parent element. attr(name length|unit[,fallback]) Refer to the CSS3 attr() function section.

-xpp-hj-table Select a H&J table to control hyphenatin and justification

Initial Value 1 Inherited? yes

Syntax integer | inherit | attr()

Value Description integer Table number from the Hyphenation/Justication (HJ) spec. inherit Inherits this property value from its parent element. attr(name integer[,fallback]) Refer to the CSS3 attr() function section.

-xpp-hung-punc-table Selects a table from the Hung Punctuation spec that orerrides that table that is currently in effect for automatic hung punctuation.

Initial Value none Inherited? yes

Syntax integer | none | inherit | attr()

Value Description integer A table number from 1-254. 0 turns off hung punctuation. none Disable hung punctuation. inherit Inherits this value property from the parent element. attr(name integer[,fallback]) Refer to the CSS3 attr() function section.

3-34 CSS Fundamentals Styling Content with CSS XPP-Supported CSS Properties

-xpp-hyphenation-language Selects the language for hyphenation and justification when multiple languages appear in the same document.

Initial Value 1 Inherited? yes

Syntax integer | inherit | attr()

Value Description integer Language number as defined in the Job Ticket. inherit Inherits this property value from the parent element. attr(name integer[,fallback]) Refer to the CSS3 attr() function section.

-xpp-kerning-track Specifies the kerning track number to use with text

Initial Value 1 Inherited? yes

Syntax 1...4 | inherit | attr()

Value Description

1...4 The track number. inherit Inherits this property value from the parent element. attr(name integer[,fallback]) Refer to the CSS3 attr() function section.

-xpp-lines-above-accept Controls the acceptable humber of lines above the head if the -xpp-widow-type is ″head″; at the top of the next block if the -xpp-widow-type is ″para″.

Initial Value 0 Inherited? no

Syntax integer | inherit | attr()

Value Description integer Number of acceptable lines above. inherit Inherits this property value from the parent element. attr(name integer[,fallback]) Refer to the CSS3 attr() function section.

Styling Content with CSS CSS Fundamentals 3-35 XPP-Supported CSS Properties

-xpp-lines-above-preferred Controls the preferred number of lines agove the head if the -xpp-widow-type is ″head″; at the top of the next block if the -xpp-widow-type is ″para″.

Initial Value 0 Inherited? no

Syntax integer | inherit | attr()

Value Description integer Number of preferred lines above. inherit Inherits this property value from the parent element. attr(name integer[,fallback]) Refer to the CSS3 attr() function section.

-xpp-lines-below-accept Controls the acceptable lines below the head if the -xpp-widow- type is ″head″; at the bottom of the current block if the -xpp- widow-type is ″para″.

Initial Value 0 Inherited? no

Syntax integer | inherit | attr()

Value Description integer Number of acceptable lines below. inherit Inherits this property value from the parent element. attr(name integer[,fallback]) Refer to the CSS3 attr() function section.

-xpp-lines-below-preferred Controls the preferred number of lines below the head if the -xpp-widow-type is ″head″; at the bottom of the current block if the -xpp-widow-type is ″para″.

Initial Value 0 Inherited? no

Syntax integer | inherit | attr()

Value Description integer Number of preferred lines below. inherit Inherits this property value from the parent element. attr(name integer[,fallback]) Refer to the CSS3 attr() function section.

3-36 CSS Fundamentals Styling Content with CSS XPP-Supported CSS Properties

-xpp-margin-top-keep Keep the margin-top value if at the top of the block. This property specifies whether or not the margin-top value should be preserved at the top of the current block. This property is equivalent to the second argument in the Ô lp  xymacro.

Initial Value no Inherited? no

Syntax yes | no | inherit

Value Description yes Keep the margin-top value. Add in the extra space. no Suppress the margin-top value. inherit This property is inherited from the parent element.

The margin-top property equates to the XPP prelead value and is implemented using the Ô lp  macro. However, the space is normally suppressed at the top of the block. The –xpp-margin-top-keep property extension, if enabled, will disable the suppression and force the margin-top value to also be observed at the top of the block. This includes pseudo, or generated blocks. These settings would also affect vertical spacing of the element following a placed pickup block.

-xpp-max-lead-expansion Set the maximum amount of lead expansion (white space) that composition can add to or subtract from the line when justifying the block vertically.

Initial Value none Inherited? no

Syntax length | % of margin-top | none | inherit | attr()

Value Description length Qualified value such as 12pt

% Percentage of margin-top value or prelead. none inherit Inherits this property value from the parent element. attr(name length|unit[,fallback]) Refer to the CSS3 attr() function section.

-xpp-page-column-rule Select a rule from the Page Column Override (PC) spec that overrides the current page layout.

Initial Value 1 Inherited? yes

Syntax integer | span | normal | inherit | attr()

Styling Content with CSS CSS Fundamentals 3-37 XPP-Supported CSS Properties

-xpp-page-column-rule Select a rule from the Page Column Override (PC) spec that overrides the current page layout.

Value Description integer 1=normal, 255=span, other integers are limited to 2-254 span The column should span a group of like columns. normal Revert back to the default page layout in effect. inherit Inherits this property value from the parent element. attr(name integer[,fallback]) Refer to the CSS3 attr() function section.

-xpp-page-style-table Selects a table of rules from the Pagination Style (PS) spec, which control the sequence in which composition uses the defined page layouts.

Initial Value 0 Inherited no

Syntax integer | inherit | attr()

Value Description integer Table number in the current Pagination Style (PS) spec. inherit Inherits this property value from the parent element. attr(name integer[,fallback]) Refer to the CSS3 attr() function section. xpp-pair-kerning Controls automatic pair kerning

Initial Value yes Inherited? yes

Syntax yes | no | inherit| attr()

Value Description yes Enable pair kerning. no Disable pair kerning. inherit Inherits this property value from the parent element. attr(name integer[,fallback] Refer to the CSS3 attr() function section.

3-38 CSS Fundamentals Styling Content with CSS XPP-Supported CSS Properties

-xpp-pattern Specify a percentage of tint from 0 to 100 to create tinted text.

Initial Value normal Inherited? yes

Syntax integer | normal | none | inherit | attr()

Value Description integer Ingteger values are 0 to 100, corresponding to tint %. 0, 100, and normal are all equivalent: 100% tint (solid). normal Use the default tint specified in the Page Layout spec. none No tint is applied. inherit Inherits this property value from the parent element. attr(name integer[,fallback]) Refer to CSS3 attr() function section.

-xpp-underline-style Starts and ends text underlining.

Initial Value none Inherited? yes

Syntax 1..10 | none | inherit | attr()

Value Description

1...10 Numbers 1-10 correspond to the underline rule records as listed in the division ticket. none No underline style is applied. inherit Inherits this property value from the parent element. attr(name integer[,fallback]) Refer to the CSS3 attr() function section.

-xpp-vertical-band-priority Marks an element before which composition can add or subtract white space in order to justify the block. This sets the priority of the adjustment point.

Initial Value auto Inherited? no

Syntax 1..10 |auto | inherit | attr()

Value Description

1...10 Priority of the adjustment point. auto The value is unchanged; XPP ignores it for VJ purposes.

Styling Content with CSS CSS Fundamentals 3-39 XPP-Supported CSS Properties

-xpp-vertical-band-priority Marks an element before which composition can add or subtract white space in order to justify the block. This sets the priority of the adjustment point.

Using the auto value stops XPP from invoking the XyMacro. The whitespace value comes from the –xpp-max-lead-expansion CSS value, and the priority comes from the –xpp-vertical-band-priority CSS value. These two values are always changed together (when set by a start tag), they are not changed independently. However, if the –xpp-vertical-band-priority is set to auto, XPP will not call the XyMacro, so it does not matter what the –xpp-max-lead- expansion value is set to. The value of the property is ignored, the prevailing vertical band priority, and max lead expansion for the line remains unchanged. inherit Inherits this property value from the parent element. attr(name integer[,fallback]) Refer to the CSS3 attr() function section.

-xpp-widow-type Marks an element as a widow/orphan type.

Initial Value none Inherited? yes

Syntax none | head | para | inherit

Value Description none No widow/orphan control for this element. head The current element is marked as a head and all lines will keep together until the widow/orphan type changes. para The element is to be treated as a paragraph and subject to widow/orphan control. inherit Inherits this property value from the parent element.

-xpp-xref-mark Marks a spot in the text as the target of a cross-reference.

Initial Value none Inherited? no

Syntax | attr(name) | none

Value Description

The specified string is set as the name of the marked spot, which can be used to reference the spot using the -xpp-xref-refer property. attr(name) The value of the specified name attribute of the target element is

3-40 CSS Fundamentals Styling Content with CSS XPP-Supported CSS Properties

-xpp-xref-mark Marks a spot in the text as the target of a cross-reference.

set as the name of the marked spot, which can be used to reference it using the -xpp-xref-refer property. none No name is set for the marked spot.

-xpp-xref-refer References a cross-reference target defined with the -xpp-xref-mark property, or a named story, footnote, or pickup. Accepts one required attribute: name, and three optional attributes: type, occur, and xreg.

Initial Values none spot this none Inherited? no

Syntax

Attribute Value Description name References the target marked as a cross-reference named string.

attr(name) References the target marked as a cross-reference with a name that equals the value of the specified name attribute of the referencing element.

none Does not reference any target. type spot References a marked spot in the text.

story References a named story.

foot References a named footnote.

pick References a named pickup. occur this References this occurrence of the target.

first References the first occurrence of the target.

prev References the previous occurrence of the target.

last References the last occurrence of the target. xreg 1001-8744 The starting x-register number into which to save the current value of the number registers 1 through 255.

none Does not save number register values into x-registers.

Styling Content with CSS CSS Fundamentals 3-41 XPP-Supported CSS Properties

3-42 CSS Fundamentals Styling Content with CSS Chapter 4

Practical CSS

This chapter explains the following:

• Generated Text and Pseudo-Elements • Accessing Perl • CSS Lists • CSS Tables • CSS Fonts • CSS Cross-referencing

Styling Content with CSS Practical CSS 4-1 Generated Text and Pseudo-Elements

...... Generated Text and Pseudo-Elements

Pseudo-elements let you specify formatting instructions or behavior on a tag to generate content, which can appear before or after an existing element’s content. Generated content is usually a string, but can also include quotation marks, graphics, attribute values, and counters.

Refer to ″Counters″ on Page 4-7 for information on implementing counters. You should also understand basic tag selectors and pseudo-elements. Refer to the following for related information: • ″CSS Tag Selectors″ on Page 3-4, • http://www.w3.org/TR/CSS2/selector.html#pseudo-elements

You use pseudo-elements to add content before or after a tag element. The content: property of the :before or :after pseudo-element selector allows generated text to be inserted.

Note: The :before and :after pseudo-elements must be the last entry within a CSS selector; whereas a Structural Pseudo-Class (such as :first-child or :first-of-type) can appear anywhere within a selector.

Syntax

A pseudo-element uses the following format: selector:pseudo-element {property:value;}

As composition processes content (delimited by start and end tags), style is applied to that content based on the tag’s CSS rule. If a matching selector has a :before or :after pseudo-element, the corresponding CSS rules are applied to any text generated by the content: property.

When a start tag (for example, () is processed, and there is a matching para:before selector, the CSS properties in the para:before selector are applied to any text, which is generated by the content: property. After the generated text, style is restored to that specified for the para tag.

When an end tag (for example, ) is processed, and there is a matching para:after selector, the CSS properties in the para:after selector are applied to any text generated by the content: property. After the generated text, style is restored to the style of the parent tag.

4-2 Practical CSS Styling Content with CSS Generated Text and Pseudo-Elements

Note: In CSS-XML composition mode, an empty tag can generate a marked fragment of , which is visible in the XyView in Text mode, and also in the Line Editor. Note that the duplicate coding is not visible in the XyView in Page mode. This occurs only when there is a:before or:after pseudo-element used in the tag selector, or when the tag is defined as an-xpp-macro when there is a start or end macro defined in the XX spec with a non-empty expansion. If this content is copied and then pasted into a text editor, or if the content is exported (fromxsf or export), then the ″duplicate″ start and end tags are dropped.

The marked fragment will also get created if the empty tag sets a margin- left, margin-right or vertical-align property in the CSS.

Examples

• A tag with a class attribute named .caution that generates a the string ″Caution: ″ in a slightly larger, red typeface before any other text.

The CSS

para.caution:before { font-weight: bold; font-size:1.2em; color:red; content: ″Caution: ″; }

para.caution { font-weight: normal; color:black; }

The XML Tagging

Your text goes here.

The Output Caution: Your text goes here.

Styling Content with CSS Practical CSS 4-3 Generated Text and Pseudo-Elements

• A tag that includes the sdl class to add the SDL corporate logo at the top of a letter.</p><p>The CSS title.sdl:before { content: url(″sdl.png″); } title.sdl { font-weight: normal; color:black; }</p><p>The XML Tagging</p><p><title class=″sdl″>A corporate logo precedes the text of this content block.

The Output

A corporate logo precedes the text of this content block.

• Opening and closing quote marks that envelop a content block.

The CSS q:before { content: open-quote; } q:after{ content: close-quote; }

The XML Tagging Eat your fruits and veggies

4-4 Practical CSS Styling Content with CSS Generated Text and Pseudo-Elements

The Output

″Eat your fruits and veggies″

• A title element with an attr attribute.

The CSS

title:before { content: attr(subject); }

title { font-weight: normal; color:black; }

The XML Tagging

<para>This is the para.</para></p><p>The Output This is the title. This is the para.</p><p>Structural Pseudo-Classes</p><p>• A first-child pseudo-class that formats the first child li of an unordered list in a red typeface: ul > li:first-child { color: red; } • An nth-child pseudo-class that formats the third child li of an unordered list in a blue typeface: ul > li:nth-child(3){ color: blue; } • An nth-child pseudo-class that formats the 1st, 4th, 7th, { child li of an unordered list in a blue typeface: ul > li:nth-child(3n+1){ color: blue; }</p><p>Styling Content with CSS Practical CSS 4-5 Generated Text and Pseudo-Elements</p><p>• A first-of-type pseudo-class that formats the first even li child of an unordered list in a green typeface: ul > li:first-of-type (even){ color: green; } • An nth-of-type(odd) pseudo-class that formats every odd li child of an unordered list in a small-caps typeface: ul > li:nth-of-type(odd){ font-variant: small-caps; } • An nth-of-type(3n-1) pseudo-class that formats the 2nd, 5th, 8th, { li children of an unordered list in small-caps typeface: ul > li:nth-of-type(3n-1) { font-variant: small-caps; }</p><p>4-6 Practical CSS Styling Content with CSS Generated Text and Pseudo-Elements</p><p>Counters</p><p>Counters let you increment and reset variables using CSS rules. Counter values are output using the counter()function of the CSS content: property.</p><p>Syntax • counter(name, list-style-type) where the optional list-style-type argument (defaults to decimal) can be decimal, decimal-leading-zero, lower- roman, upper-roman, lower-greek, lower-latin, upper- latin, armenian, georgian, lower-alpha, or upper-alpha. Also includes any of the -xpp- list style types. • counters(name, ″string″, list-style-type) The generated text is the value of all counters with the given name in scope at this pseudo-element, from outermost to innermost, separated by the specified string.</p><p>Tip! Refer to ″User Styled List Examples ″ on Page 4-22 for more information about CSS counters, the counter-reset and counter-increment properties and their use in ordered lists, headers, and titles, as well as their association with XPP’s number registers.</p><p>Styling Content with CSS Practical CSS 4-7 Accessing Perl</p><p>...... Accessing Perl</p><p>CSS provides extensive formatting capabilities. However, there are many formatting capabilities inherent in native XPP that you may want to access in conjunction with your CSS style development. You access this functionality through XPP extensions to CSS.</p><p>Important!</p><p>The style ″bundle″ name in a CSS-XML division is used in the Perl script (.pl) at the package; line. In this case, the bundle name must be a valid Perl identifier composed of any combination of letters, digits, and underscores. Also, the Perl identifier must start with a letter or an underscore.</p><p>Perl in CSS Selectors</p><p>When XPP encounters a :before or :after pseudo-element that includes a content: property value that contains –xpp-perl, then XyPerl will be called to perform a composition function.</p><p>Perl Best Practices This section explains syntax guidelines that you should follow when calling Perl from CSS. Nested Parentheses Nested parentheses are not allowed inside the –xpp-perl({) CSS function • Allowed: -xpp-perl(myfunc); • Not Allowed: -xpp-perl(myfunc()); • Allowed: -xpp-perl(myfunc,arg1,arg2); • Not Allowed: -xpp-perl(myfunc(arg1,arg2));</p><p>4-8 Practical CSS Styling Content with CSS Accessing Perl</p><p>Quote Marks</p><p>Any -xpp-perl arguments that contain non-alphabetic characters must appear in quotes. To avoid confusion, we recommend that you use quotes around all -xpp-perl arguments and standardize on either ’single’ or ″double″ quotes, although the following are acceptable:</p><p>Valid examples include the following: • –xpp-perl(myfunc,’arg’,’12’); • –xpp-perl(myfunc,”arg”,”12”); • –xpp-perl(myfunc,’arg’,”12”); • –xpp-perl(myfunc,″arg″’,’12’);</p><p>To pass open and close parenthesis characters and a copyright symbol as three separate arguments, you would use the following call: –xpp-perl(myfunc,’(’,’)’,’\00A9’);</p><p>When using double quotes, you do not have to escape Unicode characters or parentheses when they are characters within a string that is passed as an argument. The following example depicts a string with a copyright symbol inside parentheses (©):</p><p>-xpp-perl(myfunc,”This is my string with a copyright symbol inside parentheses (\00A9)”);</p><p>However, the comma presents a problem. Although an unescaped (or escaped) comma would be passed through to your Perl function, it would be difficult for Perl to process it because commas separate Perl arguments. Therefore, the best way to pass a literal comma as part of a single string is by using a numeric character reference. For example: 2c in hexadecimal is a comma. This string example depicts the following: © 1974, by Hedley Lamarr. (All rights reserved).</p><p>-xpp-perl(myfunc,″\00A9 1974, by Hedley Lamarr. (All rights reserved).″);</p><p>Styling Content with CSS Practical CSS 4-9 Accessing Perl</p><p>Special Arguments to the ″-xpp-perl″ Function</p><p>Typically, the first argument in the -xpp-perl(<function>,<arg1>, ... <argn>) expression is the name of a XyPerl subroutine in the <bundle>.pl file. However, there are some special reserved words, which can be used as the first argument: • -xpp-perl(xymacro, <macro_name>, [<macro_arg1>, ...<macro_argn>]) can be used to invoke an XPP XyMacro. • -xpp-perl(qalz) can be used to invoke a ″quad appropriate, followed by a zero lead.″ • -xpp-perl(xppattr,sh|ff}fw|fv|...) can be used to add an attribute to the currently open tag in the Markup Language Header. This expression is functionally equivalent to: -xpp-perl(xymacro,xppattr,sh|ff|fw|fv...) This XyMacro is predominantly used to permit CSS styling in CALS table cells as implemented in the cals_table.css and cals_t5.css files delivered by the XPP installation. See XML Professional Publisher: XyMacros for a description of the xppattr XyMacro.</p><p>These special uses are shown in the examples throughout this chapter.</p><p>Perl Examples</p><p>A Perl function that prints a Warning note with a Radiation image in magenta that precedes a para with a type of ″radiation_warning.″</p><p>The CSS para[type=″radiation_warning″]:before{ content: -xpp-perl(rad_warn_note); color:magenta }</p><p>The XML Tagging <para type=″radiation_warning″>Lead shielding must be at least 4mm in thickness to stop gamma radiation.</para></p><p>The Perl (in <bundle>.pl) package <bundle>; ...</p><p>4-10 Practical CSS Styling Content with CSS Accessing Perl</p><p>#output radiation warning image and text sub rad_warn_note { my $X= XPPcompo->new(); #<igt;name;w;d;process;quad;scale> $X->igt(’radiation.png’,’’,’’,’’,’c’,’250’); $X->set_text(’WARNING’);$X->qc();}</p><p>The Output</p><p>WARNING Lead shielding must be at least 4mm in thickness to stop gamma radiation.</p><p>XyMacros in CSS</p><p>XPP implements certain features, such as math and tabular composition, using its built-in XyMacros. To facilitate this, you would use the -xpp-macro value for the display: property, as follows:</p><p>/* Default XPP rule to implement CALS tables */ /* and MATHML as macros. */</p><p> table, tgroup, colspec, spanspec, row, entry, thead, tbody, math { display:-xpp-macro; }</p><p>This results in all (CALS tabular) elements being processed using the XPP built-in tabular XyMacros. In the case of the math element (MathML), it is only necessary to use the –xpp-macro method for the “math” element, as all the child elements are automatically handled by XPP’s MathML processing.</p><p>Recommendation! The intent of the -xpp-macro value for the display: property is to allow you to continue to use pre-existing XyMacros, which you may have already developed. We do not recommend using this value for new development; rather, we recommend using Perl (described earlier in this section ), which also permits access to XyMacros, but without the limitations of -xpp-macro.</p><p>Important! When a CSS tag is treated as a macro and that macro changes text styling, the text style will not automatically reset the end tag </tag> to the typeface and font characteristics that were in effect before the tag was</p><p>Styling Content with CSS Practical CSS 4-11 Accessing Perl</p><p> called. It is the macro developer’s responsibility to restore the desired text styling before the macro call returns to CSS styling. The special characters at the beginning of the macro expansion can be used to control the ending word (!) or line (*) conditions.</p><p>Example: Macro with parameters</p><p>If the first argument to an –xpp-perl()call is the reserved word xymacro. XPP will pass the next parameter as the macro or XyMacro name, and the remaining parameters as the arguments for that macro or XyMacro.</p><p>In this example, a XyPerl macro pass-through prints a content block in a black, italic typeface inside a box.</p><p>The CSS chap > para:nth-child(13):before{ color: black; font-style: italic; content: -xpp-perl (xymacro,sbt,’1pt’,’1pc’,’1pc’) } chap > para:nth-child(13):after{ content: -xpp-perl(xymacro,ebt); }</p><p>The XML Tagging <para>I am the (unlucky) 13th child!</para></p><p>The Output</p><p>I am the (unlucky) 13th child!</p><p>XyPerl in Processing Instructions</p><p>When XPP encounters a processing instruction, <?pi?>, it first searches for a Perl function by that name and it employs XyPerl to implement that instruction, assuming it exists.</p><p>If a Perl function or subroutine by that name cannot be found, it then searches for the processing instruction as a macro. If no such macro is found, a composition error will be logged.</p><p>4-12 Practical CSS Styling Content with CSS Accessing Perl</p><p>Example A processing instruction that executes a Perl routine to print yesterday’s date.</p><p>Styling Content with CSS Practical CSS 4-13 Accessing Perl</p><p>The Perl use Date::Manip; ... sub get_date{ my (%args) = @_; my $date = ParseDate($args{fmt}); if(! $date){ print STDERR ″error processing date, fmt: $args{fmt}<qa>″; } else { print STDOUT UnixDate($date, ″%u″); } }</p><p>The XML Tagging <para>The date yesterday was <?get_date fmt=’yesterday’?> </para></p><p>The Output The date yesterday was Tue Nov 12 15:52:53 GMT 2013.</p><p>Chaining XyPerl Functions This example shows how to use the :before and :after CSS pseudo- elements to chain multiple Perl functions.</p><p>The CSS testgroup:before { color:blue; font-family: ″Courier″; content: -xpp-perl(start_box,″green″) ″Testing property: ″ attr(property) -xpp-perl(end_box); } testgroup:after { color:blue; font-family: ″Courier″; content: -xpp-perl(start_box,″cyan″) ″End testing: ″ attr(property)</p><p>4-14 Practical CSS Styling Content with CSS Accessing Perl</p><p>-xpp-perl(end_box) }</p><p>The Perl package attr; my $X; BEGIN { $X=XPPcompo->new(); } # # -xpp-perl(start_box, ’color’) # # start drawing a box, in specified color # sub start_box { my ($color) = @_; $X->sfboxt(″50″,″$color″);#50% density } # # -xpp-perl(end_box) # # end drawing box # sub end_box { $X->efboxt(); $X->set_text(″ ″); $X->qa(); }</p><p>The XML <testgroup property=″color+pattern″> <para color=″red″ pattern=″foo″>Some text here.</para> <para color=″59″ pattern=″75″>Some more text here.</para> <para color=″foo″ pattern=″50″>Some more text here.</para> </testgroup></p><p>The Output</p><p>Styling Content with CSS Practical CSS 4-15 CSS Lists</p><p>...... CSS Lists</p><p>CSS lists can take two forms: ordered (numbers or letters) or unordered (bullets). Furthermore, a list can be styled at one or more hierarchical levels, using the same or a different style. In addition to CSS list properties and functions (rules), ordered lists are implemented using XPP’s number registers to dynamically track counter values. Lists in XPP can be ″simple″ lists (minimal styling) or ″user-defined″ lists, where you explicitly specify the styling.</p><p>Simple Lists</p><p>With simple lists, you need only specify the display:list-item and list-style-type rules to control the list marker. As the default list-style-position is ″outside″ (where the list marker ″hangs″ outside the margin), you must also enter a margin-left value that can accommodate the list marker plus any desired whitespace following it, typically 1em or 1.5em. You do not need to specify a counter name as XPP automatically tracks the position of XML tags using its built-in _number counter register.</p><p>Simple lists work well for bulleted lists or numbered lists that start at 1 and increment by 1 at each list item. They also work well when the list-style-type fits one of the available values.</p><p>User-Defined Lists</p><p>With user-defined lists, you must set up and maintain unique named counters for counting list items. You must also define a <list- item>:before rule content string, which controls exactly what content is generated for each list item marker.</p><p>You specify list styles using the following CSS properties: • display: list-item • list-style-type • list-style-position • list-style-image</p><p>4-16 Practical CSS Styling Content with CSS CSS Lists</p><p>Formatting Lists</p><p>You use the following list-style-type property values to format lists:</p><p>Unordered List:|disc|circle|square|</p><p>Ordered List: |decimal|decimal-leading-zero| lower-roman|upper-roman|lower-greek|lower-latin| upper-latin|armenian|georgian|lower-alpha|upper-alpha|</p><p>XPP Ordered List: |-xpp-ans|-xpp-anss|-xpp-anzz| -xpp-lower-aio|-xpp-upper-aio|-xpp-ia|-xpp-ias| -xpp-iass|-xpp-iaz|-xpp-iazz|-xpp-ie|-xpp-ies| -xpp-iess|-xpp-iez|-xpp-iezz|-xpp-id| -xpp-ids| -xpp-idss|-xpp-idz|-xpp-idzz|</p><p>Additionally, you can use the list-style-image property to use a graphic in an unordered list. By default, list markers (numbers or symbols) are positioned outside the list. You can explicitly use the list-style-position property to position the list markers using one of the following values: inside|outside.</p><p>Simple List Examples</p><p>An unordered list can include one or more levels of content, and is implemented using CSS rules. An ordered list can include one or more levels of steps, which are implemented automatically by employing built-in counters.</p><p>Note: If you do not supply a name for a user-defined counter, XPP uses its built-in _number named counter to count XML elements. Furthermore, unlike a user- defined counter, you cannot change the _number counter value. The _number named counter is the same as the value of the “position” of the element, which is also accessible in XPP using the %number system variable.</p><p>Tip! Although HTML uses <ul> for an unordered list container element and <ol> for an ordered list container element, with <li> as the list item element, you are free to use any tag names in XML, as long as they are defined in the DTD or schema that enforces the rules for your publication.</p><p>Styling Content with CSS Practical CSS 4-17 CSS Lists</p><p>Example 1: Simple Lists</p><p>This example of a nested, unordered list depicts a solid circle on the parent-level list items and an open circle on child-level list items. Furthermore, the parent-level list items have extra leading. This example assumes that you have installed fonts that render the following Unicode characters: solid circle U+2025 and open circle U+25E6.</p><p>The CSS para, ul{ display: -xpp-line; } /* non-top-level lists use circle */ para ul > li{ list-style-type: circle; } /* top level lists use bullet, extra leading */ para > ul > li { margin-top: 2pt; list-style-type: disc; } ul > li { display: list-item; margin-left: 1em; }</p><p>4-18 Practical CSS Styling Content with CSS CSS Lists</p><p>The XML Tagging</p><p><para>XPP supports four processing modes: <ul> <li>Classic <ul> <li>Classic mode feature 1</li> <li>Classic mode feature 2</li> <li>Classic mode feature 3</li> </ul> </li> <li>SGML <ul> <li> SGML mode feature 1</li> <li> SGML mode feature 2</li> <li> SGML mode feature 3</li> </ul> </li> <li>XML <ul> <li> XML mode feature 1</li> <li> XML mode feature 2</li> <li> XML mode feature 3</li> </ul> </li> <li>CSS-XML <ul><li> CSS-XML mode feature 1</li> <li> CSS-XML mode feature 2</li> <li> CSS-XML mode feature 3</li> </ul> </li> </ul> </para></p><p>Styling Content with CSS Practical CSS 4-19 CSS Lists</p><p>The PDF Output</p><p>XPP supports four processing modes:</p><p>• Classic o Classic mode feature 1 o Classic mode feature 2 o Classic mode feature 3 • SGML o SGML mode feature 1 o SGML mode feature 2 o SGML mode feature 3 • XML o XML mode feature 1 o XML mode feature 2 o XML mode feature 3 • CSS-XML o CSS-XML mode feature 1 o CSS-XML mode feature 2 o CSS-XML mode feature 3</p><p>Example 2: User-styled list</p><p>This example shows a bulleted list where an attribute on the li tag generates a right-arrow symbol instead of a bullet. The Unicode character \21d2 renders a right arrow, and the -xpp-perl(qalz); argument quads and zero-leads the line so that the arrow is positioned on the same baseline as the content. The greaterthan class on the second list item overrides the format specified on the list’s container element.</p><p>4-20 Practical CSS Styling Content with CSS CSS Lists</p><p>The CSS para, ul { display: -xpp-line; } /* default behavior is to display a bullet, hanging indent of 1em */ para > ul.example2 li{ display: list-item; list-style-type: disc; margin-left: 1em; } /* If li class=″greaterthan″, generate right arrow list marker*/ para > ul.example2 > li.greaterthan:before { content: ″\21d2″ -xpp-perl(qalz); }</p><p>The XML Tagging <para> <ul class=″example2″> <li>This is the first item in a bulleted list</li> <li class=″greaterthan″>This is the second item in a bulleted list</li> <li>This is the third item in a bulleted list</li> </ul> </para></p><p>The Output</p><p>• This is the first item in a bulleted list</p><p>-> This is the second item in a bulleted list</p><p>• This is the third item in a bulleted list</p><p>Styling Content with CSS Practical CSS 4-21 CSS Lists</p><p>Example 3: simple numbered list</p><p>This example of a DITA topic would ordinarily be formatted by the DITA Open Toolkit when published. In XPP, however, the CSS style sheet is used to format the topic.</p><p>The CSS</p><p> steps { list-style-type: decimal; } step { display: list-item; margin-left: 1.5em; }</p><p>The XML Tagging <steps> <step> <cmd>This is the first step in a procedure.</cmd> </step> <step> <cmd>This is the second step in a procedure.</cmd> </step> </steps></p><p>The Output</p><p>1. This is the first step in a procedure.</p><p>2. This is the second step in a procedure.</p><p>User-Styled List Examples</p><p>You can specify your own counter names to implement ordered lists, which will automatically handle the sequencing of nested, numerical items. You must enter counter-reset and counter-increment properties in the CSS selectors of the list container and list item tags.</p><p>To render the named counter appropriately, you must enter either the counter(name, style) or counters(name, string, style) function and values in a :before pseudo-element of the list item tag.</p><p>Note: When you specify a named CSS counter, XPP maps the counter to one of its internal number registers. When you do not specify a counter name, XPP reserves the named counter _number for the default implementation of list numbering.</p><p>4-22 Practical CSS Styling Content with CSS CSS Lists</p><p>For each named counter, an XPP number register is allocated and assigned the value of the named counter. The first reference to a named counter assigns it to number register 255. Subsequent new counter names will allocate number registers counting backwards from 255 down to 7 (number registers 1-6 are reserved for tracking multi-part page numbering).</p><p>Tip! Use the counters(name, string, style)function when you want a list marker, such as 2.5.7.3, where each number represents the corresponding value of the named counter at each parent level of a (nested) list item. Use the counter(name) function when you want a list marker that outputs only a single number, which is the value of the named counter at the current nesting level.</p><p>Example 1: multi-level numbered list</p><p>In this example, a nested list marker is formed from the number of the parent list item, followed by a period, followed by the number of the current list item.</p><p>Tip! You cannot use the _number counter register with the counters() function; therefore, you will instead have to employ a user-specified named counter.</p><p>The CSS ol { display: -xpp-line; list-style-type: decimal; counter-reset: mycount; } ol li { display: list-item; margin-left: 2em; counter-increment: mycount; } ol li:before { content: counters(mycount,″.″,decimal) ″″; }</p><p>Styling Content with CSS Practical CSS 4-23 CSS Lists</p><p>The XML Tagging</p><p><para>To create a numbered procedure:</para> <ol> <li>This is the first step of the procedure. <ol> <li> This is a sub step of the procedure.</li> </ol> </li> <li>This is the second step of the procedure.</li> <li>This is the third step of the procedure.</li> </ol></p><p>The Output</p><p>To create a numbered procedure:</p><p>1 This is the first step of the procedure 1.1 This is a sub step of the procedure. 2 This is the second step of the procedure. 3 This is the third step of the procedure.</p><p>Note: Because the counters(name, string, style) function is being used to display the counter value, this example employs the user-specified named counter named mycount.</p><p>Example 2: user styled multi-level list</p><p>In this example, the user-specified counter mycounter counts list items at three nested levels. The top-most counter starts at three, whereas counters at nested levels start at one.</p><p>4-24 Practical CSS Styling Content with CSS CSS Lists</p><p>The CSS</p><p> ol { counter-reset: mycounter 2; } ol ol { counter-reset: mycounter; } li { display: list-item; margin-left: 1em; } li:before { counter-increment: mycounter; content: counter(mycounter, upper-roman) ″″; }</p><p>The XML Tagging</p><p><para>A nested, numbered list:</para> <ol> <li>This is the first outermost nested level. <ol> <li> This is the second nested level of the first list item.</li> <li> This is the second nested level of the first list item.</li> <li> This is the second nested level of the first list item. <ol> <li>This is the third nested level of the first list item.</li> <li>This is the third nested level of the first list item.</li> <li>This is the third nested level of the first list item.</li> </ol> </li> <li> This is the second outermost nested level.</li> <li> This is the second outermost nested level.</li> <li> This is the second outermost nested level.</li> </ol> </li> </ol></p><p>Styling Content with CSS Practical CSS 4-25 CSS Lists</p><p>The Output</p><p>A nested, numbered list:</p><p>III This is the first outermost nested level. I This is the second nested level of the first list item. II This is the second nested level of the first list item. III This is the second nested level of the first list item. I This is the third nested level of the first list item. II This is the third nested level of the first list item. III This is the third nested level of the first list item. IVThis is the second outermost nested level. V This is the second outermost nested level. VI This is the second outermost nested level.</p><p>4-26 Practical CSS Styling Content with CSS HTML5 Tables</p><p>...... HTML5 Tables</p><p>Overview It is no longer necessary to transform HTML5 tables into either CALS or XPP tabular markup. When you add @import url(’html_table.css’); to the beginning of your CSS stylesheet, XPP does the following:</p><p>• matches all HTML table tags, and invokes a corresponding html_<tag> XyMacro from the <tag>:before pseudo-element. • uses html_<tag> XyMacros to transform HTML5 table tags into XPP tabular primitive XyCodes.</p><p>Note: The html_<tag> XyMacros reside in the _xy_sys.sde in the Lsyslib library.</p><p>HTML5 tables are styled using CSS, tabular specs (t1-t5), and (optional) CALS-like attributes. Using the attributes described in the ″Tabular Attributes″ section, you can use the skills you acquired developing CALs tables to create HTML5 tables.</p><p>Well-Formed HTML5 XPP can only process well-formed XML. If you import HTML5 tables into XPP, they must adhere to structured XML syntax.</p><p>• Use only lower-case element and attribute names • Close empty elements with an end tag or with a trailing / character. • Nest elements properly • Include, and quote, attribute values • Specify certain characters as entities</p><p>To use this character Enter this</p><p>& &</p><p>< <</p><p>> ></p><p>Styling Content with CSS Practical CSS 4-27 HTML5 Tables</p><p>Tabular Attributes In HTML5, all tabular attributes are deprecated, in turn, they will not be supported in XPP. Instead, XPP supports a set of tabular attributes similar in function to the CALS tabular attributes. They have an xpp: prefix to uniquely identify them. For example, to format a 5-column HTML5 table with no column rules and only top and bottom box rules, you would enter the following: <table xpp:frame=″topbot″ xpp:cols=″5″ xpp:colsep=″0″></p><p>CALS-like Attributes</p><p>Attribute Elements Allowable Values Default Value</p><p> xpp:tabstyle table Valid XPP style html (XPP table style) bundle</p><p> xpp:cols table 1-127 100 (number of columns)</p><p> xpp:frame table all, bottom, none, html t3 value (table box rules) sides, top, topbot</p><p> xpp:colsep table, tr, td, th 0=off, 1=on, html t3 value (column rules)</p><p> xpp:rowsep table, tr, td, th 0=off, 1=on, html t3 value (row rules)</p><p> xpp:align table, td, th l = left, c = center, left (horizontal text r = right (or any align) valid arg to <tq> XyMacro)</p><p> xpp:valign table, thead, top, middle, top (vertical text align) tr, td, th bottom</p><p>4-28 Practical CSS Styling Content with CSS HTML5 Tables</p><p>The order of precedence for styling HTML5 tables is the following:</p><p>1. The tabular style bundle, t2, t3, and t4 specs, using the default (delivered) html t1 and t5 specs. Note: The t5 composition style values are now replaced by CSS, as the t5 spec is configured to not restore style for all body and header cells.</p><p>2. The CALS-like attributes, which are available for the table, thead, tr, td, and th elements.</p><p>3. The tabular override XyMacros, which can be entered via CSS using the -xpp-perl(xymacro)method.</p><p>Using HTML5 Tables and CALS Tables in the Same Division Both HTML5 and CALS tables can exist in the same division. To render them both without error, you must add a class attribute to your CALS tables. <table class=″cals″>... CALS markup ... </table> Only the table, thead and tbody elements are shared betweeen CALS and HTML5 tables. You must add selectors for them in CALS tables, and set the CSS display property to xpp-macro, which will cause these elements to invoke the corresponding XyMacro instead of being mapped to the html_xxx XyMacro: table.cals table,table.cals thead,table.cals tbody { display:-xpp-macro; } Note: If you are using CSS—not XyMacros—to render your CALS tables, you must configure the table, thead, and tbody tags to be the same as they are configured in the cals_table.css file (which resides in Lsyslib).</p><p>Styling Content with CSS Practical CSS 4-29 HTML5 Tables</p><p>Example: Using tabular override XyMacros to color HTML table header cells</p><p>Suppose you want your table headings to have a 30% magenta background, and your table footings to have a 30% blue background. You can specify this by adding a class attribute to your table tag, such as mytable in this example.</p><p>@import url(’html_table.css’); ... table.mytable thead th:before{ content:-xpp-perl(xymacro,html_th) -xpp-perl(xymacro,fcell,’30’,magenta); } table.mytable tfoot th:before{ content:-xpp-perl(xymacro,html_th) -xpp-perl(xymacro,fcell,’30’,blue); }</p><p>The first entry in the content property is invoking the html_th XyMacro, which overrides the selector for the th element in html_table.css.</p><p>Tip! Always call the appropriate html_xx XyMacro before you call the XyMacro override, fcell in this example.</p><p>4-30 Practical CSS Styling Content with CSS CALS Table Styling in CSS</p><p>...... CALS Table Styling in CSS</p><p>In XPP 9.1 and later, you have two ways to style CALS tables in CSS-XML divisions:</p><p>• The XyMacro (legacy) method—where all CALS elements are processed as XyMacros. This method requires that only the xpp.css stylesheet be imported. There are known problems using this method, mainly due to insertion of non-CALS tags in table cells. Tabular style values draw from the t1-t5 tabular style specs, CALS tabular attributes, and XyMacro overrides. • The CSS method—where CSS styles replace t5 (composition) style values. After you import the xpp.css stylesheet, you need to import the cals_table.css stylesheet. The t5 spec must be configured to not restore composition style values in each body or header cell. You must copy the t5_cals.sde and the t1_cals.sde to your local style library. Tabular style values draw from the t1-t4 tabular style specs, CSS (instead of the t5 style values), CALS tabular attributes, and XyMacro overrides ( invoked from the CSS tag:before pseudo-element).</p><p>SDL recommends that you use the CSS method to style CALS tables in CSS-XML divisions.</p><p>Styling Content with CSS Practical CSS 4-31 CSS Fonts</p><p>...... CSS Fonts</p><p>XPP Fonts are composed of a group of individual Postscript/OpenType font files tied together in a Font Access Table (FAST). Composition macros that set the family and variant numbers reference the Font Variant spec rule, which in turn references a primary, secondary, and default FAST number. This ultimately selects the real font via the Typesetter Font Map Spec (TSF) that contains information about that Postscript/OpenType font.</p><p>When a font is imported into XPP, a rule is created in a Font Variant Spec that includes a font family and variant number with a reference to a unique computer generated FAST number. You can also add a secondary and default FAST number to support PI characters that are not part of the font.</p><p>In XML mode, XPP selects fonts using ″font family″ and ″font variant″ rule numbers. In CSS-XML mode, XPP selects fonts using CSS selector rules, which select the font by name using the font-family property, with variations chosen by using the font-style and font-weight properties. Font mapping is required to associate the CSS properties to XPP font family and variant numbers.</p><p>Note: You do not have to use the font-weight and font-style properties. You can just reference the font name from the ″Name″ field in the TSF spec (not the CSS font-family field).</p><p>4-32 Practical CSS Styling Content with CSS CSS Fonts</p><p>Font Workflow</p><p>To change fonts in XPP, you select font family and variant numbers using tags and macros (refer to “Using Tags and Macros” in the XML Professional Publisher: User Guide). This determines the rule to use in the Font Variant spec. From the Font Variant spec, a character is generated from the Primary, Secondary, or Default FAST by using the FAST number to reference the actual name of the Postscript font from the TSF ″system″ spec in the font library (refer to the “Setting Up the TSF Spec” in the XML Professional Publisher: Fonts publication).</p><p>Example</p><p>CSS font style properties map to the following fields in the TSF spec: CSS font-family, CSS font-weight, CSS font-style. chap > title { font-family: AvantGarde-Demi; }</p><p>The Font Map No. field in the TSF spec corresponds to the Primary FAST in the font variant spec, from which XPP derives the appropriate Font Family and Font Variant numbers to select the correct font. This would choose ff=3, fv=1, and FAST=00003 (AvantGarde-Demi).</p><p>Styling Content with CSS Practical CSS 4-33 CSS Fonts</p><p>Creating a FAST</p><p>You use the afm2xyspecs.pl script to create a new FAST through an interactive dialog. The FAST number is a reference into the TSF ″system″ spec. This maps the FAST number into the Postscript font name. When a Postscript/OpenType font is imported into XPP, a rule is created in the font TSF system spec in the font library with a unique number that references the Postscript name. This also sets the font encoding.</p><p>You create a FAST by clicking Tools > Build FAST from PathFinder. The CSS font-style, CSS font-family, and CSS font-weight fields support their respective CSS font properties. After running Build FAST, it propagates the field values that you have entered to both the Font Variant spec and the TSF spec. Refer to “Installing Fonts” in the XML Professional Publisher: Fonts publication for information on running Build FAST.</p><p>Font Selection</p><p>In CSS, you select a font by name using the font-family property and selecting the PostScript font name from the Name: field in the TSF entry. If you instead use the CSS font-family field value, you will need to further refine your selection by specifying the font-style and font-weight properties.</p><p>Note: The font-family values of serif and sans-serif are generic family names that do not translate directly to a specific font family. A value of serif translates in XPP to a fixed Font Family value of 0 in the Font Variant (fv) spec and sans-serif translates to a fixed Font Family value of 1. Because sans-serif is the default CSS initial value for font-family, it is best to either always reference a specific font on the root tag (for main text and footnote and frill blocks) or to always define Font Family 1 and 0 (for value serif) in the Font Variant spec. Otherwise, you may see a number of composition errors like the following (that reference an ff value of 1 or 0): font family/variant error (11): ff,fv,sh,sw = 1,0,12,12</p><p>The font-style and font-weight CSS properties will set the font to a variation of the original font name, based on an algorithm that maps their keywords italic, oblique, normal, and bold into font names in the TSF spec. This will normally be retrieved from the imported AFM file that is associated with the Postscript/OpenType Font. If the font information cannot be resolved, the font-style and font-weight values will be left at normal. You will not be able to use these properties unless fields are adjusted in the TSF Spec.</p><p>The CSS font family name is not necessarily the same name as the PostScript font name, though they are both associated with each other.</p><p>4-34 Practical CSS Styling Content with CSS CSS Fonts</p><p>Table 4-1 CSS Font Property and Variant Names and Their Allowable Values</p><p>CSS Font Allowable Values Property/Variant</p><p> font-family <family-name> | <serif, sans-serif> | inherit</p><p> font-style italic | oblique | normal | inherit</p><p> font-weight normal | bold | inherit</p><p>Note: You cannot use small-caps as the value for the font-variant CSS property to select an actual small-caps font; rather, it is used to algorithmically generate small-caps using a text transform (in XPP terms, using casemode). Consequently, selecting small-caps as the value for the font-variant CSS property will override any concurrent setting of the text-transform CSS property. If you need to select an actual small-caps font, you must create a separate font-family name, such as Caslon-SC, and use the CSS font-style and font-weight properties to select the italic and bold variants of your actual small-caps fonts, if they exist.</p><p>Importing Font Information for Use with CSS</p><p>If you are upgrading from a prior release of XPP, the TSF spec does not contain the information necessary to specify the CSS font-family, font-weight, and font-style properties; therefore, you will need use the afmtotsf utility to populate the TSF spec with this information, which it extracts from your AFM files. Refer to “Overview of the XPP PathFinder Window” in the XML Professional Publisher: User Guide publication for more information.</p><p>Note: If this is a new XPP installation, you will not have to perform this procedure.</p><p>To import CSS font information</p><p>1. In PathFinder, click Tools > More Tools > afmtotsf.pl. 2. From the Select Library drop-down list, click a font library.</p><p>3. Click Convert.</p><p>The utility will:</p><p>• Locate every Postscript/OpenType font in the font library that you specified. • Match the corresponding AFM file, and extract the Font Family, Bold, and Italic information. • Write this information to the TSF entry for that PostScript font.</p><p>Styling Content with CSS Practical CSS 4-35 CSS Fonts</p><p>If the AFM does not have a bold entry, or if the AFM uses a term other than ″bold″ to designate the bold font weight, the CSS font-weight property value will be set to Normal. The afmtotsf utility will report fonts that do not have font-style and font-weight information; therefore, you must edit TSF entry from Normal to the desired style.</p><p>Note: The original TSF system file will be copied to tsf_systembk.sde.</p><p>Changing CSS Fonts by Using XyMacros</p><p>You can select the XPP font family and font variant from the CSS font information using a XyMacro, rather than a CSS style sheet rule.</p><p>Font macros use the following format. <F2;CSS font family name; CSS font weight; CSS font style; exact/fuzzy match></p><p>Macro Name: F2 Expansion: /F2; $1; $2; $3; $4</p><p>Expansion Family/ Allowable Values Variant</p><p>$1 Family CSS font family name as defined in tsf_system spec serif, sans-serif</p><p>$2 Weight 0 = normal 1 = bold</p><p>$3 Style 0 = normal 1 = italic 1 = oblique</p><p>$4 Match 1 = exact match of font family name 0 = fuzzy match</p><p>To specify CSS font properties using a XyMacro</p><p>This procedure will add the necessary processing instructions to format content in the Minion font face, bolded and italicized, using a fuzzy match.</p><p>1. At the desired insertion point in your division, press F9. The PI macro appears: <? ?></p><p>2. Type F2;</p><p>3. Type Minion; 4. Type 1; (Bold)</p><p>4-36 Practical CSS Styling Content with CSS CSS Fonts</p><p>5. Type 1; (Italics)</p><p>6. Type 0 (fuzzy match) 7. Press Enter.</p><p>This is the PI macro result using the example above: <?F2;Minion;1;1;0?></p><p>Styling Content with CSS Practical CSS 4-37 CSS Cross-referencing</p><p>...... CSS Cross-referencing</p><p>You can use the XPP-specific CSS properties -xpp-xref-mark and -xpp-xref-refer to create cross-references within text.</p><p>Marking an Element for Cross-referencing</p><p>Use the -xpp-xref-mark property in CSS to designate a tagged XML element as the target for a cross-reference.</p><p>Example In this example, a fragment of text in the main text stream is marked as the target for a cross reference and given the ID my_unique_id.</p><p>The XML Tagging <target id=″my_unique_id″>Using CSS with XPP</target></p><p>The CSS target { -xpp-xref-mark: attr(id); }</p><p>Inserting a Reference to a Marked Element</p><p>Use the -xpp-xref-refer property in CSS to create a reference to a tagged XML element that has been marked as the target of a cross-reference.</p><p>Example In this example, the text fragment marked as a cross-reference target in the previous example is referenced in a frills block:</p><p>The XML Tagging <refer ref=″my_unique_id″/></p><p>The CSS refer { -xpp-xref-refer: attr(ref) spot first; } refer:before {content: ″See reference on page ″ -xpp- perl(xymacro,ri,’%refpg4’); }</p><p>Note: In the previous example, you could create a Perl subroutine to output the referenced page number:</p><p>4-38 Practical CSS Styling Content with CSS CSS Cross-referencing</p><p>The Perl (bundle.pl) sub print_refpg { my $X=XPPcompo->new(); $X- >ri(’%refpg4’); }</p><p>The Updated CSS refer:before { content: ″See reference on page ″ -xpp- perl(’print_refpg’); }</p><p>Styling Content with CSS Practical CSS 4-39 CSS Cross-referencing</p><p>4-40 Practical CSS Styling Content with CSS Chapter 5</p><p>CSS Paged Media</p><p>This chapter explains the following:</p><p>• Styling Paged Media in XPP • XML and CSS Examples</p><p>Styling Content with CSS CSS Paged Media 5-1 Styling Paged Media in XPP</p><p>...... Styling Paged Media in XPP</p><p>XPP enables you to use the CSS Paged Media Module Level 3 syntax to control page layout and pagination by automatically converting CSS @page definitions into standard XPP Pagination Style (PS) and Page Layout (PL) specs. XPP then uses these specs during composition to implement the layout and pagination defined by the CSS.</p><p>The CSS Paged Media Module, which is built on the CSS Box Model, uses the @page rule as the primary mechanism for describing page geometry and pagination-related artifacts. You use this rule to specify the dimensions, orientation, and margins of a page, as well as the generated content and style in the margin areas.</p><p>XPP Page Sequence Selection</p><p>XPP supports the CSS level 3 page property, which can be used in the main CSS file to cause an element to be displayed using the same named page as that specified in the corresponding @page rule.</p><p>CSS Page Property The page property is used to specify a particular type of page (called a named page) on which an element must be displayed. This page can be styled by using the same named page in a @page selector. Page names are case-sensitive identifiers. However the auto value, being a CSS keyword, is ASCII case-insensitive. The page property can inherit its page layout property values (size and margin, for example) from a base @page rule. For example, you can define a left hand page named foo:left that can inherit properties from a @page foo rule. However, if the page value on an element is set to auto, the value used is the current active page style.</p><p>Page Property Example</p><p>In the following example, two tables are rendered on landscape pages. The named page narrow is used for the <thin> element after the second table, as the page property for the table element is no longer in effect:</p><p>@page narrow { size: 9cm 18cm; } @page rotated { size: landscape; } thin { page: narrow; display: -xpp-page; } table { page: rotated; display: -xpp-page; }</p><p>5-2 CSS Paged Media Styling Content with CSS Styling Paged Media in XPP</p><p>With this document:</p><p><div> <table>...</table> <table>...</table> <thin>This text is rendered on a ’narrow’ page</thin> </div></p><p>The -xpp-page-style-table Property</p><p>XPP also supports the -xpp-page-style-table property, which selects a page sequence table number directly. If you specify a page property value other than auto, XPP selects the page sequence table using the at_bundle.map file generated by the css2pagespecs.pl utility.</p><p>When composition begins, if no page property is specified, XPP selects the first table in the PS spec, which is the default, unnamed page sequence.</p><p>Page Selectors</p><p>A page type selector is made of either a page selector or a page selector combined with one or more page pseudo-classes for more specificity. No whitespace is allowed between components of a selector. The page selector grammar and examples can be found below.</p><p>A page selector is said to match a given page if all of its components match the page.</p><p>A page type selector is a case-sensitive identifier. It matches pages of the named page type specified in the page property.</p><p>Styling Content with CSS CSS Paged Media 5-3 Styling Paged Media in XPP</p><p>A page pseudo-class is ASCII case-insensitive and has the same syntax as pseudo-classes in regular selectors. The various page pseudo-classes are defined below:</p><p>• Spread pseudo-classes: :left, :right When printing double-sided documents, left and right pages are often formatted differently. This can be expressed by using the :left and :right page pseudo-classes. All pages are automatically classified as either left pages or right pages, based on page progression. The :left and :right pseudo-classes only match left or right pages, respectively. The following example creates left and right page layouts using these pseudo-classes: @page toc:left { margin-left: 3cm; margin-right: 4cm; } @page toc:right { margin-left: 4cm; margin-right: 3cm; } • First-page pseudo-class: :first The :first pseudo-class matches the first printed page of a document. @page { margin: 2cm; /* All margins set to 2cm */ } @page :first { margin-top: 10cm; /* Top margin on first page 10cm */ } • Blank-page pseudo-class: :blank The :blank pseudo-class matches content-empty pages that appear as a result of forced page breaks. In this example, the h1 element starts a new page sequence. h1 { display: -xpp-page; page: mypage; } @page mypage:right { margin-left: 3cm; margin-right: 4cm; }</p><p>5-4 CSS Paged Media Styling Content with CSS Styling Paged Media in XPP</p><p>@page mypage:blank { @top-center { content: ″This page is intentionally left blank″;} }</p><p>In the previous example, there is no @page mypage:left rule to define a mypage:left named page. Therefore, if the h1 results in a new left page, a blank page (as defined in the mypage:blank @page rule) is inserted.</p><p>XPP Page Layout</p><p>The following sections describe the CSS properties you can use to define page layout in XPP.</p><p>Page-level Data</p><p>XPP supports the following standard page-level CSS properties:</p><p>• size • margin (shorthand) • margin-top • margin-left • margin-right • margin-bottom</p><p>In addition, XPP includes the following XPP-specific page-level CSS properties (where xxx represents an XPP Page Sequence or Page Layout spec): • -xpp-ps-hdr-xxx (provides access to page sequence header fields) • -xpp-ps-bdy-xxx (provides access to page sequence body fields) • -xpp-pl-hdr-xxx (provides access to page layout header fields)</p><p>Page width and depth can be specified using the CSS size property, which uses the following syntax:</p><p> size: <length>{1,2} | auto | [page-size || [portrait | landscape] ]</p><p> where page-size is one of the following standard page sizes as defined in the CSS level 3 specification:</p><p>Styling Content with CSS CSS Paged Media 5-5 Styling Paged Media in XPP</p><p>Table 5-1 CSS 3-defined Page Sizes</p><p>Page Size Description</p><p> letter Equivalent to the size of North American letter media: 8.5 inches wide by 11 inches high</p><p> legal Equivalent to the size of North American legal media: 8.5 inches wide by 14 inches high</p><p> ledger Equivalent to the size of North American ledger media: 11 inches wide by 17 inches high</p><p>A5 Equivalent to the size of ISO A5 media: 148 mm wide by 210 mm high</p><p>A4 Equivalent to the size of ISO A4 media: 210 mm wide by 297 mm high</p><p>A3 Equivalent to the size of ISO A3 media: 297 mm wide by 420 mm high</p><p>B5 Equivalent to the size of ISO B5 media: 176 mm wide by 250 mm high</p><p>B4 Equivalent to the size of ISO B4 media: 250 mm wide by 353 mm high</p><p>If no size is defined with the size property, XPP uses letter size (8.5 inches by 11 inches).</p><p>You can use the CSS margin properties to define the margins as either a fixed value or a percentage of the page size.</p><p>There are XPP-specific CSS properties that can be used to specify any of the page-specific fields in the Page Layout spec, including page rotation, change bar data, and pickup placement extents. The values for XPP-specific CSS properties can be inherited at the page level.</p><p>Note: XPP does not support the CSS @media media query feature.</p><p>Block-level Data</p><p>In each table of the _pl_bundle.sde file, a single (main) block is created whose x,y origin, width, and depth are determined based on the size property, as well as any margin-xxx properties defined in the corresponding @page rule.</p><p>5-6 CSS Paged Media Styling Content with CSS Styling Paged Media in XPP</p><p>If the page layout requires multiple main blocks, use the xpp-main- blockN XPP-specific CSS property for each (where N is a number assigned to the block). Note that these XPP-specific CSS properties suppress the creation of the CSS default main block.</p><p>According to the CSS Paged Media Module, generated content is restricted to the 16 page-margin boxes, whose default text-align and vertical- align properties, (which control the horizontal and vertical text alignment, respectively) are defined in the CSS level 3 specification:</p><p>Table 5-2 CSS Page-margin Boxes</p><p>Page-margin Box Default text-align Default vertical-align</p><p>@top-left-corner right middle</p><p>@top-left left middle</p><p>@top-center center middle</p><p>@top-right right middle</p><p>@top-right-corner left middle</p><p>@bottom-left-corner right middle</p><p>@bottom-left left middle</p><p>@bottom-center center middle</p><p>@bottom-right right middle</p><p>@bottom-right-corner left middle</p><p>@left-top center top</p><p>@left-middle center middle</p><p>@left-bottom center bottom</p><p>@right-top center top</p><p>@right-middle center middle</p><p>@right-bottom center bottom</p><p>Any page-margin boxes in any of the CSS @page rules are represented by frills blocks in the corresponding table of the Page Layout spec. The size and location of the page-margin boxes are essentially the same as documented in Table 1 of the CSS 3 specification at: https://www.w3.org/ TR/css3-page/.</p><p>Styling Content with CSS CSS Paged Media 5-7 Styling Paged Media in XPP</p><p>The main difference is that the width of the top- and bottom- (non-corner) margins is the same as the width of the main text block; similarly, the depth of the left- and right- margins is the same as the depth of the main text block.</p><p>There are XPP-specific CSS properties that can be used to override the x,y position, width, and depth of each margin box. There are also XPP-specific CSS properties for specifying any of the block-related values in the Page Layout spec, including rotation, foreground- and background-color and pattern, and vertical alignment. The values for XPP-specific CSS properties cannot be inherited at the block level.</p><p>Block-level (Frills) Content</p><p>Any content property values from any of the CSS page-margin boxes are handled as in the following example.</p><p>Suppose that, in the CSS, we have the following @page rule:</p><p>@page foo:first:left { @top_left { color: blue; font-weight: bold; content: ″Page ″ -xpp-perl(pagenum); } }</p><p>When this @page rule is processed by the css2pagespecs.pl utility, two outputs are generated: • A frills block in the Page Layout spec with Block Content equal to: <_page id=″foo″ class=″first″ type=″left″><_top_left/> </_page> • The following entry in the at_bundle.css file: _page#foo.first[type=″left″] > _top_left:before { color: blue; font-weight: bold; content: ″Page ″ -xpp-perl(pagenum); }</p><p>Because the at_bundle.css file is imported into the bundle.css file, when the frills block is created and composed by XPP composition, the tags from the frills block will be matched by the entries in the at_bundle.css file, resulting in the generated content being output with the appropriate style.</p><p>5-8 CSS Paged Media Styling Content with CSS Styling Paged Media in XPP</p><p>XPP-specific CSS Properties in @page Rules</p><p>XPP-specific CSS properties can be used to define most of the data in the Page Sequence and Page Layout supporting data files. The following table describes these properties and where in the CSS @page rule syntax they can be specified:</p><p>Table 5-3 XPP-specific CSS Properties in @page Rules</p><p>Data Name (where xxx Valid @page Properties (defined in represents a Rule Location tables 5-3 and 5-4) value from the Properties column)</p><p>Page Sequence -xpp-ps-hdr-xxx page level std-comment, baleop, Header pendpks, lastpage, fntype, facepages, pupriority, f-seqstrt, p-seqstrt1..5,fntry, fnpriority, fnmovup, fnstring, pkguttop, pkgutside, pkgutbod, pustack, balinc, ballow, balhigh, baldelta, f-2seqstart, baleor, punoint, fn-wait, fn- 2wait, fnwhite, puwhite, fntopgut, fn2string, absfoot</p><p>Page Sequence -xpp-ps-bdy-xxx page level or pttnum, textlines, indent, Body pseudo-page putry1, putry2, putry3, level putry4, inh-pkups, inh-main, keepout, fstyle, ftype, inh-force, inh- extent, inh-blockpu, pcspanpu</p><p>Page Layout -xpp-pl-hdr-xxx page-level or std-comment, grid, Header pseudo-page chngbarl, changebarr, level gridx, gridy, pkx, pky, pksx, pksy, amount, direction, px, py, fsx, fsy, chngbareq, chngbarwe</p><p>Page Layout -xpp-pl-bdy-xxx page level, bx, by, bsx, bsy, vjmode, Body pseudo-page frid, wdir, color, pattern, level, or page bgcolor, bgpattern, margin level amount, direction, comment</p><p>In the previous table, page-level, pseudo-page level, and page margin level are at the position marked yyy within the @page rule as in the following examples:</p><p>Styling Content with CSS CSS Paged Media 5-9 Styling Paged Media in XPP</p><p> page level: @page { yyy } OR @page foo { yyy } pseudo-page level: @page :first { yyy } OR @page foo:left { yyy } page margin level: @page :first { @top-center { yyy } }</p><p>XPP-specific Page Sequence and Page Layout Properties XPP supports a number of XPP-specific page sequence and page layout properties you can use to control the pagination and formatting of output. The page layout properties can be set explicitly or inherited from a ″base″ style in the CSS. The following tables 5-4 and 5-5 describe in greater detail the XPP-specific Page Sequence and Page Layout properties, respectively. In these tables, note the following:</p><p>• The term ″numeric CSS dimension″ refers to a number followed by a valid CSS unit of measure: pc | pt | in | cm | mm | co | do • For properties that accept a color as their value, you can specify any color in the Color Control spec by number (0 through 65533), or any of the following standard, named colors: normal | black | white | red | green | blue | cyan | magenta | yellow</p><p>Table 5-4 XPP-specific Page Sequence CSS Properties</p><p>Property Description Valid Values</p><p>-xpp-ps-hdr-baleop whether to balance balance | align | no columns or align baselines of text on all pages with multicolumn layouts, except last page, in a page sequence</p><p>-xpp-ps-hdr-lastpage whether to balance balance | align | no columns or align baselines of text on last page in a page sequence</p><p>-xpp-ps-hdr-pendpks whether to output yes | no pending pickups</p><p>-xpp-ps-hdr-baleor whether to balance yes | no columns on last page of a composed range</p><p>-xpp-ps-hdr-facepages whether to balance facing yes | no</p><p>5-10 CSS Paged Media Styling Content with CSS Styling Paged Media in XPP</p><p>Table 5-4 XPP-specific Page Sequence CSS Properties (Continued)</p><p>Property Description Valid Values</p><p> pages (when using a double-sided format)</p><p>-xpp-ps-hdr-balinc amount of space that can positive numerical CSS be added or removed from dimension (default is 0) block depth to balance facing pages</p><p>-xpp-ps-hdr-ballow maximum number of integer 0 through 99 increments that can be (default is 0) subtracted from block bottom when balancing facing pages</p><p>-xpp-ps-hdr-balhigh maximum number of integer 0 through 99 increments that can be (default is 0) added to block bottom when balancing facing pages</p><p>-xpp-ps-hdr-baldelta maximum difference in integer 0 through 99 number of increments (default is 0) allowed from previous backup block bottom</p><p>-xpp-ps-hdr-fntype whether footnotes should block | page be placed at end of block or end of page</p><p>-xpp-ps-hdr-fnmoveup where footnotes should be every | last | no placed on a partially-filled every - move footnotes page up on every page and leave any extra white space at the bottom of the page last - move footnotes up on only the last page of a division no - leave footnotes at the bottom of the page</p><p>-xpp-ps-hdr-absfoot on first page, place yes | no footnotes at bottom of (default is no) second main-text block on page for footnotes referenced in first block</p><p>-xpp-ps-hdr-fntry number of table in integer 0 through 255 Pagination Tries spec to (default is 0)</p><p>Styling Content with CSS CSS Paged Media 5-11 Styling Paged Media in XPP</p><p>Table 5-4 XPP-specific Page Sequence CSS Properties (Continued)</p><p>Property Description Valid Values</p><p> use if footnote needs to break across block or page</p><p>-xpp-ps-hdr-fntopgut amount of space between positive numeric CSS the footnote separator rule dimension and the top of the separator block</p><p>-xpp-ps-hdr-fnpriority order in which to add or 1st through 10th remove white space (default is 1st) preceding a footnote</p><p>-xpp-ps-hdr-fnwhite maximum amount of positive numeric CSS white space that can be dimension added to or removed from (default is 0) a footnote gutter</p><p>-xpp-ps-hdr-f-seqstrt when to restart the first | every | block | no automatic footnote numbering sequence for footnote track 1</p><p>-xpp-ps-hdr-f-2seqstart when to restart the first | every | block | no automatic footnote numbering sequence for footnote track 2</p><p>-xpp-ps-hdr-fn-wait suspend the output of yes | no track 1 footnotes until the (default is no) end of division or the end of the active pagination sequence</p><p>-xpp-ps-hdr-fn-2wait suspend the output of yes | no track 2 footnotes until the (default is no) end of division or the end of the active pagination sequence</p><p>-xpp-ps-hdr-fnstring tag, XyMacro, or text any tag, XyMacro, or string to mark a separation string between track 1 footnotes and main text</p><p>-xpp-ps-hdr-fn2string tag, XyMacro, or text any tag, XyMacro, or string to mark a separation string between track 2 footnotes and main text</p><p>5-12 CSS Paged Media Styling Content with CSS Styling Paged Media in XPP</p><p>Table 5-4 XPP-specific Page Sequence CSS Properties (Continued)</p><p>Property Description Valid Values</p><p>-xpp-ps-hdr-pupriority order in which white 1st through 10th space is to be added or where 1st is the highest removed before and after a priority and 10th the pickup lowest (default is 1st)</p><p>-xpp-ps-hdr-puwhite maximum amount of positive numeric CSS white space that can be dimension added to or removed from (default is 0) a pickup gutter</p><p>-xpp-ps-hdr-pkguttop size of the gutter above positive numeric CSS pickups dimension (default is 0)</p><p>-xpp-ps-hdr-pkgutbod size of the gutter below positive numeric CSS pickups dimension (default is 0)</p><p>-xpp-ps-hdr-pkgutside size of the gutters to right positive numeric CSS and left of pickups dimension (default is 0)</p><p>-xpp-ps-hdr-pustack size of the gutters between positive numeric CSS stacked pickups dimension (default is 0)</p><p>-xpp-ps-hdr-p-seqstrt1 how to restart the first | every | no automatic pickup first - restart numbering -xpp-ps-hdr-p-seqstrt2 numbering sequence for on the first page of a new pickup tracks 1 through 5 -xpp-ps-hdr-p-seqstrt3 page sequence every - restart numbering -xpp-ps-hdr-p-seqstrt4 on every page -xpp-ps-hdr-p-seqstrt5 no - continue numbering throughout the division (default is no)</p><p>-xpp-ps-hdr-punoint whether to prevent yes | no pending pickups from (default is no) interrupting a broken table</p><p>-xpp-ps-bdy-pttnum number of table in integer 1 through 255 Pagination Tries spec to (default is 1) use when composing content on pages using this page layout</p><p>Styling Content with CSS CSS Paged Media 5-13 Styling Paged Media in XPP</p><p>Table 5-4 XPP-specific Page Sequence CSS Properties (Continued)</p><p>Property Description Valid Values</p><p>-xpp-ps-bdy-inh-main whether pages using this yes | no page layout can contain (set filler pages to no) text from the main-text stream</p><p>-xpp-ps-bdy-textlines minimum required integer 0 through 255 number of main-text lines (default is 0) on page before footnote can be placed on pages using this layout</p><p>-xpp-ps-bdy-inh-pkups whether to allow pickups yes | no to place on pages using (set filler pages to no) this layout</p><p>-xpp-ps-bdy-indent whether text margin-left yes | no property should be honored when the text flows around pickup or shape</p><p>-xpp-ps-bdy-putry1 where to place pickups 3-letter mnemonic representing the page -xpp-ps-bdy-putry2 and horizontal and vertical location for -xpp-ps-bdy-putry3 pickups: -xpp-ps-bdy-putry4 page: a (any), c (current), n (next), r (right), or l (left) horizontal: l (left), c (center), r (right), i (inside), or o (outside vertical: t (top), c (center), or b (bottom)</p><p>-xpp-ps-bdy-keepout how text flows around the ss | fs | sf | ff pickup ss - flow text above, below, and beside pickup fs - flow text above and below pickup within the defined scope sf - flow text beside pickup ff - do not flow text or other pickups into the defined scope (block or page) containing the</p><p>5-14 CSS Paged Media Styling Content with CSS Styling Paged Media in XPP</p><p>Table 5-4 XPP-specific Page Sequence CSS Properties (Continued)</p><p>Property Description Valid Values</p><p> pickup</p><p>-xpp-ps-bdy-inh-force allow overlapping pickups yes | no on a page after some pickups have been frozen</p><p>-xpp-ps-bdy-inh-extent allow pickups to extend yes | no beyond the margin of a page</p><p>-xpp-ps-bdy-inh-blockpu allow multicolumn yes | no floating block pickups to extend outside of page area</p><p>-xpp-ps-bdy-pcspanpu allow bottom-placed block yes | no pickups to be placed at yes - place pickup at bottom of spanned bottom of span columns no - place pickup at bottom of page</p><p>-xpp-ps-bdy-ftype type of footnote block | page pagination (default is the value of -xpp-ps-hdr-fntype)</p><p>-xpp-ps-bdy-fstyle footnote placement in left | right | outside | multi-column layout inside | full left - alway place footnotes in the left column right - always place footnotes in the right column outside - always place footnotes in outside column (left column on left pages; right column on right pages) inside - always place footnotes in inside column (right column on left pages; left column on right pages) full - span footnotes across the width of the footnote area (default is full)</p><p>Styling Content with CSS CSS Paged Media 5-15 Styling Paged Media in XPP</p><p>Table 5-5 XPP-specific Page Layout CSS Properties</p><p>Property Description Valid Values</p><p>-xpp-pl-hdr-std-comment description of page layout string up to 512 characters</p><p>-xpp-pl-hdr-px x-position of the page positive numeric CSS within frame dimension Note: A frame is a user- (default is 0) defined area around a page used to print customized crop marks, register marks, printer’s notes, slug lines, and the like.</p><p>-xpp-pl-hdr-py y-position of the page positive numeric CSS within frame dimension (default is 0)</p><p>-xpp-pl-hdr-fsx positive numeric CSS width of frame dimension (default is 0)</p><p>-xpp-pl-hdr-fsy depth of frame positive numeric CSS dimension (default is 0)</p><p>-xpp-pl-hdr-grid name of grid string up to 8 characters Note: Grids are defined in a grid spec and specify gravity coordinates that align blocks during layout operations.</p><p>-xpp-pl-hdr-gridx placement of left edge of positive numeric CSS grid in relation to left edge dimension of page (default is 0)</p><p>-xpp-pl-hdr-gridy placement of top of grid in positive numeric CSS relation to top of page dimension (default is 0)</p><p>-xpp-pl-hdr-amount rotation amount 0 | 90 | 180 | 270 | 360</p><p>-xpp-pl-hdr-direction rotation direction clock | counter</p><p>5-16 CSS Paged Media Styling Content with CSS Styling Paged Media in XPP</p><p>Table 5-5 XPP-specific Page Layout CSS Properties (Continued)</p><p>Property Description Valid Values</p><p>-xpp-pl-hdr-chngbarl distance between left edge positive numeric CSS of block or page and left dimension change bar (default is 0) Note: Change bars are computer-generated, vertical bars placed in the left or right margin of edited lines. To use change bars, turn on Edit Trace in the Division Ticket.</p><p>-xpp-pl-hdr-chngbarr distance between right positive numeric CSS edge of block or page and dimension right change bar (default is 0)</p><p>-xpp-pl-hdr-chngbarwe whether distances of block | page change bars are measured from edge of block or edge of page</p><p>-xpp-pl-hdr-chngbareq side to use when both right | left | inside | right and left change bars outside are allowed and are equal distance from the block</p><p>-xpp-pl-hdr-pkx distance from left edge of positive numeric CSS page to left boundary of dimension pickup placement area (default is 0)</p><p>-xpp-pl-hdr-pky distance from top of page positive numeric CSS to top boundary of pickup dimension placement area (default is 0) Note: For information about pickups, refer to the XPP document XML Professional Publisher: Creating Pickups.</p><p>-xpp-pl-hdr-pksx width of pickup positive numeric CSS placement area dimension (default is 0)</p><p>-xpp-pl-hdr-pksy depth of pickup placement positive numeric CSS area dimension (default is 0)</p><p>-xpp-pl-bdy-comment description of block string up to 512 characters</p><p>-xpp-pl-bdy-frid frame unique ID integer 0 through 250</p><p>Styling Content with CSS CSS Paged Media 5-17 Styling Paged Media in XPP</p><p>Table 5-5 XPP-specific Page Layout CSS Properties (Continued)</p><p>Property Description Valid Values</p><p>-xpp-pl-bdy-bx distance from left of page positive numeric CSS to left edge of block dimension (default is 0)</p><p>-xpp-pl-bdy-by distance from top edge of positive numeric CSS page to top edge of block dimension (default is 0)</p><p>-xpp-pl-bdy-bsx width of block positive numeric CSS dimension (default is 0)</p><p>-xpp-pl-bdy-bsy depth of block positive numeric CSS dimension (default is 0)</p><p>-xpp-pl-bdy-amount rotation amount 0 | 90 | 180 | 270 | 360</p><p>-xpp-pl-bdy-direction rotation direction clock | counter</p><p>-xpp-pl-bdy-color color for contents of block color from Color Control spec</p><p>-xpp-pl-bdy-pattern pattern for contents of pattern number from block Special Effects Patterns spec</p><p>-xpp-pl-bdy-bgcolor color for background of color from Color Control block spec</p><p>-xpp-pl-bdy-bgpattern pattern for background of pattern number from block Special Effects Patterns spec</p><p>-xpp-pl-bdy-vjmode how to vertically justify top | bottom | center | text in a partially-filled justify block</p><p>-xpp-pl-bdy-wdir writing direction for block left-to-right | right-to-left (default is left-to-right)</p><p>5-18 CSS Paged Media Styling Content with CSS Styling Paged Media in XPP</p><p>Unsupported CSS3 Generated Content Features</p><p>The following CSS level 3 features for generated content are not supported by XPP:</p><p>• CSS functions: • content() • string() • leader() • target-counter() • target-counters() • target-text</p><p>• CSS values: • running() • element()</p><p>• Pseudo-elements: • footnote-call • footnote-marker</p><p>• CSS properties: • bookmark-level • bookmark-label • bookmark-state</p><p>• Pseudo-class nth() or CSS Page Groups</p><p>The XPP css2pagespecs.pl Utility</p><p>To convert CSS page definitions into PL specs, XPP uses a Perl utility, css2pagespecs.pl. The utility parses the @page rules in the CSS file to map them to their equivalent XPP specifications in PS and PL specs.</p><p>The utility outputs a file named at_bundle.css, (where bundle is the name of the XPP style bundle in use). This file contains CSS style properties to be matched by the generated content (tags) in the running headers, running footers, and other margins (implemented as XPP frills blocks) within the XPP Page Layout data.</p><p>Styling Content with CSS CSS Paged Media 5-19 Styling Paged Media in XPP</p><p>The utility also outputs a file named at_bundle.map, (where bundle is the name of the XPP bundle in use). XPP composition uses this file to translate page names to XPP page sequence numbers when executing the CSS page property.</p><p>Library-level Versus JOB-level Page Spec Creation</p><p>If you create or edit your main CSS file (with @page rules and @import at_bundle.css statement) at the library level, you must manually run css2pagespecs.pl at the library level to create or update the at_bundle.css and at_bundle.map files at the library level.</p><p>If you create (or copy) your main CSS file at the JOB level and then edit your CSS file at the JOB level, XPP automatically runs css2pagespecs.pl at the JOB level to recreate the at_bundle.css and the at_bundle.map files. This occurs because XPP composition compares the date of the at_bundle.css file against that of the main bundle.css file at the JOB level. If the at_bundle.css file is older than the main bundle.css file, composition invokes css2pagespecs.pl to ensure that the derivative .css and .map files are up-to-date.</p><p>CSS @page Rules Mapping to XPP Page Sequence Tables</p><p>The CSS @page rules are either named (such as first, left, or right), or apply to all pages, as determined by the page selector. All @page rules that apply to a specific, named page are assigned to the same table in the Page Sequence spec (_ps_bundle.sde). Those @page rules that apply to all pages are assigned to table #1. If the page selector contains page pseudo-classes such as ’:left’, ’:right’, ’:first’ and ’:blank’, each pseudo- class will be assigned a separate Page Sequence rule, as in the following table:</p><p>Table 5-6 CSS Page Sequencing @page Rules Mapped to XPP</p><p>Pseudo-class PS ″page″ PS ″page type″ Page Layout</p><p>:first 1 any 1_1_a</p><p>:left standard left 1_s_l</p><p>:right standard right 1_s_r</p><p>:blank filler any 1_f_a</p><p>:first:left 1 left 1_1_l</p><p>:first:right 1 right 1_1_r</p><p>:blank:left filler left 1_f_l</p><p>5-20 CSS Paged Media Styling Content with CSS Styling Paged Media in XPP</p><p>Table 5-6 CSS Page Sequencing @page Rules Mapped to XPP</p><p>Pseudo-class PS ″page″ PS ″page type″ Page Layout</p><p>:blank:right filler right 1_f_r</p><p>:blank:first filler any 1_f_a</p><p> foo:first 2 any 2_1_a</p><p> foo:left standard left 2_s_l</p><p> foo:right standard right 2_s_r</p><p> bar:first 3 any 3_1_a</p><p> bar:left standard left 3_s_l</p><p> bar:right standard right 3_s_r</p><p>...</p><p>Based on these values, the at_bundle.map would contain the following values:</p><p>Table 5-7 Sample at_bundle.map File</p><p>Page Type XPP PS Table Number</p><p>_DEFAULT 1</p><p> foo 2</p><p> bar 3</p><p>Styling Content with CSS CSS Paged Media 5-21 XML and CSS Examples</p><p>...... XML and CSS Examples</p><p>The following examples show corresponding XML and CSS files using an XPP bundle and the results they produce.</p><p>Example 1: Main Content and Table of Contents</p><p>The following example demonstrates how a simple document is rendered by XPP using CSS.</p><p>XML File</p><p>The following is an example of an XML file named example.xml, which represents a simple document with a table of contents, followed by some chapters of text:</p><p><document> <section class=″toc″> table of contents, ... </section> <section class=″body″> <section class=″chapter″> <h1>Chapter One Title</h1> <p>Chapter One contents ...</p> </section> <section class=″chapter″> <h1>Chapter Two Title</h1> <p>Chapter Two contents ...</p> </section> </section> </document></p><p>CSS File</p><p>The following is an example of a CSS file that includes @page rules and CSS for the main content:</p><p>/****** example.css *****/ /*------*/ /* @page rules */ /*------*/ @page { -xpp-ps-hdr-std-comment: ″Default Page Sequence″; -xpp-pl-hdr-std-comment: ″Default Page Layout″; size: 8.5in 10.5in; margin: 0.5in; }</p><p>5-22 CSS Paged Media Styling Content with CSS XML and CSS Examples</p><p>@page toc { -xpp-ps-hdr-std-comment: ″Page Sequence for TOC″; -xpp-pl-hdr-std-comment: ″Page Layout for TOC″; @top-center { content: ″Table of Contents″;} @bottom-center { content: -xpp-perl(page_print, lower-alpha); } } @page main { -xpp-ps-hdr-std-comment: ″Page Sequence for Body″; -xpp-pl-hdr-std-comment: ″Page Layout for Body″; @top-center { content: -xpp-perl(print_chaptitle); } @bottom-center { content: -xpp-perl(page_print, decimal); } } /*------*/ /* content rules */ /*------*/</p><p>.toc { display: -xpp-page; page: toc; } .toc:before{ content: -xpp-perl(page_reset); }</p><p>.body { display: -xpp-page; page: main; } .body:before{ content: -xpp-perl(page_reset); } .chapter > h1:before { -xpp-perl(start_save_chaptitle); } .chapter > h1:after { -xpp-perl(end_save_chaptitle); }</p><p>Results</p><p>At the JOB level, the user would run the css2pagespecs.pl utility using the following syntax:</p><p> css2pagespecs.pl -name example</p><p>The utility generates the following files: • _ps_example.sde • _pl_example.sde • at_example.css • at_example.map</p><p>Styling Content with CSS CSS Paged Media 5-23 XML and CSS Examples</p><p>Example 2: Rotated Page</p><p>The following example demonstrates how XPP renders a rotated page using CSS.</p><p>XML File</p><p>The following is an example of an XML file named rotate.xml, which represents a simple document containing a page of content to be rotated 90 degrees:</p><p><doc> <p>This is a test of using CSS paged media to create rotated pages.</p> <p>This block is rotated 90 degrees counter clockwise, and so are the top and bottom frills.</p> <p>The page size is ″letter portrait″, i.e. 8.5 X 11 inches.</p> <p>The margin is ″0in″, so we can specify the block x,y position, width and depth manually for each block, main and frills.</p> <table> <tgroup cols=″3″> ... </table> </doc></p><p>CSS File</p><p>The following is an example of a CSS file that includes @page rules and CSS to rotate the page.</p><p>@import url(’at_rotate.css’); /*------*/ /* @page rule: page rotated 90 counter-clockwise */ /*------*/ @page { size: letter portrait; /* 8.5in X 11in */ margin: 0in; /* all blocks are manually specified */ font: normal normal normal 12pt/12pt ″Palatino″, Times, serif; color: blue; /* running head of rotated page */ @left-middle { content: ″Page ″ -xpp-perl(xymacro,ri,’%p4’) -xpp-perl(xymacro,qa); -xpp-pl-bdy-vjmode : center; -xpp-pl-bdy-amount : 90;</p><p>5-24 CSS Paged Media Styling Content with CSS XML and CSS Examples</p><p>-xpp-pl-bdy-direction : counter; -xpp-pl-bdy-bx : 0; -xpp-pl-bdy-by : 10in; -xpp-pl-bdy-bsx : 9in; -xpp-pl-bdy-bsy : 1in; -xpp-pl-bdy-bgcolor: green; -xpp-pl-bdy-bgpattern: 50; } /* running foot of rotated page */ @right-middle { content: ″This is the default page footer.″ -xpp-perl(xymacro,qa); -xpp-pl-bdy-vjmode : center; -xpp-pl-bdy-amount : 90; -xpp-pl-bdy-direction : counter; -xpp-pl-bdy-bx : 7.5in; -xpp-pl-bdy-by : 10in; -xpp-pl-bdy-bsx : 9in; -xpp-pl-bdy-bsy : 1in; -xpp-pl-bdy-bgcolor: cyan; -xpp-pl-bdy-bgpattern: 50; } /* create user-defined block for rotated main text block */ @xpp-main-block1{ -xpp-pl-bdy-amount : 90; -xpp-pl-bdy-direction : counter; -xpp-pl-bdy-bx : 1in; -xpp-pl-bdy-by : 10in; -xpp-pl-bdy-bsx : 9in; -xpp-pl-bdy-bsy : 6.5in; -xpp-pl-bdy-bgcolor: magenta; -xpp-pl-bdy-bgpattern: 50; } }</p><p>/*------*/ /*content rules */ /*------*/ doc { display: -xpp-page; font: normal normal normal 12pt/12pt ″Palatino″, Palatino, serif; } ...</p><p>Styling Content with CSS CSS Paged Media 5-25 XML and CSS Examples</p><p>Results The following figure shows the rotated page rendered by XPP:</p><p>5-26 CSS Paged Media Styling Content with CSS Chapter 6</p><p>Exporting and Archiving</p><p>This chapter explains:</p><p>• Exporting an XPP Division in CSS-XML Mode • Archiving and Restoring CSS and XyPerl Styles</p><p>Styling Content with CSS Exporting and Archiving 6-1 Exporting an XPP Division in CSS-XML Mode</p><p>...... Exporting an XPP Division in CSS-XML Mode</p><p>You use the divxml command-line utility to export paginated XML content (an XPP division) while preserving CSS styles for down-stream processing. This XML output can be transformed, via XSL or other transformation tools, for many uses including HTML, ePub, or other custom formats.</p><p>When a division has been styled with CSS, you classify (identify) information about the tags using the -xpp-export-class and –xpp-widow-type CSS properties. Tags that share a common style are classified within a <group>.</p><p>When the XPP division is a CSS-XML division, you can control how divxml creates elements using the -xpp-widow-type CSS property. Whenever a CSS selector matches an element in the XPP division, you must specify a -xpp-widow-type of ″head″ or ″para″ if you want divxml to create a new element. If the CSS rule also includes an -xpp-export-class property, then the ″class″ attribute of the element in the XML output will be set to the value of that property.</p><p>Tip! Refer to the XML Professional Publisher: XML Export publication for more information.</p><p>Example 1: chapter title</p><p>In this example, the chapter tag starts a new line, the font weight is changed, and the content is output as an h1 HTML tag.</p><p>The CSS chapter title { display: -xpp-line; font-weight: bold; -xpp-export-class: ″h1″; -xpp-widow-type: head; }</p><p>The XML <chapter> <title>My Chapter

The first para...

6-2 Exporting and Archiving Styling Content with CSS Exporting an XPP Division in CSS-XML Mode

The DIVXML This is the chapter title.

Example 2: chapter p In this example, the font style is returned to normal, the paragraph also starts a new line, and the content is output as a

HTML tag.

The CSS chapter p { display: -xpp-line; font-style: normal; -xpp-export-class: ″p″; -xpp-widow-type: para; }

The DIVXML I am the first para in the first section of this chapter.

To export CSS style information

1. Open a command window in the directory containing the division.

2. Enter divxml [–options] filename.xml and press Return.

XPP exports a paginated XML division (content and CSS styles) to the same directory.

Styling Content with CSS Exporting and Archiving 6-3 Archiving and Restoring CSS and XyPerl Styles

...... Archiving and Restoring CSS and XyPerl Styles

The Archive/Restore utility lets you back up XyPerl and CSS styles, and restore them if necessary.

Refer to Chapter 13 “Archive/Restore Utility” in the XML Professional Publisher: Managing XPP publication.

6-4 Exporting and Archiving Styling Content with CSS Appendix A

Styling Modes

This appendix compares the formatting capabilities of the Item Format spec to the formatting capabilities of CSS style sheets.

Styling Content with CSS Styling Modes A-1 Comparing XML Mode to CSS-XML Mode

...... Comparing XML Mode to CSS-XML Mode

This table outlines composition and pagination differences between XML mode and the CSS-XML mode.

Table A-1 Mode Comparisons

In XML Mode In CSS-XML Mode

Formatting Controlled by the Item Format Spec. Controlled by CSS. Style composition will access the active CSS file based on the style bundle name. Additional CSS files can be included, as necessary.

Exception-based Overrides Not possible. Natively supported via multiple CSS tag selectors, the cascade, and priority of properties.

Style Reuse Tags are styled individually. Multiple tags can share the same style. CSS inheritance lets tags share common style properties. Exception rules change individual properties.

Tag Selection Uses Xpath. Uses the CSS Tag selector.

Page Control Hyphenation, Hung Punctuation, Page Hyphenation, Hung Punctuation, Page Style, and Page Columns are specified Style, and Page Columns are specified using sdedit. using sdedit.

Processing Instructions and XyMacros Processing Instructions are translated A processing instruction is translated into XyMacros, which can call other into a XyMacro, if it exists. If there is a XyMacros or a XyPerl script. XyMacro and a XyPerl script of the Note: Existing XyMacros from outside same name, the XyPerl subroutine will of CSS-XML mode are preserved. be used instead of the XyMacro. Note: XyMacros can also be called via -xpp-perl(xymacro, macro)

A-2 Styling Modes Styling Content with CSS Comparing XML Mode to CSS-XML Mode

Table A-1 Mode Comparisons (Continued)

In XML Mode In CSS-XML Mode

Property names and values All properties are addressed as fielded Wherever possible, standard CSS form data in the Item Format (if) Spec. property names and values are used. Note: Non-standard CSS properties and values are defined using the -xpp- prefix. For example, -xpp-widow-type -xpp-extra-lead

Counters Number registers use the and Counters are named elements that can XyMacros. be set, reset, or incremented within tags using standard CSS properties.

Suppressing Content A full item format rule is required for Set the display: none property on a each tag that is to be suppressed. The tag. suppress field must be set to yes.

Applying Rules Composition variables are re-applied by CSS selector rules are applied based on re-establishing their values from fields the job hierarchy. in all parent tags that are not marked as Note: Tags implemented as XyMacros active. using display: -xpp-macro do not If it is defined as an item format tag, restore a style after the XyMacro ends; you must set all of the fields to active; you must ensure that any style changes this can be difficult to manage. are restored in the end tag If it is defined as a processing XyMacro. instruction or XyMacro, you must either use the Ô rsml  XyMacro (subject to the same difficulties), or save and restore the font values.

Styling Content with CSS Styling Modes A-3 Comparing XML Mode to CSS-XML Mode

A-4 Styling Modes Styling Content with CSS Appendix B

Unicode Character Set

This appendix explains the Unicode Character Set.

Styling Content with CSS Unicode Character Set B-1 Unicode Characters

...... Unicode Characters

An escape sequence lets authors refer to Unicode characters in a CSS stylesheet. The backslash (\) escape sequence is followed by, at most, six hexadecimal digits (0..9 A..F), which represent the Unicode character with that number, which must not be zero. If a text character in the range (0-9 a-f A-F) follows the escape sequence, the end of the escape sequence needs to be made clear, either:

• with a space (or other white space character): ″\26 B″ • by providing exactly 6 hexadecimal digits: ″\000026B″

You can combine these two methods. Only one white space character is ignored after a hexadecimal escape; that is, a ″real″ space after the escape sequence must be doubled.

Unicode numbers can be escaped whenever they need to be output as computer-generated text. However, legacy XPP systems have some XCS glyphs that do not map directly to well-defined Unicode characters. In this case, the characters are mapped into the ″private use″ Unicode area, with a base offset of 0f0000 (hex).

To specify these characters in content, the internal Unicode character must be computed. For example, the XCS-spec contains XCS #159 (solid em box). However, it does not have a Unicode equivalent; therefore, you must specify ″\f009f″ considering the XCS private use area starts at ″0f0000″ and 159 (decimal) = 9f (hex). The same escape rules apply, so if there is a trailing character that resembles a hex digit, the special XCS character can be specified with either

• 6 digits (\0f009fB) • Filled with a trailing space (\f009f B)

B-2 Unicode Character Set Styling Content with CSS Appendix C

Unsupported CSS Properties

This appendix lists CSS properties that XPP does not support.

Styling Content with CSS Unsupported CSS Properties C-1 Unsupported CSS Properties

...... Unsupported CSS Properties

The following list of CSS properties have limited or no support in XPP.

Table C-1 Unsupported CSS Properties Property Property azimuth padding background page-break border pause bottom pitch-range, pitch caption-side play-during clear position clip richness cue right cursor speak direction speech-rate display (limited support) stress elevation table-layout empty-cells text-decoration float text-transform (limited font support) font-weight (limited top support) unicode-bidi height visibility left voice-family letter-spacing volume list white-space max-height, max-width widows min-height, min-width word-spacing orphans z-index outline overflow

C-2 Unsupported CSS Properties Styling Content with CSS Appendix D

Tabular Styles and CSS

This appendix describes the interplay of formatting rules specified in the tabular composition t5 spec, and those specified in CSS.

Important!

The content in this appendix is to support users who had previously styled CALS tables using the XPP 9.0.x release. There is now an alternative method for styling both CALS and HTML5 tables that yields more predictable results, especially where non-tabular tags are mixed with tabular tags in a HTML5 table cell.

See ″CALS Table Styling in CSS″ and ″HTML5 Tables″ in Chapter 4 for more information on this preferred method of styling HTLM5 tables in CSS-XML divisions.

Styling Content with CSS Tabular Styles and CSS D-1 CALS table formatting using only XyMacros

...... CALS table formatting using only XyMacros

In a CSS-XML division, table formatting is accomplished using the CALS table model, and is implemented using XPP XyMacros. This is specified in CSS by assigning a value of -xpp-macro to the display property of all the CALS table elements.

table,tgroup,colspec,spanspec,row,entry,thead,tbody { display: -xpp-macro; }

It is, however, sometimes necessary to use non-CALS XML elements in tabular cells. In these situations, the CSS rules determine the style properties used to format such elements. Furthermore, CSS rules are used to restore the style at the corresponding ’end’ tag.

However, if the composition style for each table cell is specified in the tabular composition t5 spec, this creates a problem because the tabular t5 style values are independent of the CSS rules. This can cause XPP to restore style values incorrectly when processing non-CALS XML elements within tabular cells.

Example

Composition style values for CALS table cells are defined in XPP’s composition (t5) spec.

Tip! To access XPP’s t5 spec, with your cursor in a table from the Softkey Menu click Menu > Activity > Manage Tables > Edit Style > Comp t5

Suppose you have the following composition values in your t5 spec:

font-height: 9q; (9 points) font-width: same; font-family:0; (StoneSans) font-variant:0; (normal)

and you would like to define a prompt element that sets the font-size to 80% of the current font size, you would then then need to create a CSS style rule such as the following:

prompt { font-size: 80%; }

D-2 Tabular Styles and CSS Styling Content with CSS CALS table formatting using only XyMacros

Now, if your CALS table is positioned within a doc/chap/para when you enter the prompt element, then your XPath would be:

doc/chap/para/table/group/tbody/row/entry/prompt

Also, in your CSS, you have defined your para style as:

para { font-size: 11pt; }

The prompt tag then has a font-size of 80%. The ’parent’ size at this point is determined by the doc/chap/para XPath, which is 11pt since none of the {table,tgroup,tbody,row,entry} tags has any CSS that affects the font-size. Therefore, the prompt tag sets a font-size of 11pt * 80% = 8.8pt.

This is wrong! You really expected a font-size of 9pt * 80% = 7.2pt because your t5 spec is set to 9pt. Also, at the end-tag , the size is restored to the font-size of the element, or 11pt. This is also wrong because you really expected your size to be restored to the value specified in the t5 spec, which is 9pt.

The only way to get the desired behavior is to set CSS properties for the tag to ensure that the font-size and other CSS properties corresponding to the t5 values are set and restored correctly. The following CSS rule will accomplish this:

doc para table entry { font-size: 9pt; font-family: ″StoneSans″,serif; font-weight: normal; font-style: normal; }

This will ensure that, no matter which non-tabular tags are entered into a table cell, the style is restored properly by XPP on seeing the corresponding end-tag. It will also ensure that if you have a tag inside your tag, the font-size is correctly computed to 9pt * 80%, which equates to 7.2pt.

Summary

The CSS cascading and inheritance mechanisms do not know that font changes may have been specified by the tabular composition (t5) spec, or by tabular override macros. CSS inheritance is based solely on the CSS properties set in the CSS rules, which are, in turn, based on the current XPath, such as the following:

doc/chap/para/table/tgroup/tbody/row/entry/prompt

Styling Content with CSS Tabular Styles and CSS D-3 CALS table formatting using only XyMacros

D-4 Tabular Styles and CSS Styling Content with CSS

SDL Group 201 Edgewater Drive Wakefield, MA 01880-6216 www.sdl.com