<xsl:if> Element : Conditional template
Employees.xml:
<?xml version="1.0" encoding="utf-8" ?>
<Employees>
<Employee>
<Name>Vijai</Name>
<Id>1</Id>
<Designation>Associate</Designation>
<Location>Bangalore</Location>
<Department>SharePoint</Department>
<Experience>3</Experience>
</Employee>
<Employee>
<Name>Ranjith</Name>
<Id>2</Id>
<Designation>Associate</Designation>
<Location>Bangalore</Location>
<Department>SharePoint</Department>
<Experience>5</Experience>
</Employee>
<Employee>
<Name>Rakesh</Name>
<Id>3</Id>
<Designation>Associate</Designation>
<Location>Chennai</Location>
<Department>LN</Department>
<Experience>6</Experience>
</Employee>
<Employee>
<Name>Kavya</Name>
<Id>4</Id>
<Designation>Associate</Designation>
<Location>Chennai</Location>
<Department>LN</Department>
<Experience>3</Experience>
</Employee>
<Employee>
<Name>Pai</Name>
<Id>5</Id>
<Designation>Associate</Designation>
<Location>Chennai</Location>
<Department>LN</Department>
<Experience>3</Experience>
</Employee>
</Employees>
EmployeesXSL.xsl:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="Employees/Employee">
<div STYLE="font-weight:bold;
color:Green;font-style:italic">
<xsl:if test="Experience > 3">
<xsl:value-of select="Name"/>
</xsl:if>
</div>
</xsl:template>
</xsl:stylesheet>
Output:
Ranjith
Rakesh
Employee names will be displayed who has more than 3 years of experience.