Denis Bradford wrote:
> 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;}
>
Thank you for describing this creative use of "content: attributes();"
--> Another way to suppress generated content is to use content:"";
That is, you could replace:
---
*[condition="unix"]:after,*[condition="win"]:after {display:none;}
---
by:
---
*[condition="unix"]:after,*[condition="win"]:after {content: "";}
---
--> Simpler alternative:
CSS (just this):
---
*[condition="unix"] {
border:0.5px solid #5F9EA0;
background-color:#7FFFD4;
}
*[condition="win"] {
border:0.5px solid #556B2F;
background-color:#FAEBD7;
}
---
Macro (add something like this to your customized docbook.xxe):
---
<binding>
<keyPressed code="F3" />
<command name="setCondition" />
</binding>
<command name="setCondition">
<macro>
<sequence>
<command name="pick"
parameter="'Value of attribute condition:' false 'unix' 'win'"/>
<command name="putAttribute"
parameter="[implicitElement] condition '%_'" />
</sequence>
</macro>
</command>
---
Note that the "pick" command supports autocompletion.
See
http://www.xmlmind.com/xmleditor/_distrib/doc/commands/pick.html
http://www.xmlmind.com/xmleditor/_distrib/doc/commands/putAttribute.html