[Home] [By Thread] [By Date] [Recent Entries]
On 5/31/06, Phillip B Oldham <phillip.oldham@xxxxxxxxxx> wrote:
Hi all Can be written as: <xsl:template match="/subscriptions/item[renewaldate]"> <!-- code for item with a renewal date --> </xsl:template> <1-- no-op template for item without a renewal date --> <xsl:template match="/subscriptions/item[not(renewaldate)]"/> Then just apply-templates as normal. Or use a select on the apply-templates to only process those items with a renewal date - one of the fundamentals of XSLT is to only select the nodes you want process, dont select all nodes and then try and break out. The main "rule" imho is to always use apply-templates over for-each, only use for-each to change the context node. Anyone thinking procedurally (coming from an OOP background) tends to reach for for-each first which is fine for very simple stylesheets by causes problems later, much better to use apply-templates and learn the flow of execution early on.
|

Cart



