Home Forums General XMetaL Discussion Showing attributes with element Reply To: Showing attributes with element

Derek Read

Reply to: Showing attributes with element

You can do this with CSS or inside an XFT.

In CSS you can do something like so:

selector:before {
border: 1px solid blue;
content: "Attributes:00a009" attr(attrName1) "00a009" 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.