Changeset 39101 in project


Ignore:
Timestamp:
11/05/20 10:05:31 (3 weeks ago)
Author:
svnwiki
Message:

Anonymous wiki edit for IP [78.85.4.246]: revert to 0.2 version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/5/sxml-modifications

    r38618 r39101  
    11[[tags:eggs]]
    22
    3 This is version 0.3 of the '''sxml-modifications''' extension library for Chicken Scheme.
     3This is version 0.2 of the '''sxml-modifications''' extension library for Chicken Scheme.
    44
    55[[toc:]]
     
    2020
    2121Some documentation is available in
    22 [[https://web.archive.org/web/20170608200039/http://modis.ispras.ru/Lizorkin/sxml-tutorial.html#hevea:modif|Dmitry
     22[[http://modis.ispras.ru/Lizorkin/sxml-tutorial.html#hevea:modif|Dmitry
    2323Lizorkin's tutorial]] and the [[http://ssax.sf.net|SSAX homepage]].
    2424Note that the SSAX documentation uses the more awkward and arbitrary
     
    3333expressions.
    3434
    35 <procedure>(sxml-modify [update-specifier ...])</procedure>
     35<procedure>(modify [update-specifier ...])</procedure>
    3636
    3737Returns a procedure which accepts a document and returns a modified
     
    9090
    9191<enscript highlight="scheme">
     92(import (prefix sxml-modifications sxmlm:))
     93
    9294(define doc
    9395  '(*TOP*
     
    100102        (cd (@ (title "Little Lion") (artist "Brooks Williams")))))))
    101103
    102 (define delete-recipient (sxml-modify '("purchaseOrder/recipient" delete)))
     104(define delete-recipient (sxmlm:modify '("purchaseOrder/recipient" delete)))
    103105(delete-recipient doc)
    104106=>
     
    111113
    112114;; 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)
    114116=>
    115117(*TOP*
     
    125127</enscript>
    126128
    127 <procedure>(sxml-modify! [update-specifier ...])</procedure>
    128 
    129 Destructively updating version of {{sxml-modify}}.  Like the
     129<procedure>(modify! [update-specifier ...])</procedure>
     130
     131Destructively updating version of {{modify}}.  Like the
    130132linear-updating variants of SRFI-1, you should use the return value of
    131133this procedure rather than assuming the original document was mutated
    132134in-place.
    133135
    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>
    140142
    141143These procedures all correspond to the action symbols accepted by
    142 {{sxml-modify}}.  There are no procedures corresponding to
     144{{modify}}.  There are no procedures corresponding to
    143145{{move-into}}, {{move-preceding}}, {{move-following}} or {{replace}}.
    144146
    145 The {{sxml-delete}} and {{sxml-delete-undeep}} procedures can only be
     147The {{delete}} and {{delete-undeep}} procedures can only be
    146148put directly into the action-parameters list as-is, which means this
    147149adds zero expressiveness over the corresponding symbols.
     
    153155node.
    154156
    155 The {{sxml-rename}} procedure accepts a symbol which indicates the new
     157The {{rename}} procedure accepts a symbol which indicates the new
    156158element name to use for the matched nodes.
    157159
    158 Here's the example from {{sxml-modify}} using these procedures instead
     160Here's the example from {{modify}} using these procedures instead
    159161of action symbols:
    160162
    161163<enscript highlight="scheme">
     164(prefix sxml-modifications sxmlm:)
     165
    162166(define doc
    163167  '(*TOP*
     
    170174        (cd (@ (title "Little Lion") (artist "Brooks Williams")))))))
    171175
    172 (define delete-recipient (sxml-modify `("purchaseOrder/recipient" ,sxml-delete)))
     176(define delete-recipient (sxmlm:modify `("purchaseOrder/recipient" ,sxmlm:delete)))
    173177(delete-recipient doc)
    174178=>
     
    181185
    182186;; 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-into
     187((sxmlm:modify `("purchaseOrder/recipient"
     188                ,(sxmlm:insert-into
    185189                  (lambda (context base-node)
    186190                    (list '(postalCode "05676") '(city "Footown"))))))
     
    203207=== Author
    204208
    205 [[http://okmij.org/ftp/|Oleg Kiselyov]], [[http://metapaper.net/|Kirill Lisovsky]], [[https://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]].
    206210
    207211=== Version history
    208212
    209 ; 0.3 : Add sxml- prefix to all exported functions
    210213; 0.2 : Ported to Chicken 5
    211214; 0.1 : First Chicken 4 release
Note: See TracChangeset for help on using the changeset viewer.