Lets Start with the definitions first:
XML: XML is nothing but a NODED string.
XSLT is a declarative programming language, you write an XSLT stylesheet to transform XML to HTML or XML or plain text.
XSD is a schema language, you use it to define the possible structure and contents of an XML format. A validating parser can then check whether an XML instance document conforms to an XSD schema or a set of schemas.
Consider the below code to know more about the format of XML, XSD and XSLT.
Below is an example of a XML file: (person.xml)
<Persons xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Person>
<FirstName id="1">Kavita</FirstName>
<LastName>Khandhadia</LastName>
</Person>
<Person>
<FirstName id="2">Nishant</FirstName>
<LastName>Khandhadia</LastName>
</Person>
</Persons>
The above XML has been derived from the below schema file ( XSD File)
Now for above example there can be an XSD file like this.
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="Persons">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="Person"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Person">
<xs:complexType>
<xs:sequence>
<xs:element ref="FirstName"/>
<xs:element ref="LastName"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="FirstName">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:NCName">
<xs:attribute name="id" use="required" type="xs:integer"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="LastName" type="xs:NCName"/>
</xs:schema>
Now supppose in some case, instead of above person.xml, u want customer.xml which
takes data from person.xml but has totally different structure ..may be like this.
<?xml version='1.0' ?>
<Cusotmers>
<Customer>Kavita</Customer>
<Customer>Nishant</Customer>
</Cusotmers>
In such cases we use XSLT file. to transform person.xml to customer.xml(Above) - We use XSLT.
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<Cusotmers>
<xsl:for-each select="Persons/Person">
<Customer><xsl:value-of select="FirstName"/></Customer>
</xsl:for-each>
</Cusotmers>
</xsl:template>
</xsl:stylesheet>
In this way, we have