Changeset 39101 in project
- Timestamp:
- 11/05/20 10:05:31 (4 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
wiki/eggref/5/sxml-modifications
r38618 r39101 1 1 [[tags:eggs]] 2 2 3 This is version 0. 3of the '''sxml-modifications''' extension library for Chicken Scheme.3 This is version 0.2 of the '''sxml-modifications''' extension library for Chicken Scheme. 4 4 5 5 [[toc:]] … … 20 20 21 21 Some documentation is available in 22 [[http s://web.archive.org/web/20170608200039/http://modis.ispras.ru/Lizorkin/sxml-tutorial.html#hevea:modif|Dmitry22 [[http://modis.ispras.ru/Lizorkin/sxml-tutorial.html#hevea:modif|Dmitry 23 23 Lizorkin's tutorial]] and the [[http://ssax.sf.net|SSAX homepage]]. 24 24 Note that the SSAX documentation uses the more awkward and arbitrary … … 33 33 expressions. 34 34 35 <procedure>( sxml-modify [update-specifier ...])</procedure>35 <procedure>(modify [update-specifier ...])</procedure> 36 36 37 37 Returns a procedure which accepts a document and returns a modified … … 90 90 91 91 <enscript highlight="scheme"> 92 (import (prefix sxml-modifications sxmlm:)) 93 92 94 (define doc 93 95 '(*TOP* … … 100 102 (cd (@ (title "Little Lion") (artist "Brooks Williams"))))))) 101 103 102 (define delete-recipient (sxml -modify '("purchaseOrder/recipient" delete)))104 (define delete-recipient (sxmlm:modify '("purchaseOrder/recipient" delete))) 103 105 (delete-recipient doc) 104 106 => … … 111 113 112 114 ;; insert-into accepts any number of action-parameters, being the node(s) to insert at the end 113 ((sxml -modify '("purchaseOrder/recipient" insert-into (postalCode "05676") (city "Footown"))) doc)115 ((sxmlm:modify '("purchaseOrder/recipient" insert-into (postalCode "05676") (city "Footown"))) doc) 114 116 => 115 117 (*TOP* … … 125 127 </enscript> 126 128 127 <procedure>( sxml-modify! [update-specifier ...])</procedure>128 129 Destructively updating version of {{ sxml-modify}}. Like the129 <procedure>(modify! [update-specifier ...])</procedure> 130 131 Destructively updating version of {{modify}}. Like the 130 132 linear-updating variants of SRFI-1, you should use the return value of 131 133 this procedure rather than assuming the original document was mutated 132 134 in-place. 133 135 134 <procedure>( sxml-insert-following node-specifier)</procedure>135 <procedure>( sxml-insert-preceding node-specifier)</procedure>136 <procedure>( sxml-insert-into node-specifier)</procedure>137 <procedure>( sxml-rename new-name)</procedure>138 <procedure> sxml-delete</procedure>139 <procedure> sxml-delete-undeep</procedure>136 <procedure>(insert-following node-specifier)</procedure> 137 <procedure>(insert-preceding node-specifier)</procedure> 138 <procedure>(insert-into node-specifier)</procedure> 139 <procedure>(rename new-name)</procedure> 140 <procedure>delete</procedure> 141 <procedure>delete-undeep</procedure> 140 142 141 143 These procedures all correspond to the action symbols accepted by 142 {{ sxml-modify}}. There are no procedures corresponding to144 {{modify}}. There are no procedures corresponding to 143 145 {{move-into}}, {{move-preceding}}, {{move-following}} or {{replace}}. 144 146 145 The {{ sxml-delete}} and {{sxml-delete-undeep}} procedures can only be147 The {{delete}} and {{delete-undeep}} procedures can only be 146 148 put directly into the action-parameters list as-is, which means this 147 149 adds zero expressiveness over the corresponding symbols. … … 153 155 node. 154 156 155 The {{ sxml-rename}} procedure accepts a symbol which indicates the new157 The {{rename}} procedure accepts a symbol which indicates the new 156 158 element name to use for the matched nodes. 157 159 158 Here's the example from {{ sxml-modify}} using these procedures instead160 Here's the example from {{modify}} using these procedures instead 159 161 of action symbols: 160 162 161 163 <enscript highlight="scheme"> 164 (prefix sxml-modifications sxmlm:) 165 162 166 (define doc 163 167 '(*TOP* … … 170 174 (cd (@ (title "Little Lion") (artist "Brooks Williams"))))))) 171 175 172 (define delete-recipient (sxml -modify `("purchaseOrder/recipient" ,sxml-delete)))176 (define delete-recipient (sxmlm:modify `("purchaseOrder/recipient" ,sxmlm:delete))) 173 177 (delete-recipient doc) 174 178 => … … 181 185 182 186 ;; insert-into accepts any number of action-parameters, being the node(s) to insert at the end 183 ((sxml -modify `("purchaseOrder/recipient"184 ,(sxml -insert-into187 ((sxmlm:modify `("purchaseOrder/recipient" 188 ,(sxmlm:insert-into 185 189 (lambda (context base-node) 186 190 (list '(postalCode "05676") '(city "Footown")))))) … … 203 207 === Author 204 208 205 [[http://okmij.org/ftp/|Oleg Kiselyov]], [[http://metapaper.net/|Kirill Lisovsky]], [[http s://web.archive.org/web/20171030192758/http://modis.ispras.ru/Lizorkin/|Dmitry Lizorkin]].209 [[http://okmij.org/ftp/|Oleg Kiselyov]], [[http://metapaper.net/|Kirill Lisovsky]], [[http://modis.ispras.ru/Lizorkin/index.html|Dmitry Lizorkin]]. 206 210 207 211 === Version history 208 212 209 ; 0.3 : Add sxml- prefix to all exported functions210 213 ; 0.2 : Ported to Chicken 5 211 214 ; 0.1 : First Chicken 4 release
Note: See TracChangeset
for help on using the changeset viewer.