WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Webmaster Resources Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Webmaster Resources Discussion Forum Sitemaps and robots and logfiles -- Oh My! If you have any questions, comments, concerns and/or ideas about the tools currently available to webmasters to make their lives... 'easier'. Here's where you need to be. Know of a good tool? Post it here. Got something funny in your logfiles? Maybe we can help.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-12-2008, 07:22 AM
chandrika's Avatar
chandrika chandrika is offline
WebProWorld Veteran
 

Join Date: Oct 2005
Location: Cambridge, UK
Posts: 374
chandrika RepRank 1
Default Attaching a style sheet to an xml sitemap

Is it possible with an xml sitemap, to attach a style sheet to it, so that when the sitemap is viewed in a browser, the links will be clickable.

i get alot of traffic to my sitemap, so wanted to make it easy to get from the sitemap to an actual html page listed there, but am not sure whether this will make it not spiderable or any other problems with doing that.
__________________
Hairstyles - Pictures of 2008 hairstyles and a virtual hairstyler demo.
Price Comparison Site - Compare prices of well known brands and products.
Reply With Quote
  #2 (permalink)  
Old 05-12-2008, 11:06 AM
Dubbya's Avatar
Dubbya Dubbya is offline
WebProWorld 1,000+ Club
 

Join Date: Nov 2006
Location: Steinbach, Manitoba, Canada
Posts: 1,169
Dubbya RepRank 3Dubbya RepRank 3
Default Re: Attaching a style sheet to an xml sitemap

Absolutely!

How's that for a great answer!!!

It's easy as pie too.

GSiteCrawler will spider your site, generate a sitemap file and a gss.xsl stylesheet automatically.
__________________
Printer ink, inkjet & toner cartridges in Canada
"Price-wise printing supplies"
inkjetOasis.ca
Reply With Quote
  #3 (permalink)  
Old 05-12-2008, 12:20 PM
chandrika's Avatar
chandrika chandrika is offline
WebProWorld Veteran
 

Join Date: Oct 2005
Location: Cambridge, UK
Posts: 374
chandrika RepRank 1
Default Re: Attaching a style sheet to an xml sitemap

That is a great answer and would you believe it, I already have that program, I just obviously didnt read the manual properly and see what it could do! This will make my life easier, as I had just figured I needed an xsl stylesheet, but my experiments with them were not going too well.

Thanks
__________________
Hairstyles - Pictures of 2008 hairstyles and a virtual hairstyler demo.
Price Comparison Site - Compare prices of well known brands and products.
Reply With Quote
  #4 (permalink)  
Old 05-12-2008, 01:10 PM
Dubbya's Avatar
Dubbya Dubbya is offline
WebProWorld 1,000+ Club
 

Join Date: Nov 2006
Location: Steinbach, Manitoba, Canada
Posts: 1,169
Dubbya RepRank 3Dubbya RepRank 3
Default Re: Attaching a style sheet to an xml sitemap

You should be good to go. As long as your server supports xsl documents, you should just need to upload it and you'll be off to the races.
__________________
Printer ink, inkjet & toner cartridges in Canada
"Price-wise printing supplies"
inkjetOasis.ca
Reply With Quote
  #5 (permalink)  
Old 05-12-2008, 05:04 PM
jawn_tech's Avatar
jawn_tech jawn_tech is offline
Moderator
WebProWorld Moderator
 

Join Date: Jun 2004
Location: USA
Posts: 1,757
jawn_tech RepRank 2
Default Re: Attaching a style sheet to an xml sitemap

If you're hand-coding, your code could look something like this:

Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/css" href="chandrikastylesheet.css"?>
__________________
Get the facts! Fact Frenzy
Domains, Hosting, & Tools

Reply With Quote
  #6 (permalink)  
Old 05-12-2008, 05:27 PM
chandrika's Avatar
chandrika chandrika is offline
WebProWorld Veteran
 

Join Date: Oct 2005
Location: Cambridge, UK
Posts: 374
chandrika RepRank 1
Default Re: Attaching a style sheet to an xml sitemap

Can you use css to turn an xlm element into a link?

such as where you have
<LOC>somepageonasite.com</LOC>

Can you use css to turn that into a clickable link, or would you have to use xls to do that?

Somewhere some code needs to be written with the href tag being inserted, and I couldnt see how that could be done with css.
__________________
Hairstyles - Pictures of 2008 hairstyles and a virtual hairstyler demo.
Price Comparison Site - Compare prices of well known brands and products.
Reply With Quote
  #7 (permalink)  
Old 05-13-2008, 12:14 AM
hemalshah hemalshah is offline
WebProWorld New Member
 

Join Date: Dec 2007
Posts: 1
hemalshah RepRank 0
Default Re: Attaching a style sheet to an xml sitemap

hey,

is it possible the CSS file attaching with google xml sitemap?

if possible then pls anyone explain how is it? (with code)
Reply With Quote
  #8 (permalink)  
Old 05-13-2008, 02:11 AM
Dubbya's Avatar
Dubbya Dubbya is offline
WebProWorld 1,000+ Club
 

Join Date: Nov 2006
Location: Steinbach, Manitoba, Canada
Posts: 1,169
Dubbya RepRank 3Dubbya RepRank 3
Default Re: Attaching a style sheet to an xml sitemap

You can check out how to write your own XSLT Style sheets using these tutes:

XML.com: Style-free XSLT Style Sheets

XSLT Tutorial

This page shows how to pull the data from the xml file and format it into tables or simply push the data back to the browser:

TopXML : XSL Stylesheets - HTML

Scroll down to "LinksPull1, LinksPull2 or LinksPush1 to find the information you'll need to print out hyperlinks.

BTW, as you write it back to the browser, you can style it using CSS attributes.

This page from IBM WebSphere should give you the information you need to get going with incorporating CSS into your XSL file:
Improve your XSLT coding five ways

Good Luck
__________________
Printer ink, inkjet & toner cartridges in Canada
"Price-wise printing supplies"
inkjetOasis.ca
Reply With Quote
  #9 (permalink)  
Old 05-13-2008, 05:11 AM
chandrika's Avatar
chandrika chandrika is offline
WebProWorld Veteran
 

Join Date: Oct 2005
Location: Cambridge, UK
Posts: 374
chandrika RepRank 1
Default Re: Attaching a style sheet to an xml sitemap

Thanks Dubya, I appreciated the first reply, but it is good to know how to do it by hand. I hadnt been able to find any good tutorials on the subject.

Hemalshah, I think you are trying to do what I wanted too, as it is my google sitemap that I am trying to format here.

I have a site where my xml sitemaps get more traffic than my homepage, so really wanted for it to be properly linked to the main site. It may be beacuse my sitemap files have a .php extension, they are xml, but the xml is written by a php script.

Anyway, I needed to do something with them and I think the xls is the answer. Its new to me, but very interesting and useful to know about with many applications.
__________________
Hairstyles - Pictures of 2008 hairstyles and a virtual hairstyler demo.
Price Comparison Site - Compare prices of well known brands and products.
Reply With Quote
  #10 (permalink)  
Old 05-13-2008, 09:38 AM
wige's Avatar
wige wige is offline
Moderator
WebProWorld Moderator
 

Join Date: Jun 2006
Location: United States
Posts: 1,648
wige RepRank 4wige RepRank 4wige RepRank 4
Default Re: Attaching a style sheet to an xml sitemap

I have done something similar one one of my test domains, taking an entire web site of XML documents and using XSLT to convert the pages into web pages. If you want to see a practical working example, you can check out the site at TicketWarehouse.us. Although it is not an actual sitemap, if follows the same basic principles.

The first step is to add the link to the XSLT stylesheet in the sitemap itself:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://url.of/stylesheet.xsl" type="text/xsl" ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
   <url>
      <loc>http://www.example.com/</loc>
      <lastmod>2005-01-01</lastmod>
      <changefreq>monthly</changefreq>
      <priority>0.8</priority>
   </url>
</urlset>
The next step is to create the stylesheet itself. First, lay out the page you want the user to display in your favorite HTML editor. The code must be in HTML Strict, so that it can be put into the XSLT file, which is an XML document. The code must be fully standards compliant, as any errors could break the template. You should also keep the template as simple as possible. A very very basic XSLT file would be as follows:
Code:
<?xml version="1.0" encoding="ISO-8859-1"  ?> 
<xsl:stylesheet version="1.1"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:output method="html" /> 
<xsl:template match="/">
<html>
<head>
<title>Sitemap</title>
</head>
<body>
<h1>My Site Map</h1>
</body>
</html>
You will note the above code does not actually do anything with the data in the site map yet. That is the next step. First, you need to determine what elements you want converted into links. In an XML sitemap, links are stored in the <urlset> section, with each link represented by a <url> tag. However, since there is no title or description associated with these entries, all you could give the user is a long list of URLs, which link to your various pages. Use the following code (inserted after the </h1> tag in the code above) to list all of the URLs as links:

Code:
<xsl:template match="/urlset">
<xsl:for-each select="url">
<p>
<a href="{loc}">
<xsl:value-of select="loc" />
</a>
</p>
</xsl:for-each>
</xsl:template>
What this code snippet does is, if the XML file contains an element called "urlset", for each element within called "url", display the "loc" element as a link.
__________________
The best way to learn anything, is to question everything.
Interestingly Average Security Blog
Reply With Quote
  #11 (permalink)  
Old 05-13-2008, 11:37 AM
ron angel's Avatar
ron angel ron angel is offline
WebProWorld Pro
 

Join Date: Jan 2004
Location: london uk
Posts: 116
ron angel RepRank -1
Lightbulb Re: Attaching a style sheet to an xml sitemap

Quote:
Originally Posted by Dubbya View Post
Absolutely!

How's that for a great answer!!!

It's easy as pie too.

GSiteCrawler will spider your site, generate a sitemap file and a gss.xsl stylesheet automatically.
Thanks for this post gsitecrawler is the best program of its type I have seen. always best to check the file produced instead of using the auto ftp upload in case there maybe a duplicate file in the site map if you have the knowledge to do so. this is the site map of my site made by program, viewable in browser so no need for html ver on site!
http://www.ssrichardmontgomery.com/sitemap.xml
__________________
historical information links re uk and usa
http://www.ssrichardmontgomery.com
Reply With Quote
  #12 (permalink)  
Old 05-13-2008, 01:08 PM
chandrika's Avatar
chandrika chandrika is offline
WebProWorld Veteran
 

Join Date: Oct 2005
Location: Cambridge, UK
Posts: 374
chandrika RepRank 1
Default Re: Attaching a style sheet to an xml sitemap

That looks good ron angel, thanks for showing the results from gsitecrawler and thanks Wige for explaining how to use the xsl, I am going to get my head around using it, as there are all sorts of thing I am thinking it will be really useful for. Being able to format xml files into html that way, all sorts of exciting possibilities.

I am thinking is this used for mobile sites as well? I had been meaning to look into designing for mobiles and have a feeling this is something to do with that. I bought a few .mobi domains, and have never got round to developing them yet.
__________________
Hairstyles - Pictures of 2008 hairstyles and a virtual hairstyler demo.
Price Comparison Site - Compare prices of well known brands and products.
Reply With Quote
  #13 (permalink)  
Old 05-13-2008, 01:46 PM
wige's Avatar
wige wige is offline
Moderator
WebProWorld Moderator
 

Join Date: Jun 2006
Location: United States
Posts: 1,648
wige RepRank 4wige RepRank 4wige RepRank 4
Default Re: Attaching a style sheet to an xml sitemap

This won't work with mobile sites effectively. That was my goal with the .us site I mentioned, using XSLT to serve different templates based on platform. I have not been able to find any mobile web browser that will parse XSLT reliably. Even Opera does not acknowledge that this is a supported feature of their mobile browser. Internet Explorer and Opera also have a different implementation of XSLT than Firefox, which can cause issues if you want to use multiple style sheets.
__________________
The best way to learn anything, is to question everything.
Interestingly Average Security Blog
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Webmaster Resources Discussion Forum
Tags: sitemap, style sheet



Thread Tools
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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
designing style sheet for small screen Rod Abbotson Graphics & Design Discussion Forum 2 03-06-2008 02:58 PM
Style sheet switcher and hiding style sheets kgun Accessibility and Usability Forum 0 03-05-2007 09:43 AM
external style sheet bobby9101 Graphics & Design Discussion Forum 7 07-20-2005 02:55 PM
Need help creating an external CSS style sheet mattyw Services for Sale/Hire 1 04-06-2005 05:05 PM
Style sheet links Furlongs Graphics & Design Discussion Forum 1 06-09-2004 10:34 PM


Search Engine Friendly URLs by vBSEO 3.0.0