[Home] [By Thread] [By Date] [Recent Entries]
G. Ken Holman wrote:
At 2007-04-17 15:02 -0400, Steve wrote:This one has me kind of stumped. Maybe I'm one of these people. What is the difference between for-each and apply-templates? I have a hard time even mentally comparing the two. Boolean algebra has always been difficult, boolean grammar even more. Whether is was yes or no, true or false, or push or pull. You can push a door open, or you can pull it, the result may be the same, but if the door can be opened to two sides, the results will differ. With apply-templates, you pull (as in grab) the data from the tree (or were it apples?) into the basket (the template match) and with for-each (and call-template), you push the data from the source tree with enough force right where you want it (like pushing a fat man through a small door: pulling is easier than pushing). The problem is that push and pull are easily mixed up (even more by non-native speakers) and depending on how you use the words (like above), either context suits. I find the connotation of 'pull' lighter and easier than the connotation of 'push'. Which is why I prefer to use the wording 'pull' for the (easier/lighter) apply-templates and push for the (harder) for-each (the fat man). Or is it the weather? Maybe, when it rains, the apples will grow large enough and I push them from the tree with apply-templates. I usually explain it to others like in: "with for-each _you_ tell the processor what to do, with apply-templates you let the _processor_ do the work for you". Sorry for adding to the confusion, Cheers, -- Abel
|

Cart



