0

hi i am trying to add style in xml file using xsl stylesheet ,both file in same folder but when i open my xml file into browser is show nothing ,if i remove xsl styling from xml file its show my xml file , please help me my xmlfile is below

<?xml-stylesheet type="text/xsl" href="url-link.xsl"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://www.sitemaps.org/schemas/sitemap/0.9
            http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<url>
<loc>https://kavishala.in/</loc>
<lastmod>2020-08-02T16:29:44+00:00</lastmod>
<priority>1.00</priority>
</url>
<url>
<loc>https://kavishala.in/post</loc>
<lastmod>2020-08-02T16:29:44+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://kavishala.in/events</loc>
<lastmod>2020-08-02T16:29:44+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://kavishala.in/chapters</loc>
<lastmod>2020-08-02T16:29:44+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://kavishala.in/authors</loc>
<lastmod>2020-08-02T16:29:44+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://kavishala.in/sootradhar</loc>
<lastmod>2020-08-02T16:29:44+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://kavishala.in/about</loc>
<lastmod>2020-08-02T16:29:44+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://kavishala.in/terms</loc>
<lastmod>2020-08-02T16:29:44+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://kavishala.in/Blog</loc>
<lastmod>2020-08-02T16:29:44+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
</urlset>

and my xsl file is

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"    xmlns:html="http://www.w3.org/TR/REC-html40"                   xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"                   xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <!-- <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/> -->
  <xsl:template match="/">
    <html>
      <head>
        <STYLE>      TH      {         background-color: #CCCCCC;      }      </STYLE>
      </head>
      <BODY align="center">
        <TABLE Border="1">
          <TR>
            <TH ColSpan="2" align="center">Kavisala XML</TH>
          </TR>
          <TR>
            <TH>Link</TH>
            <TH>Last modify</TH>
          </TR>
          <xsl:for-each select="urlset/url">
            <TR>
              <TD>
                <xsl:value-of select="loc"/>
              </TD>
              <TD>
                <xsl:value-of select="lastmod"/>
              </TD>
            </TR>
          </xsl:for-each>
        </TABLE>
      </BODY>
    </html>
  </xsl:template>
</xsl:stylesheet>

i am getting this enter image description here please help me i am stuck from very long time

pysaundary
  • 166
  • 2
  • 13
  • 1st:- Your xml file not proper tag 2nd:- change namespace Please change namespace:- xmlns:xsl="w3.org/1999/XSL/Transform" – Ajeet Singh Aug 10 '21 at 12:27
  • hi ajeet i figure out that my xml was not in proper tag ,i was trying to direct open in browser so it was not givving any error then i try in liveserver it show all tags problems,i solve all error but only static html like table head is show other is not showing. i am updating my question – pysaundary Aug 10 '21 at 12:39
  • open in internet explorer check it – Ajeet Singh Aug 10 '21 at 12:53
  • if i remove ``` xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1" ``` from inside urlset tag so all code work but when i addthat is stop working,i don't know these required or not i am using that for sitemap – pysaundary Aug 10 '21 at 12:58

0 Answers0