"Duane Morin" <dmorin@morinfamily.com> wrote in message
news:554f29fd.0309140746.7dbcd7dd@posting.google.c om...[color=blue]
> Let me rephrase my question. I assume that matches are not like if's
> in the sense that they are all tested and thus the ones that fail are
> costing you extra processing time. I'll assume that only the proper
> matches are being executed, so that if my XML has A/foo and A/bar but
> not B/foo, match="A/foo" and match="A/bar" will succeed.
>
> So, different question -- does the length of the path matter? What if
> I did this:
>
> <xsl:template match="A">
> ...
> <xsl:template match="foo">
> ...
> </xsl:template>
> <xsl:template match="bar">
> ...
>
> Is that going to gain me anything? will match="foo" execute faster
> than match="A/foo" if I know that I'm inside A?[/color]
I don't know if this is going to "gain" anything, but the problem is that
the set of these three templates is not at all equivalent to the previous
templates:
[color=blue]
> <xsl:template match="A">
> ...[/color]
There was no template matching "A" before -- this is something totally
new -- most probably it will be useless.
[color=blue]
> <xsl:template match="foo">
> ...[/color]
This matches all "foo" nodes and not only "A/foo" nodes as before -- again
this is something quite different.
[color=blue]
> <xsl:template match="bar">[/color]
The same as above.
If the templates now match different sets of nodes, then most probably the
output of the transformation will change, therefore there must be concern
about the correctness of the transformation -- not about the efficiency of
an incorrect transformation.
=====
Cheers,
Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL