In case it's useful to anyone else, here's one solution for helping
authors conditionalize stuff in XML Mind. In DocBook, conditionalized
content is an element with the condition attribute set to some value.

Without some customization, XML Mind has two problems out of the box:

  a) You really need conditionalized content to be clearly indicated
     (for example a different background color). If you can't tell
     what's been marked up, editing the document can be impractical.

  b) Entering condition values by typing them is error-prone, and
     requires authors to know the valid values.

Problem a is easy to solve using CSS. But b is harder. I wanted to
add a pick list to the condition value field in the Attributes tool.
But not being a Java programmer, I gave up on this and turned instead
to Hussein's excellent css solution in
doc/csssupport/styling_attributes.html. It adds a set of radio buttons
to every instance of a selected element, allowing the author to choose
a value.

However, I want to handle ANY element, and it won't do to render
attributes everywhere. Instead, I want to present the radio buttons
only when I want to conditionalize a particular element.

My adaptation (css appended below) seems to do the trick. To use it,

1. Select any element.

2. Click in its condition value field in the Attributes tool, and press
Return. This causes the radio buttons to appear below the selection.

Note that entering an invalid value has the same effect as entering no
value.

3. Click one of the radio buttons to choose a condition, and press
Return. The radio buttons disappear and the selection is styled
for the condition.

===========
*[condition]:after {
     display: block;
     content: attributes();
}

*[condition]::attribute(condition) {
     attribute-content-left: "Conditions:";
     attribute-content-middle: radio-buttons(attribute, condition,
                                             labels,
                                             "unix\A win",
                                             values, "unix\A win");
     show-attribute: always;
     font-size: smaller;
}

*[condition="unix"] {
     border:0.5px solid #5F9EA0;
     background-color:#7FFFD4;
}

*[condition="win"] {
     border:0.5px solid #556B2F;
     background-color:#FAEBD7;
}

*[condition="unix"]:after,*[condition="win"]:after {display:none;}

Reply via email to