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

Re: Print parent text

Subject: Re: Print parent text
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Fri, 24 Aug 2007 07:55:20 +0200
Re:  Print parent text
AAS Contractor wrote:
Or maybe even use a <xsl:choose> within a generic <emphasis> template. It
may not be as efficient as seperate matching templates (Michael?) but it's
a lot easier to understand if you're updating undocumented legacy code!
Especially if the code has been updated over some years and the various
possibly matching templates are dotted all over the place and you have to
work out all the relevant priorities :-(

Sounds like you are dealing with refactoring. In which case, I would definitely not choose an imperative approach because it is very likely that you miss one or two cases. Using template matching (which XSLT is all about) you make sure that your code becomes clearer and that you eliminate current mistakes and don't introduce new ones.


Sorry if that sounds like a rant, but it just happens to be a bit of a
bugbear of mine at present.

Well, everybody has his or her own preferences in coding. But when I see an xsl:choose in XSLT, I'd replace it with template matching (when it is about nodes). Same as with OO programming: when you see many switch/case or select/case statements, you know that you have to factor it out and make them objects, making the code easier to read and less buggy (Refactoring by Martin Fowler, page 255: Replace Conditional With Polymorphism)


Anyway, clarity is in the eye of the beholder. What is clear for me is not necessary clear for you, and in the case of XSLT: especially not if you come from an imperative world.

Cheers,
-- Abel Braaksma

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.