I'd like my users to be able to use Del to delete empty text nodes and
empty elements without having to explicitly select them. I've got a
command that does what I want if the empty text node is not required.
But it doesn't seem to be able to detect if the text node cannot legally
be deleted. Any suggestions?
 
Here's my code:
 
<command name="smartDelete">

<macro>

<sequence>

<choice>

<sequence>

<!-- delete selection, if there is one -->

<pass><command name="delete"/></pass>

<command name="delete"/>

</sequence>

<sequence>

<!-- check for empty text node -->

<test expression="normalize-space(.)=''" context="$implicitNode"/>

<choice>

<sequence>

<!-- delete the empty text node, if possible -->

<pass><command name="delete" parameter="[implicitNode]"/></pass>

<command name="delete" parameter="[implicitNode]"/>

</sequence>

<sequence>

<!-- if not possible to remove text node, select text node and ask user
if they'd like to convert it to another element or delete the parent
element altogether. 

** the macro never gets to this point, because the previous sequence
always passes, even when the text node has not been deleted **

-->

<!-- haven't written this code yet .... -->

</sequence>

</choice>

</sequence>

<sequence>

<!-- not an empty text node, do normal deleteChar -->

<pass><command name="deleteChar"/></pass>

<command name="deleteChar"/>

</sequence>

</choice>

</sequence>

</macro>

</command>

 

Mark Fletcher

Workday(tm)

www.workday.com <http://www.workday.com/> 

925-951-9053 (office)

mark.fletcher at workday.com

 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.xmlmind.com/pipermail/xmleditor-support/attachments/20060512/6bd5864c/attachment.htm
 

Reply via email to