XML with Cascading Style Sheets

Understand the relationship between an XML document and Cascading Style Sheets (CSS) in Structured FrameMaker.

When an XML document is opened in Adobe FrameMaker, FrameMaker processes the Cascading Style Sheets 3 (CSS2) by mapping the CSS information to appropriate EDD rules in the EDD document.

The following scenarios describe the processing of CSS 3 in FrameMaker:

Note: An XML file opened in FrameMaker can contain multiple CSS files. FrameMaker supports the author’s style sheet only, and not the user’s style sheet.

Import CSS 3 element styles into an EDD file

You can import element formatting from CSS 3 into EDD to ensure consistent formatting across different XML applications. The CSS file can be referenced in the XML document or manually imported. Multiple CSS files can be imported sequentially for multi-level formatting.

When importing element styles, FrameMaker retains the context information (element property or selector) from the CSS and imports it into the appropriate EDD contexts.

Note: FrameMaker imports style information only at the element level.

You can also set CSS preferences in XML using Structured FrameMaker. For more information, see the Developing Structured Applications with Adobe FrameMaker.

  1. Open the EDD file in Structured FrameMaker.

  2. Choose Structure > Import CSS Styles. The Import CSS dialog box appears.

  3. Select a CSS file, and click Open.

  4. If the Structured Application element in the EDD file doesn’t define an application name, the Use Structured Application dialog box appears. Select the Structured Application that was used to create the EDD file. Click Continue.

The CSS file is imported into the EDD file.

Note: If the EDD already contains formatting rules, the CSS properties are appended to the existing rules. If the CSS properties overlap some of the existing rules, the CSS properties replace the existing rules in the EDD. The EDD doesn’t support all properties and selectors defined in CSS 3.0. If a property or selector in the CSS file can’t be mapped to an equivalent EDD rule, that property or selector is ignored. No error is displayed when this happens, and no error log is created.

After importing the CSS styles, you can import element definitions from the EDD into a template and use the template to open an XML file.

As an alternative to the CSS import process, you can use FrameMaker to open an XML file that already has CSS styles associated with it. When you open the XML file, FrameMaker reads the DTD and CSS files and generates a temporary template that is used to open the XML file.

Export CSS for a FrameMaker XML file

You can export XML style information available in your document for all elements using the Cascading Style Sheets 2 (CSS2) format, to an EDD file. You can then import these CSS Style definitions from the EDD file to new XML files. Cascading Style Sheets let authors attach styles, such as fonts and spacing, to structured XML files. CSS2 format is a W3C standard.

When you choose the Generate CSS2 command, styles from well-formed structured documents are generated, based on the formatting information available in the EDD associated with the source document. FrameMaker exports style information only at the element level. For example, if you apply a style to only one particular word in the Text element, that one instance of style is not exported.

You can set CSS2 preferences in the XML application. For example, you can determine whether the CSS2 file is automatically generated when you export to XML. For more information, see Developing Structured Applications with AdobeFrameMaker.

  1. Open the template or document with an associated EDD in Structured FrameMaker.

  2. Choose Structure > Generate CSS2….