Pages: 1
Print
Author Topic: CSS: Hiding Specific PIs and Styling Selected PIs Differently  (Read 2948 times)
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 1548



WWW
« on: October 31, 2008, 03:51:57 PM »

Product(s):
XMetaL Author and XMAX versions 4.0+

Description:
It has been possible to style processing instructions as of XMetaL 2.1 using the XMetaL CSS selector extension $procins.

XMetaL Author and XMAX extended this capability starting with version 4.0. Different processing instructions can be styled based on their target and data values.

CSS Selector Syntax     Examples of Matching PIs
$procins[xm-pi-target="foo"]     <?foo?> or <?foo anything?>
$procins[xm-pi-data="bar bar"]     <?anything bar bar?>
$procins[xm-pi-target="foo"][xm-pi-data="bar bar"]     <?foo bar bar?>
   
The target value includes the first character after the PI opening question mark [?] up to but not including the first whitespace character. The target value cannot contain any spaces.

The data value includes the first character after the initial whitespace character up to but not including the PI closing question mark [?]. The data value may contain any number of spaces.

Normal CSS cascading rules apply as they do for other selectors used in XMetaL Author and XMAX.

Notes:
  • The $procins selector is proprietary and not part of the CSS recommendations.
  • You cannot override the built-in functionality of the XMetaL Author and XMAX change Tracking PIs using CSS.

Specific CSS Examples:
These PI examples are fictional. They are for demonstrating syntax and do not perform any special function in XMetaL Author or XMAX.

Hide all occurrences of any PI with a target called print, including: <?print index-start?>, <?print index-end?> and <?print page-break?>
Code:
$procins[xm-pi-target="print"] {
  display:none;
}

Hide all occurrences of <?print page-break?> but not <?print index-start?>
Code:
$procins[xm-pi-target="print"][xm-pi-data="page-break"] {
  display:none;
}

Color all PIs with a data value of index-start using blue text, including <?online index-start?> and <?print index-start?>
Code:
$procins[xm-pi-data="index-start"] {
  color:#0000ff;
}

External References:
Extensible Markup Language (XML) 1.0 "2.6 Processing Instructions" http://www.w3.org/TR/REC-xml/#sec-pi
« Last Edit: November 06, 2008, 07:03:08 PM by derekread » Logged
Pages: 1
Print
Jump to:  

email us