Pages: 1
Print
Author Topic: Showing attributes with element  (Read 834 times)
sapraaman
Member

Posts: 17


« on: June 22, 2010, 03:42:47 AM »

Hi,

Is it possible to display all the attributes of an element in the editor (next to element)? Is there a global option or something which enables that. Currently, the mouse cursor needs to be hovered on the element or attribute inspector needs to be displayed.

We are using XMetal 5.5

Thanks,
Aman
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 1552



WWW
« Reply #1 on: June 22, 2010, 03:32:41 PM »

You can do this with CSS or inside an XFT.

In CSS you can do something like so:

selector:before {
   display:block;
   border: 1px solid blue;
   content: "Attributes:\000a\0009" attr(attrName1) "\000a\0009" attr(attrName2);
}


The \xxxx Unicode character escaping notation in this case allows you to insert characters you might otherwise not be able to insert into a CSS content string (in my example carriage return and tab). This escaping is an undocumented and unofficial feature.

An older feature that still happens to work but that has not been documented since XMetaL 3.1 is this one:

selector {
   prefix-format: "%attribute-list;";
}


  • It must be specified as above, though you may include additional text inside the quotation marks before and after the %attribute-list; portion (which is what triggers the attribute values to be rendered).
  • Attributes with a value are listed in the form attrname="value" with spaces between each one.
  • Attributes without a value are not listed.
  • The selector must not use :before or :after.
  • It only displays when in Tags On view not Normal view.

We probably no longer document this as it predates the official CSS "attr", "before" and "content" keywords, and it is an XMetaL-only proprietary CSS property (SoftQuad had a few people on the CSS working groups up to CSS2 so likely they pushed for our version but apparently not hard enough). It is also "all or nothing": you don't get to pick which attributes to show and you don't get to mess with additional content like my previous example. The one convenience it provides is a quick way to show all attributes that have values without needing to list each name.
Logged
Pages: 1
Print
Jump to:  

email us