title: XML Namespaces, Schema validation(XSD) and XSLT
body: <p>I have a XML file with the following structure:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;?xml-stylesheet type="text/xsl" href="studentsStylesheet.xsl"?&gt;
  &lt;students xmlns="urn:students"&gt;
    &lt;student&gt;
      ...
    &lt;/student&gt;
  &lt;/students&gt;
  </code></pre>
  
  <p>A XSD schema:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;xs:schema targetNamespace="urn:students"
             xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
    &lt;xs:element name="students"&gt;
      ...        
    &lt;/xs:element&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>And a XSL file for visualization(studentsStylesheet.xsl):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
    &lt;xsl:template match="/"&gt;
      &lt;html&gt;
        ...
      &lt;/html&gt;
    &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>I am currently taking a short course on XML and have a task to construct a given XSD schema and some sample records in a XML file and then visualize the content as a HTML in the end using XSLT. One of the tasks stated that I need to use "urn:students" as a default namespace for the structure. However, when I do that, I don't receive the data in the final visualization. When I remove the "xmlns="urn:students"" from the XML file, everything works fine. I have read a couple of materials and tutorials on XML namespaces, but I just got more confused. It should be the same as in the normal programming languages, but in the same time it is quite different. I didn't find a clear explanation about the following things:</p>
  
  <ol>
  <li>How to link a XML to a schema? Do I need to link the file to the schema or vice versa? On every article/tutorial I read, there was a different way to achieve that and it was not explained why.</li>
  <li>Which namespaces should I include in such a situation in both the XML and the Schema.</li>
  </ol>
  
  <p>I also can't understand what's the exact problem with the "xmlns="urn:students"" definition in the XML file. Aren't the elements defined properly in the schema, which has the same namespace? Why can't the XSL pull the data?</p>