Go Back   Computer Forums > Web Design | Website Development > Web Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 03-29-2007, 03:24 PM   #1
In Runtime
 
Daeva's Avatar
 
Join Date: Dec 2005
Posts: 407
Send a message via AIM to Daeva Send a message via MSN to Daeva Send a message via Yahoo to Daeva
Default XSL help

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="http://www.google.com/schemas/sitemap/0.84">
  <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="http://www.w3.org/1999/XSL/Transform">
  <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.
__________________

__________________
**Official Self-proclaimed glorified excessive (insert additional adjectives here) post editor/modifier.
Edit = Best feature ever
http://www.twitter.com/xDaevax
Daeva is offline   Reply With Quote
Old 04-04-2007, 07:51 AM   #2
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,006
Default Re: XSL help

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.
__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 07:13 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0