On 03/30/2012 03:38 AM, Stephen Tether wrote:
> XXE Personal Edition 5.2.0, RHEL5
>
> In my CSS style sheet for one of my document types I use
> replacement-content label() or xpath() to make a sort of poor man's
> write-inhibit for an element with a simple type, e.g.:
>
> foo {
> content: label(xpath, ".");
> }
>
> In the resulting styled view I can still click on the generated label
> and give it the keyboard focus, with the result that what I type
> afterward is inserted at the beginning of the element value. The change
> becomes visible when I refresh the styled view or switch to the tree view.
>
> I don't think this behavior was intended since editing is so severely
> restricted; there is no cursor visible nor can one remove the inserted
> characters while in the styled view. Labels should never get the
> keyboard focus which is why I used one here instead of a text field. I'm
> aware that one can write Java code to implement true read-only elements
> but I'm content to inhibit editing in the styled view only. The problem
> remains if I use xpath(), I haven't tried attr().
>
This is not a bug. You are simply using the wrong tool.
foo {
content: label(xpath, ".");
}
merely specifies how foo is *rendered* on screen in the styled view. You
can still edit it (with the caret hidden inside your custom graphic
representation of foo!) in the styled view. You can also open a tree
view side by side with the styled view (using "View|Add") and edit foo
using the tree view.
Note that the behavior you describe would also happen with the following
CSS rule:
foo {
content: url(image.png);
}
In order to implement ``write-inhibit'', you need to write an
OpenedDocumentHook in Java and declare it in a customize.xxe_gui file.
See
http://www.xmlmind.com/xmleditor/_distrib/doc/api/com/xmlmind/xmleditapp/kit/OpenedDocumentHookBase.html
See
http://www.xmlmind.com/xmleditor/_distrib/doc/gui/openedDocumentHook.html
This OpenedDocumentHook would leverage the readOnly property of XML nodes.
See
http://www.xmlmind.com/xmleditor/_distrib/doc/dev/dom.html#nodeproperties
See
http://www.xmlmind.com/xmleditor/_distrib/doc/api/com/xmlmind/xml/doc/Node.html#putProperty(com.xmlmind.xml.name.Name,%20java.lang.Object)
See
http://www.xmlmind.com/xmleditor/_distrib/doc/api/com/xmlmind/xml/doc/Constants.html#READ_ONLY_PROPERTY
This seems a bit frightening but in fact there is no technical
difficulty implementing such OpenedDocumentHook.
If you want to quickly play with this readOnly property, simply invoke
command setReadonly using "Tools|Execute Command" (keyboard shortcut:
Esc x) or bind this command to a keyboard shortcut.
See http://www.xmlmind.com/xmleditor/_distrib/doc/commands/setReadOnly.html
See http://www.xmlmind.com/xmleditor/_distrib/doc/help/toolsMenu.html
--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support