wrote:
> templates that should be conditionalized. Should I take it that you
> think this
> is a good method for accomplishing my goal? Or are there any drawbacks?
>
> Or perhaps a better way to do it?
>
> /Patrik Nyman
>
it's fine, although I'd use multiple templates rather than an xs:choose.
it looks neater and can be more efficient.
<xsl:template match="*">
<xsl:choose>
<xsl:when test="self::aaa">...
<xsl:when test="self::bbb">...
....
is more or less the same as
<xsl:template match="aaa">...
<xsl:template match="bbb">...
but in the first case, your system probably has to do a linear search of
the node against each test so expected time proportional to the number
of branches.
in the second case the system probably hashes the templates against the
match name at compile time so at run time doesn't have to test every
template.
this is of course all highly dependent on the processor, the processor
could in theory rewrite either form to the same internal expresssion, or
might not hash the templates or...
unless you have hundreds of choices in the choose it probably makes no
observable time difference, I think main attraction of having more
templates and less choose blocks is that it's just more the "xsl way"