The xsl:if instruction do enables the conditional processing. The Stylesheet 1 demonstrates
the typical case of a xsl:for-each usage, adding up the text between the individual entries.
Often you do not want to add up the text after a last element. the xsl-if construct comes
handy here. (see to Stylesheet 2)
The xsl:choose element is used for the purpose of selection between the several
possibilities.
XML source
<?xml version="1.0"?>
<xslTutorial >
<SECTION>
<DATA>I need a pen.</DATA>
<DATA>I need some paper.</DATA>
<SUMMARY>I need a pen and some paper</SUMMARY>
</SECTION>
<SECTION>
<DATA>I need bread.</DATA>
<DATA>I need butter.</DATA>
</SECTION>
</xslTutorial>
HTML output 1
<HTML>
<HEAD> </HEAD>
<BODY>
<P>SUMMARY: I need a pen and some paper</P>
<P>DATA: I need bread.</P>
<P>DATA: I need butter.</P>
</BODY>
</HTML>