<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>XML,XSLT,XPath</title>
        <link>http://geekswithblogs.net/Shuvo/category/9641.aspx</link>
        <description>XML,XSLT,XPath</description>
        <language>en-US</language>
        <copyright>Tanveer-Ibn-Haresh</copyright>
        <managingEditor>ta_haresh@hotmail.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <item>
            <title>XPath Query</title>
            <link>http://geekswithblogs.net/Shuvo/archive/2009/02/18/xpath-query.aspx</link>
            <description>There are many tutorials explaining the syntax's of  XPathQuery. What gets me confused sometimes is the understanding of the match and select statements of the templates. Here is a simple example. The XML file that we are going to query is:&lt;br /&gt;
&lt;br /&gt;
&lt;span style="text-decoration: underline; font-weight: bold; color: rgb(0, 0, 255);"&gt;School.xml&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt; &amp;lt;?xml version="1.0"?&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt; &amp;lt;?xml-stylesheet type="text/xsl" href="Apply.xslt"?&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt; &amp;lt;School&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;   &amp;lt;title&amp;gt;The Xpath Exercise&amp;lt;/title&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;   &amp;lt;people&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;     &amp;lt;teacher&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;       &amp;lt;FirstName&amp;gt;Henry&amp;lt;/FirstName&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;       &amp;lt;age&amp;gt;45&amp;lt;/age&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;       &amp;lt;description&amp;gt;Henry will be the tutor&amp;lt;/description&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;      &amp;lt;/teacher&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;      &amp;lt;student&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;       &amp;lt;FirstName&amp;gt;Jack&amp;lt;/FirstName&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;       &amp;lt;age&amp;gt;15&amp;lt;/age&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;       &amp;lt;description&amp;gt; is an American&amp;lt;/description&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;       &amp;lt;FoodPref picture="dolores_001.jpg"&amp;gt;Sea Food&amp;lt;/FoodPref&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;     &amp;lt;/student&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;     &amp;lt;student&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;       &amp;lt;FirstName&amp;gt;Sorensen&amp;lt;/FirstName&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;       &amp;lt;age&amp;gt;16&amp;lt;/age&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;       &amp;lt;description&amp;gt; is a swedish&amp;lt;/description&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;       &amp;lt;/student&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;   &amp;lt;/people&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;   &amp;lt;furniture&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;     &amp;lt;chair&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;       &amp;lt;name&amp;gt;revolving chair&amp;lt;/name&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;     &amp;lt;/chair&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;   &amp;lt;/furniture&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt; &amp;lt;/School&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So we have a direct child of  root element &amp;lt;School&amp;gt;. School has two  child elements called &amp;lt;people&amp;gt; and &amp;lt;furniture&amp;gt; People has child elements called teacher and student. Now we only want to show the students.Their first name and description.Here is the XSLT file that we are going to use.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="text-decoration: underline; font-weight: bold; color: rgb(0, 0, 255);"&gt;Apply.xslt&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt; &amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt; &amp;lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;                 version="1.0"&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;   &amp;lt;xsl:output method="html"/&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;   &amp;lt;xsl:template match="/School"&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;     &amp;lt;html&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;       &amp;lt;body bgcolor="#FFFFFF"&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;         &amp;lt;h1&amp;gt;What do we know about our students ?&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;         Here are some information &amp;lt;ul&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;           &amp;lt;xsl:apply-templates select="people" /&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;         &amp;lt;/ul&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;       &amp;lt;/body&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;     &amp;lt;/html&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;   &amp;lt;/xsl:template&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;   &amp;lt;xsl:template match="people"&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;           &amp;lt;xsl:apply-templates select="student"/&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;    &amp;lt;/xsl:template&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;   &amp;lt;xsl:template match="student"&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;     &amp;lt;li&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;       &amp;lt;xsl:value-of select="FirstName"/&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;       &amp;lt;xsl:apply-templates select="description"/&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;     &amp;lt;/li&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;   &amp;lt;/xsl:template&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;   &lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt; &amp;lt;/xsl:stylesheet&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
The syntax for locating the direct child t of root node is &lt;span style="font-weight: bold;"&gt;/XML_ElementName&lt;/span&gt;. Lets look at the beginning of  our first template.&lt;br /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;xsl:template match="/School"&amp;gt;&lt;/span&gt;&lt;br /&gt;
 This defines the execution context of the template.It means the scope is the School element and the selection defined in this template will take effect on any school element in the output.&lt;br /&gt;
&lt;br /&gt;
Now comes the important part.&lt;br /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;xsl:apply-templates select="people" /&amp;gt;&lt;/span&gt;&lt;br /&gt;
This tells us that inside the school element, only the contents of the people element are going to be shown,so we are filtering out &amp;lt;furniture&amp;gt; here.&lt;br /&gt;
&lt;br /&gt;
In the next template, we are increasing the level of filtering. Here the context is defined as&lt;span style="color: rgb(0, 0, 255);"&gt; &amp;lt;xsl:template match="people"&amp;gt;&lt;/span&gt;.So this template is going to be applied on any people element in the output.So this is obviously going to be invoked by the first template call, as the first template is returning people element.The selection criteria here is &lt;br /&gt;
 &lt;span style="color: rgb(0, 0, 255);"&gt;  &amp;lt;xsl:apply-templates select="student"/&amp;gt;&lt;/span&gt;&lt;br /&gt;
So any people element will be showing ony the student elements inside it, leaving out the teacher element that we have.&lt;br /&gt;
&lt;br /&gt;
In the third step, we define a template for the student element itself. Till now all our endeavour was targeted at outputting a student element. So now we define how much information of the student we are going to show and how we want to show it. We want to show it as list elements.&lt;br /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;xsl:apply-templates select="description"/&amp;gt;&lt;/span&gt;&lt;br /&gt;
So we want to show the description element of the student. We also want to show the value of the FirstName element.This can be done with .&lt;br /&gt;
 &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;xsl:value-of select="FirstName"/&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
So if you open the School.xml file the output you get should be:&lt;br /&gt;
&lt;br /&gt;
&lt;img height="161" width="560" alt="" src="/images/geekswithblogs_net/Shuvo/TanveerShuvo/XPath(1).JPG" /&gt; &lt;img src="http://geekswithblogs.net/Shuvo/aggbug/129486.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Tanveer-Ibn-Haresh</dc:creator>
            <guid>http://geekswithblogs.net/Shuvo/archive/2009/02/18/xpath-query.aspx</guid>
            <pubDate>Wed, 18 Feb 2009 18:39:32 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/Shuvo/comments/129486.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/Shuvo/archive/2009/02/18/xpath-query.aspx#feedback</comments>
            <slash:comments>33</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/Shuvo/comments/commentRss/129486.aspx</wfw:commentRss>
        </item>
        <item>
            <title>How to refer a XSLT file in a XML Dcoment</title>
            <link>http://geekswithblogs.net/Shuvo/archive/2009/02/17/how-to-refer-a-xslt-file-in-a-xml-dcoment.aspx</link>
            <description>Suppose You have a XML File Jungle.xml.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;?xml version="1.0"?&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt; &amp;lt;project&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;   &amp;lt;title&amp;gt;The Xpath project&amp;lt;/title&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt; &amp;lt;problems&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;     &amp;lt;problem&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;       &amp;lt;title&amp;gt;Initial problem&amp;lt;/title&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;       &amp;lt;description&amp;gt;We have to learn something about Location Path&amp;lt;/description&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;       &amp;lt;difficulty level="5"&amp;gt;This problem should not be too hard&amp;lt;/difficulty&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;     &amp;lt;/problem&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;     &amp;lt;solutions&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;       &amp;lt;item val="low"&amp;gt;Buy a XSLT book&amp;lt;/item&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;       &amp;lt;item val="low"&amp;gt;Find an XSLT website&amp;lt;/item&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;       &amp;lt;item val="high"&amp;gt;Register for a XSLT course and do exercices&amp;lt;/item&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;     &amp;lt;/solutions&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;     &amp;lt;problem&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;       &amp;lt;title&amp;gt;Next problem&amp;lt;/title&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;       &amp;lt;description&amp;gt;We have to learn something about predicates&amp;lt;/description&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;       &amp;lt;difficulty level="6"&amp;gt;This problem is a bit more difficult&amp;lt;/difficulty&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;     &amp;lt;/problem&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;     &amp;lt;solutions&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;       &amp;lt;item val="low"&amp;gt;Buy a XSLT book&amp;lt;/item&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;       &amp;lt;item val="medium"&amp;gt;Read the specification and do some exercises&amp;lt;/item&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;       &amp;lt;item val="high"&amp;gt;Register for a XPath course and do exercices&amp;lt;/item&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;     &amp;lt;/solutions&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;   &amp;lt;/problems&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt; &amp;lt;/project&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
You have an XSLT file called Jungle.xslt file.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt; &amp;lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;                 version="1.0"&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;   &amp;lt;xsl:output method="html"/&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;   &amp;lt;xsl:template match="/project"&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;     &amp;lt;html&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;       &amp;lt;body bgcolor="#FFFFFF"&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;         &amp;lt;h1&amp;gt;&amp;lt;xsl:value-of select="title" /&amp;gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;         Here are the titles of our problems: &amp;lt;ul&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;         &amp;lt;xsl:apply-templates select="problems/problem" /&amp;gt; &lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;       &amp;lt;/ul&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;       &amp;lt;/body&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;     &amp;lt;/html&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;   &amp;lt;/xsl:template&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt; &amp;lt;xsl:template match="problems/problem"&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;   &amp;lt;li&amp;gt;&amp;lt;xsl:value-of select="title" /&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt; &amp;lt;/xsl:template&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt; &amp;lt;/xsl:stylesheet&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
So how do you refer this xslt file in the xml file? Simple just add this one line under the &amp;lt;?xml version Tag just like this..&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;?xml version="1.0"?&amp;gt;&lt;/span&gt;&lt;br style="color: rgb(0, 0, 255);" /&gt;
&lt;span style="color: rgb(0, 0, 255);"&gt; &amp;lt;?xml-stylesheet type="text/xsl" href="Jungle.xslt"?&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Now Open the xml file in IE without this stylesheet reference added and with added.You will see the difference. &lt;img src="http://geekswithblogs.net/Shuvo/aggbug/129451.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Tanveer-Ibn-Haresh</dc:creator>
            <guid>http://geekswithblogs.net/Shuvo/archive/2009/02/17/how-to-refer-a-xslt-file-in-a-xml-dcoment.aspx</guid>
            <pubDate>Tue, 17 Feb 2009 17:46:17 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/Shuvo/comments/129451.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/Shuvo/archive/2009/02/17/how-to-refer-a-xslt-file-in-a-xml-dcoment.aspx#feedback</comments>
            <slash:comments>53</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/Shuvo/comments/commentRss/129451.aspx</wfw:commentRss>
        </item>
    </channel>
</rss>
