 |

05-12-2008, 07:22 AM
|
 |
WebProWorld Veteran
|
|
Join Date: Oct 2005
Location: Cambridge, UK
Posts: 374
|
|
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.
|

05-12-2008, 11:06 AM
|
 |
WebProWorld 1,000+ Club
|
|
Join Date: Nov 2006
Location: Steinbach, Manitoba, Canada
Posts: 1,169
|
|
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.
|

05-12-2008, 12:20 PM
|
 |
WebProWorld Veteran
|
|
Join Date: Oct 2005
Location: Cambridge, UK
Posts: 374
|
|
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.
|

05-12-2008, 01:10 PM
|
 |
WebProWorld 1,000+ Club
|
|
Join Date: Nov 2006
Location: Steinbach, Manitoba, Canada
Posts: 1,169
|
|
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.
|

05-12-2008, 05:04 PM
|
 |
Moderator
|
|
Join Date: Jun 2004
Location: USA
Posts: 1,757
|
|
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"?>
|

05-12-2008, 05:27 PM
|
 |
WebProWorld Veteran
|
|
Join Date: Oct 2005
Location: Cambridge, UK
Posts: 374
|
|
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.
|

05-13-2008, 12:14 AM
|
|
WebProWorld New Member
|
|
Join Date: Dec 2007
Posts: 1
|
|
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)
|

05-13-2008, 02:11 AM
|
 |
WebProWorld 1,000+ Club
|
|
Join Date: Nov 2006
Location: Steinbach, Manitoba, Canada
Posts: 1,169
|
|
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
|

05-13-2008, 05:11 AM
|
 |
WebProWorld Veteran
|
|
Join Date: Oct 2005
Location: Cambridge, UK
Posts: 374
|
|
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.
|

05-13-2008, 09:38 AM
|
 |
Moderator
|
|
Join Date: Jun 2006
Location: United States
Posts: 1,648
|
|
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.
|

05-13-2008, 11:37 AM
|
 |
WebProWorld Pro
|
|
Join Date: Jan 2004
Location: london uk
Posts: 116
|
|
Re: Attaching a style sheet to an xml sitemap
Quote:
Originally Posted by Dubbya
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
|

05-13-2008, 01:08 PM
|
 |
WebProWorld Veteran
|
|
Join Date: Oct 2005
Location: Cambridge, UK
Posts: 374
|
|
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.
|

05-13-2008, 01:46 PM
|
 |
Moderator
|
|
Join Date: Jun 2006
Location: United States
Posts: 1,648
|
|
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.
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|