Re: [xsl] Writing an optional element

Subject: Re: [xsl] Writing an optional element
From: Colin Paul Adams <colin@xxxxxxxxxxxxxxxxxx>
Date: 05 Jul 2004 20:41:53 +0100
>>>>> "Nestor" == Nestor Boscan <nestor.boscan@xxxxxxxxxx> writes:

    Nestor> Hi I have an XSL template that has to write an element
    Nestor> depending on a condition.
 
    Nestor> If Condition is true
 
    Nestor> <element> ... continue processing ...  </element>
 
    Nestor> If Condition is false
 
    Nestor> ... continue processing ...
 
    Nestor> Is there a better way to do it than:
 
    Nestor> <xsl:choose> <xsl:when test="condition"> <element>
    Nestor> ... processing instructions ...  </element> </xsl:when>
    Nestor> <xsl:otherwise> ... repeat processing instructions ...
    Nestor> </xsl:otherwise> </xsl:choose>
 
If by a better way, you mean you want to avoid writing the same
"continue processing" code, then you could call a named template
each time. Said named template to contain the common code.
-- 
Colin Paul Adams
Preston Lancashire

Current Thread