XML with Cascading Style Sheets

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

The following scenarios describe the processing of CSS2 in FrameMaker:

You open an EDD in FrameMaker and use the Import CSS Styles option in the StructureTools menu. FrameMaker checks whether the current document is an EDD. If so, the Open dialog box appears and you can specify the CSS file path. The CSS is then imported into the EDD. You can then import the element definitions from the EDD into a template to use when you open an XML file. If the EDD contains formatting rules, the CSS properties are appended to the existing rules if the properties are unique. Alternatively, the CSS properties you import will overwrite the existing formatting rules of the EDD. You can also export XML style information to an EDD for all elements in a document that use the CSS2 format, using the Generate CSS2 option in the StructureTools menu.

When you open an XML file that is associated (using xml-style sheet PI) with style sheets, FrameMaker reads the DTD and the style sheet associated with the XML document, and then generates a temporary template to use for opening the XML file. However, if a template is already specified in the “Structured Application” (used to open the XML file), FrameMaker uses that template to open the XML file and will not generate any new template from the DTD and style sheets.

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 element styles into an EDD file

You can import element formatting from CSS 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 Structured FrameMaker Developer's Guide, located in the Documents folder.

1)Open the EDD file in structured FrameMaker.

2)Select StructureTools > 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 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 2.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 defini­tions 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 CSS 2 preferences in the XML application. For example, you can determine whether the CSS 2 file is automatically generated when you export to XML. For more information, see the online manual, Developing Structured Applications with Adobe FrameMaker on the Adobe website, www.adobe.com/go/lr_FrameMaker_support_en.

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

2)Select StructureTools > Generate CSS2.


September 30, 2016

Legal Notices | Online Privacy Policy