title: XSLT not working to attach stylesheet to XML
body: <pre><code>Element root = document.createElement(&quot;urlset&quot;);
      document.setXmlStandalone(true);
      document.appendChild(root);
      root.setAttribute(&quot;xmlns&quot;, &quot;http://www.sitemaps.org/schemas/sitemap/0.9&quot;);
      root.setAttribute(&quot;xmlns:xhtml&quot;, &quot;http://www.w3.org/1999/xhtml&quot;);
      
      org.w3c.dom.ProcessingInstruction pi = document.createProcessingInstruction(&quot;xml-stylesheet&quot;, &quot;type=\&quot;text/xsl\&quot; href=\&quot;C:\\\\CanonWebApp\\\\utility\\\\sitemap.xslt encoding=\\\&quot;utf-8\&quot;&quot;);
  
        document.insertBefore((Node) pi, root);
        document.setXmlStandalone(true);
  </code></pre>
  <p><img src="https://i.stack.imgur.com/B0eRB.png" alt="xml image" /></p>
  <p>I am adding stylesheet using processing instruction to my xml. I have kept stylesheet in my local but still, I am getting error as below screenshot:</p>
  <p>&quot;This XML file does not appear to have any style information associated with it. The document tree is shown below.&quot;</p>