- insert-following node-specifierprocedure
- insert-preceding node-specifierprocedure
- insert-into node-specifierprocedure
- rename new-nameprocedure
- deleteprocedure
- delete-undeepprocedure
These procedures all correspond to the action symbols accepted by modify. There are no procedures corresponding to move-into, move-preceding, move-following or replace.
The delete and delete-undeep procedures can only be put directly into the action-parameters list as-is, which means this adds zero expressiveness over the corresponding symbols.
The insert-following, insert-preceding and insert-into procedures all accept a node-specifier procedure of two arguments which must return a node or node-set which shall be inserted. The first argument of the procedure is the context, the second is the base node.
The rename procedure accepts a symbol which indicates the new element name to use for the matched nodes.
Here's the example from modify using these procedures instead of action symbols:
(prefix sxml-modifications sxmlm:) (define doc '(*TOP* (*PI* xml "version='1.0'") (purchaseOrder (@ (orderDate "07.23.2001")) (recipient (name "Dennis Scannell") (street "175 Perry Lea Side Road")) (order (cd (@ (title "Little Lion") (artist "Brooks Williams"))))))) (define delete-recipient (sxmlm:modify `("purchaseOrder/recipient" ,sxmlm:delete))) (delete-recipient doc) => (*TOP* (*PI* xml "version='1.0'") (purchaseOrder (@ (orderDate "07.23.2001")) ;; (recipient ...) is gone (order (cd (@ (title "Little Lion") (artist "Brooks Williams")))))) ;; insert-into accepts any number of action-parameters, being the node(s) to insert at the end ((sxmlm:modify `("purchaseOrder/recipient" ,(sxmlm:insert-into (lambda (context base-node) (list '(postalCode "05676") '(city "Footown")))))) doc) => (*TOP* (*PI* xml "version='1.0'") (purchaseOrder (@ (orderDate "07.23.2001")) (recipient (name "Dennis Scannell") (street "175 Perry Lea Side Road") (postalCode "05676") ; New (city "Footown")) ; New (order (cd (@ (title "Little Lion") (artist "Brooks Williams"))))))