XSL help

Daeva

In Runtime
Messages
407
I was hoping that someone can tell me what i'm doing wrong here. I have two files, one of them is my siteMap.xml file for google indexing, which it uses to reference the other pages on my site. The other file is an XSL file that I use to format that xml document.
The reason I format the document, is because the google engine doesn't load the XSL file, so it can still read it, and by formatting it, I can create a viewable xml file for my users if they need a sitemap. The problem is, the xsl isn't formatting the document, and when i change things aroung a little bit, it works, but it doesn't display the document properly. Here are the two files:

siteMap.xml:
Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type="text/xsl" href="siteMap.xsl"?>
 <urlset xmlns="[url="http://www.google.com/schemas/sitemap/0.84"]http://www.google.com/schemas/sitemap/0.84[/url]">
  <url>
   <loc>http://www.theraymonditgroup.com/index.html</loc>
   <lastmod>2007-03-20</lastmod>
   <changefreq>weekly</changefreq>
   <priority>1</priority>
  </url>
  <url>
	 <loc>http://www.theraymonditgroup.com/products.htm</loc>
	 <lastmod>2007-03-20</lastmod>
	 <changefreq>monthly</changefreq>
	 <priority>0.5</priority>
  </url>
  <url>
	 <loc>http://www.theraymonditgroup.com/services.htm</loc>
	 <lastmod>2007-03-20</lastmod>
	 <changefreq>monthly</changefreq>
	 <priority>0.5</priority>
  </url>
  <url>
	 <loc>http://www.theraymonditgroup.com/about.htm</loc>
	 <lastmod>2007-03-20</lastmod>
	 <changefreq>yearly</changefreq>
	 <priority>0.2</priority>
  </url>
  <url>
	 <loc>http://www.theraymonditgroup.com/contact.htm</loc>
	 <lastmod>2007-03-20</lastmod>
	 <changefreq>weekly</changefreq>
	 <priority>0.8</priority>
  </url>
 </urlset>

siteMap.xsl:
Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0"
	xmlns:xsl="[url="http://www.w3.org/1999/XSL/Transform"]http://www.w3.org/1999/XSL/Transform[/url]">
  <xsl:template match="/">
	<html>
	  <head>
		<title>The Raymond I.T. Group Inc. SiteMap</title>
	  </head>
	  <body>
		<table style="border: solid 1px #000000; padding: 2px; width: 200px; height: 400px;">
		  <thead>
			<tr>
			  <th colspan="1" valign="bottom" align="center" style="text-align: center;">
				Location
			  </th>
			  <th colspan="1" valign="bottom" align="center" style="text-align: center;">
				Last Mod
			  </th>
			</tr>
		  </thead>
		  <tbody>
			<xsl:for-each select="url">
				<tr>
				  <td colspan="1" valign="top" align="left">
					<xsl:value-of select="loc"/>
				  </td>
				  <td colspan="1" valign="top" align="left">
					<xsl:value-of select="lastmod"/>
				  </td>
				</tr>
			</xsl:for-each>
		  </tbody>
		</table>
	  </body>
	</html>
  </xsl:template>
</xsl:stylesheet>

Any suggestions would be greatly appreciated.
 
very weird...

the line linking to the schemas seems to be the root of the problem
Code:
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
but I know that that has to be there!

anyway, if you change the two files as such

Code:
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
becomes
Code:
<urlset>
in the sitemap.xml file

and
Code:
<xsl:template match="/">
becomes
Code:
<xsl:template match="urlset">

then it all seems to work fine, (as in the xml sheet is delivered as a 'user readable' way with a table with URLs).

I scanned through the Google documentation and it says that the link to the schema is necessary, but I'm a little confused as to why linking this schema seems to break the layout for regular users, or even why the link to the schema is necessary.

but since I'm at work I'll leave that for you to figure out.
 
Back
Top Bottom