[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Using keys in templates
At 12:06 PM 7/13/2004, it was written:
When you specify which nodes are selected in your apply-templates call then there isn't ever any doubt which nodes are being processed or not. It's almost always better to specify exactly which nodes you want to process in an <xsl:apply-templates select=""/> then to either use ifs inside a template or a match on a template. My personal $0.02 is that while this contains an element of truth, it is overstated. The price in performance that you pay for using template matches to sort things out is actually going to be a problem in only a tiny fraction of cases (depending on your problems, dataset, and system specs of course). That is, I see only the most theoretical and potential of problems with <xsl:template match="one">Do something</xsl:template> <xsl:template match="two"><!-- do nothing --></xsl:template> ... and moreover, I think it's generally a mistake to distort your code, or not use techniques that are otherwise perfectly good, to avoid a problem you probably won't ever have. None of these rules are hard and fast; but typically I'll watch out for only the most egregious problems (using '//' from the root many times, for example, in a document not trivially small), unless I actually have a performance problem I have to address. (The post here doesn't actually say why it's supposed to be bad, but theoretical performance comparisons are the only argument I've seen.) Using template matches to filter nodes is not, IMHO, so egregious -- sometimes it even has a Taoist, XSLTish elegance to it -- and Nicolas evidently has a good reason to do it (and seemingly no performance problem on the horizon), so why not? Cheers, Wendell -----Original Message----- From: Nicolas Mailhot [mailto:Nicolas.Mailhot@xxxxxxxxxxx] ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
|
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
|