Processing directive
From Friend2Friend Wiki
Processing directives (p.d.'s) are XML attributes to modify the effect of requests. They fall into 3 categories, according to when they take affect:
| pre-* | Applied to the <servicereq> before it is processed | |
| this-* | Applied to the output of the <servicereq> immediately it is processed. (The most useful of the 3). | |
| post-* | Applied to the output of the <servicereq> once it and any descendent requests have been carried out. |
When designing services, you should give thought to whether they can readily be achieved by use of p.d.'s with existing services. For example, a reverse service is unneeded, since the same effect could be achieved using
<servicereq function="http://friend2friend.net/services/identity" this-sort="[xpath to specify nodes whose kids need reversing]" this-sort-keys="position()" this-sort-order="0">
Most p.d.'s are Xpaths since this is an effective way of combining flexibility with brevity, and one familiar to XSLT authors. If a single XPath is insufficient to express the desired transformation, the preferred design option (since these may have to be created and/or processed by XSLT) is to use a set of p.d.s in combination, such as @pre-test and @pre-test-select. This policy is varied for cases where an unlimited number of xpaths would be needed ( *-sort, for sorting on multiple keys).
Two presentations are available on this subject: