Assuming that the question asks to output only EMpDetails whose Country child has a string (case-insensitive) value of "India":
I. This XSLT 1.0 transformation:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output omit-xml-declaration="yes" indent="yes"/> <xsl:strip-space elements="*"/> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> <xsl:template match= "EMpDetails [not(translate(Country, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz' ) ='india' ) ] "/> </xsl:stylesheet>
when applied on the provided XML document:
<EmployeList> <EMpDetails> <Name>Kiran</Name> <ID>ID001</ID> <city>Hyderabad</city> <Country>India</Country> </EMpDetails> <EMpDetails> <Name>Sunny</Name> <ID>ID002</ID> <city>Banglore</city> <Country>INDIA</Country> </EMpDetails> <EMpDetails> <Name>John</Name> <ID>ID001</ID> <city>TEXAS</city> <Country>US</Country> </EMpDetails> <EMpDetails> <Name>Raj</Name> <ID>ID006</ID> <city>Dallas</city> <Country>US</Country> </EMpDetails> <EMpDetails> <Name>Nag</Name> <ID>ID007</ID> <city>ITALY</city> <Country>Rome</Country> </EMpDetails> </EmployeList>
produces the wanted, correct result:
<EmployeList> <EMpDetails> <Name>Kiran</Name> <ID>ID001</ID> <city>Hyderabad</city> <Country>India</Country> </EMpDetails> <EMpDetails> <Name>Sunny</Name> <ID>ID002</ID> <city>Banglore</city> <Country>INDIA</Country> </EMpDetails> </EmployeList>
II. This XSLT 2.0 transformation:
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output omit-xml-declaration="yes" indent="yes"/> <xsl:strip-space elements="*"/> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> <xsl:template match= "EMpDetails[not(upper-case(Country)='INDIA')]"/> </xsl:stylesheet>
again produces the same, wanted and correct result.
Explanation: Overriding the identity rule with a template matching all unwanted EMpDetails elements. This template has empty body, which effectively prevents copying any such matched elements to the output.
Remember: Using and overriding the identity rule/template is the most fundamental and most powerful XSLT design pattern.
<Country>India</Country>?