Suppose You have a XML File Jungle.xml.
<?xml version="1.0"?>
<project>
<title>The Xpath project</title>
<problems>
<problem>
<title>Initial problem</title>
<description>We have to learn something about Location Path</description>
<difficulty level="5">This problem should not be too hard</difficulty>
</problem>
<solutions>
<item val="low">Buy a XSLT book</item>
<item val="low">Find an XSLT website</item>
<item val="high">Register for a XSLT course and do exercices</item>
</solutions>
<problem>
<title>Next problem</title>
<description>We have to learn something about predicates</description>
<difficulty level="6">This problem is a bit more difficult</difficulty>
</problem>
<solutions>
<item val="low">Buy a XSLT book</item>
<item val="medium">Read the specification and do some exercises</item>
<item val="high">Register for a XPath course and do exercices</item>
</solutions>
</problems>
</project>
You have an XSLT file called Jungle.xslt file.
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html"/>
<xsl:template match="/project">
<html>
<body bgcolor="#FFFFFF">
<h1><xsl:value-of select="title" /></h1>
Here are the titles of our problems: <ul>
<xsl:apply-templates select="problems/problem" />
</ul>
</body>
</html>
</xsl:template>
<xsl:template match="problems/problem">
<li><xsl:value-of select="title" /></li>
</xsl:template>
</xsl:stylesheet>
So how do you refer this xslt file in the xml file? Simple just add this one line under the <?xml version Tag just like this..
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="Jungle.xslt"?>
Now Open the xml file in IE without this stylesheet reference added and with added.You will see the difference.