[Home] [By Thread] [By Date] [Recent Entries]
At 2013-10-18 13:50 +0000, David Lee wrote: To my thinking (perhaps why I struggle with XSLT) ... an <apply-templates> is essentially a GOTOI disagree. To me <xsl:apply-templates> isn't a "GOTO" it is a "Handle this" ... it is an event generator. It generates an event for every node addressed by pushing that node at your stylesheet. No, to me it is more like an event handler. And you can have many event handlers that will handle the event based on the properties expected of the handler. That is why there is a rule in XSLT that only one template rule can fire for each node pushed by the apply templates: there can be only one handler for every event (though that handler can trigger other events, even on the same node).and a <template> is a state description. In a GOTO you know where you are going to. In XSLT when you say "handle this", you are letting the processor decide which handler is going to handle it from the handlers you've prepared. You don't really know which is going to handle it because your set of handlers might be overridden by an importing stylesheet that is supplying a different set of handlers. Which is all good, because perhaps you need to change the behaviour and your set of handlers is read-only ... the importing stylesheet simply catches the node pushed at your stylesheet before the stylesheet finds it. The pattern matching ,to me, just adds to the difficulty of understanding the GOTO's Perhaps because they shouldn't be regarded as "GOTO"s in the first place. ... as it makesHave a go at trying to picture it as event generation and event handling. This is how I explain it to my students. Check out the diagrams on pages 23, 247 and 251 of my XSLT book that is available for free download on a "try and buy" basis at http://www.CraneSoftwrights.com/training/#ptux ... if you decide not to pay for the book, please delete the copy that you download for free. . . . . . . . . . . . Ken -- Public XSLT, XSL-FO, UBL & code list classes: Melbourne, AU May 2014 | Contact us for world-wide XML consulting and instructor-led training | Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm | Crane Softwrights Ltd. http://www.CraneSoftwrights.com/x/ | G. Ken Holman mailto:gkholman@C... | Google+ profile: https://plus.google.com/116832879756988317389/about | Legal business disclaimers: http://www.CraneSoftwrights.com/legal |
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] |

Cart



