Sign In/My Account | View Cart  
advertisement

Article:
 Shortening XSLT Stylesheets
Subject: Named templates
Date: 2003-06-19 13:09:50
From: Lars Marius Garshol

Perhaps the most obvious way to shorten stylesheets is to move repeated logic or code bits out into named templates. This can often dramatically shorten a stylesheet, and of course also contributes to its legibility.


Another trick is to inline templates whenever possible. That is, rather than keep something in a separate <xsl:template match="whatever">... you can just inline it through judicious use of <xsl:when> and <xsl:foreach>. Again, this also helps greatly to make the stylesheets more readable.


Previous Message Previous Message   Next Message No Next Message


Sponsored By: