Re: Print parent text
Or maybe even use a <xsl:choose> within a generic <emphasis> template. It
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
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
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format