poster wrote:
> I am still thinking this through, so bear with me.
No problem.
> I understand that XXE, at its core, should provide a primitive set of editing
> operations.
> Document-specific ones can be defined by the document-type author.
>
> My main question is: can the basic editing operations set of XXE be
> improved?
Everything can be improved. The problem is that currently,
* there are already too many basic editing operations;
* the implementation of these basic editing operations is already
complex (especially the basic editing operations which act on the text
selection).
> For example, document types typically define collections of things. What
> would be appropriate primitive operations on these collections? One that
> I see quite often is "move this item (up or down) within this collection".
>
> As I understand it, I can do this today by "cut" and "paste" or "paste
> after". However, this has a very different user feel than a "move",
> where the element never disappears from the document. Imagine selecting
> an element, and then visually stepping it up or down in its containing
> collection.
>
> Would such an operation be appropriate for XXE to support?
Why not? However this can also be done using a document type specific
macro-command.
For example: this one will work for docbook's listitem.
---
<command name="moveListItemUp">
<macro undoable="true">
<sequence>
<command name="selectNode"
parameter="ancestorOrSelf[implicitElement] listitem callout
step" />
<match context="$selected" pattern="*[position() > 1]" />
<set variable="anchor" context="$selected"
expression="./preceding-sibling::*[1]" />
<command name="cut" />
<set variable="selected" expression="$anchor" />
<command name="paste" parameter="before" />
</sequence>
</macro>
</command>
---
See http://www.xmlmind.com/xmleditor/_distrib/docs/commands/ch04s02.html
See also Manuel Collado's more generic macro commands, which have been
posted today to this mailing list.
> What other tree-operations would be appropriate on any tree of elements
> governed by some schema? Such as "make an element A at the closest
> subsequent location (relative to current cursor or current selection)
> where A would be legal in the schema, and position cursor at the first
> editable position in that new A" ?
Generic command "add" does exactly that. See
http://www.xmlmind.com/xmleditor/_distrib/docs/commands/ch06s02.html
However, unlike for the "insert"/"replace"/"convert" commands, you
cannot pick element A from a list. You need to specify to command "add"
which element is to be inserted, and command "add" will find where.
That's why generic command "add" can only be used in document type
specific macros, in document type specific toolbars, in document type
specific menus, etc.