Marc van Grootel wrote:
> 
> We encountered something that seemed counterintuitive for us and we would 
> like to know what would be the best approach to resolve it.

"???" is here on purpose to *force* the user to specify an actual value.
Systematically choosing the default attribute value may be a very bad
idea for some applications (but probably not yours).



> 
> We have a CSS stylesheet that imports xmldata.css 
> (xxe-config:common/css/xmldata.css). In that CSS the add-attribute-button is 
> used to easily insert an attribute (using the + icon). This inserts the 
> attribute using "???" as the value. In our case we have a DTD that uses a 
> default attribute value. What we would like to achieve is that when an 
> attribute is inserted that it uses this default value as the default 
> selection for the dropdown or radio buttons.

You shouldn't take xmldata.css too seriously. This CSS stylesheet is
primarily meant to be used in prototypes and demos.



> 
> For example:
> 
> We have an attribute checktype with the following definition: 
> 
>   checktype (checkbox | textbox) "checkbox"
> 
> In our xmldata based view we can then add the checktype attribute and this 
> will show radio buttons for "checkbox" and "textbox". However it shows 
> "checkbox" selected (as if this is the current value) but the attribute 
> inspector shows the value "???". This confuses the authors that do not look 
> at the attribute inspector and they conclude, based on what they see in the 
> view, that "checkbox" is selected as the value.
> 
> Is there any generic way that we could add such an attribute with a default 
> value equal to the DTD default value?
> 
> We could start overriding all the places that need this behaviour but would 
> like to know if there is a better and generic solution for it.
> 

There is currently no way to tell add-attribute-button() to use the
default attribute value, if any. See
http://www.xmlmind.com/xmleditor/_distrib/doc/csssupport/add-attribute-button.html

*If* you are interested and *if* you can wait for next release
(~February 2010), we can add such option to add-attribute-button().

If this is implemented, you'll have to slightly modify xmldata.css:

---
...
                                 " ",
                                 convert-button(tool-tip, "Convert"),
                                 " ",
                                 delete-button(tool-tip, "Delete"),
                                 "  ",
                                 add-attribute-button(
                                      check-has-attributes, yes,
                                      use-default-attribute-value, yes,
                                      color, navy,
                                      tool-tip, "Add Attribute")),
...
---

Please confirm that you are interested, otherwise we'll not add this
option to add-attribute-button().



Reply via email to