Subject: Re: [xsl] Perfomance: 'conditional instruction' vs. 'multi template' From: Michael Kay <mike@xxxxxxxxxxxx> Date: Sat, 03 Nov 2012 16:55:50 +0000 |
Michael Kay Saxonica
Hi everybody,
if a node is to be processed differently, depending on a certain condition, there are two approaches.
Let's say, the condition is "existance of child x".
Approach 1: two templates with different matching XPaths
<template match="thenode[child::x]"> b& do_this b& </template>
<template match="thenode[not(child::x)]"> b& do_that b& </template>
Approach 2: one template with a conditional instruction
<template match="thenode"> <xsl:choose> <xsl:when test="x"> b& do_this b& </xsl:when> <xsl:otherwise> b& do_that b& </xsl:otherwise> </xsl:choose> </template>
I wonder, if one of these approaches is to be favoured? Are there any severe implications on performance? Any other advantages / disadvantages that speak in favour of approach 1 or approach 2?
I am curious to read your estimations, Norbert
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Perfomance: 'conditional inst, Norbert Heidbrink | Thread | Re: [xsl] Perfomance: 'conditional , G. Ken Holman |
Re: [xsl] Text value templates in X, Michael Kay | Date | Re: [xsl] Perfomance: 'conditional , G. Ken Holman |
Month |