The following macro can be used to move a DocBook list item (listitem, callout or step) down in the list. How to move a DocBook list item up in the list can be found in "Using the XPath-based constructs match and set".
<command name="moveListItemDown">
<macro>
<sequence>
<command name="selectNode"
parameter="ancestorOrSelf[implicitElement] listitem callout step" />
<match context="$selected" pattern="*[position() < last()]" />
<set variable="anchor" context="$selected"
expression="./following-sibling::*[1]" />
<command name="cut" />
<set variable="selected" expression="$anchor" />
<command name="paste" parameter="after" />
</sequence>
</macro>
</command> | This step ensures that the macro can be executed only inside a list item. |
| This step ensures that the macro cannot be executed for last list item. It uses the XPath-based construct match. As a pseudo-command of a macro, it can be executed only if the context node specified in its This construct like pass, fail and test, is only a test. When match is actually executed, it does nothing at all. |
| This step saves in user variable named Variable
|
| Cut selected list item. |
| Select the list item saved in variable The selection is changed by assigning a node value to predefined variable |
| Paste the list item found in the clipboard after last selected list item. |