[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Perfomance: 'conditional instruction' vs. 'multi temp

Subject: Perfomance: 'conditional instruction' vs. 'multi template'
From: Norbert Heidbrink <nh@xxxxxxxx>
Date: Sat, 3 Nov 2012 16:24:04 +0100
 Perfomance: 'conditional instruction' vs. 'multi  temp
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.