Subject: [xsl] Apply Templates, when to use which? how do templates work? From: "John Smith" <debrief@xxxxxxxxx> Date: Tue, 28 Aug 2007 12:05:25 +0100 |
Hello, The concept of templates is confusing me a bit as I am used to think of functions like imperative programming languages. So... 0. Does <apply-templates select="xyz" /> perform a match on the xyz node??? xyz node and all its immediate children only??? or xyz node and all descendants of xyz node? 1. Does <template match="xyz"> ... </template> match xyz regardless of whether I wanted it do do so or not? What I'm trying to say there is no starting point of execution which I can use to then decide which template should be applied at any given moment??? 2. If all templates are looked at for their match criteria regardless, then what is the point of having the following two different forms??? <apply-templates /> and <apply-templates select="xyz" /> 3. As there is also the "call-template" form of using a template, why should one not always use that instead???, as it appears more easy to understand in terms of the flow of the program. I know xsl is not executed like other "normal(imperative)" programming languages, but when using apply-template I feel like I lose control of what is happening when and in which order. 4. What's the best practice for using applying templates in terms of when to use which form?? <apply-templates /> <apply-templates select="xyz" /> <apply-templates select="xyz" mode="foo" /> <call-template name="bar" /> 5. Is it possible to use apply-templates without the "select" attribute but with a "mode" attribute??? 6. Is it possible to call-template where the template has a "match" attribute as well??? If so how does it work? I mean, does it call the template and the template checks for the match on the context node? or do the call-template and the "match" apply at different times, as in not both at the same time? 7 thanks, John
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] best way, Abel Braaksma | Thread | Re: [xsl] Apply Templates, when to , David Carlisle |
[xsl] best way, nnaemeka david | Date | Re: [xsl] XSL SPECS, B Tommie Usdin |
Month |