Thursday, 17 September 2009

Correct format for <title>s and XSL Stylsheets for sitemaps

This morning I spent some time looking at separators in website <title>s. I had started a thread on the websqueeze yesterday, and got some helpful info there. I also did some googling, which came up with a few blog posts, though the separator to use seemed to mostly be down to personal preference.

For the moment I've settled on the Interpunct·, though of course I may change my mind any time.

I also found this video on the Google Webmasters channel on youtube: Should I use pipes or dashes in my titles?


One of the comments there said about phrases with pipes | in not being found if someone searches for the exact phrase (except without the pipe |). I tried this, and found it to be true. For my test I used a page with the title The Man in Blue > Code & Beauty
Googling for "man in blue Code & Beauty" brings up approx 679 results with the real page at the top. Googling for "man in blue > Code & Beauty" brings up the same. Googling for the same phrase but with various different non-alpha-numeric characters instead of the > brings up the same results. But if I use a pipe | instead of a > I get no results (well actually you do get a page of results, as google shows the results for searching it not as a phrase. I checked my interpunct, and that worked okay.

The rest of the day I was mainly working on making an XSL Stylesheet to convert my sitemap to display as nicely formatted HTML in a browser. I did loads of googling to help me, but here are some resources that were particularly helpful:

Discussion about using an XSL Stylesheet to style your xml sitemap for web browsers: Sitemap Stylesheet (XSL).

Example XML Sitemap that is styled with an XSL Stylesheet for web browsers: Google Sitemaps Stylesheet 1.5 beta.

Google XML Sitemaps Wordpress plugin that uses an XSL Stylesheet to style the xml sitemap it creates for web browsers.

How you should format your sitemap/what it should include: Sitemaps XML format.

How to include other xml files in your page/XML file using an XSL Stylesheet: Reading Multiple Input Documents.

XPath substring function, useful for removing the domain of your site from all the urls listed in your sitemap when displaying them on a webpage using an XSL Stylesheet: XPath function: string substring (string, number, number?)

How to stop html elements you create in your XSL Stylesheet having a namespace attribute like xmlns=" ": [xsl] xmlns="" ?? (the answer is to add the html namespace as the default namespace in your XSL Stylesheet like
<xsl:stylesheet
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">


Adding DOCTYPE to XSL for output to XHTML file. The way I've been doing it on the main part of the website for IE is quite different to what is suggested there, though the method I was using for IE doesn't seem to work in Firefox. Using the method suggested at that link,
<xsl:output
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
When I viewed the generated source in Firefox, the Doctype declaration wasn't there, so I'm not sure if it worked or not. I also found that having method="html" as an attribute of the output, made Firefox not be able to load the page (it would just have the loading thing forever).

I spent a lot of time trying to figure out why things weren't working as well. Normally it was a syntax error, though one of the problems was also that I needed to specify the namespace that a document was in to be able to access the elements in that document.

Also today I went on Animal Crossing, went in the garden a few times (though didn't see any insects that would stay still), topped up the pond, put the washing out, did the washing up as usual (including scrubbing a saucepan with burnt on milk for ages), did 2 Japanese lessons, watched L go on Sims, and showed some photos to Shaz, L, Moccle, and Clare.

The weather was overcast all day.

Food
Breakfast: Lemon marmalade toast sandwich; cup o' tea.
Lunch: 2x cheese on toasts; salad; clementine; Caramel Rocky; cup o' tea.
Dinner: Chicken pie; green beans; carrots; roast potatoes; gravy. Pudding was 2x large Raisin and oat cookies. Coffee.

No comments: