The Boston Diaries

The ongoing saga of a programmer who doesn't live in Boston, nor does he even like Boston, but yet named his weblog/journal “The Boston Diaries.”

Go figure.

Thursday, January 16, 2003

Snippits of an overheard conversation dealing with a convalescing motorcycle accident victim and his erstwhile friend who has a remarkable revelation to make

“Gregory, you've been a lot nicer since your accident, you know that?”

“I guess having a near-death experience will do that to you.”

“It's either that or the drugs.”


Alphabet Soup of the Viet-Cong

I started to convert my website to XML back in October but what with the holiday season and what not, that particular project got pushed back. But the past week or so I've resurrected that particular project and I've been immersed in XML, XSLT, HTML and CSS and other alphabet soups of technology.

I had started with converting my humor columns over to XML (of which I had converted about half) and wrote an XSLT file to convert them to XHTML. Earlier this week, I picked up where I resumed, converting the rest to XML and tweaking the templates. Given the recent brouhaha over XHTML, plus an inability of some older browsers to properly handle the XHTML markup, I rethought the notion of using XHTML and went back to HTML 4 strict (which is now an easy thing to do given I'm using templates).

I had started with one of the lower sections of my website and was working my way up (I had finished with Murphy's Law, now time to work on the High-Brow Literary Section) when I started having integration problems, mainly with XSLT. I was working on one template file for the writing section, and I already had a separate template file for the columns.

<?xml version="1.0" ?>

<xsl:stylesheet
        version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>

<xsl:include href="murphy/murphy.xsl"/>

writings.xsl

When I wasn't getting errors I was getting odd results. Perhaps it was still my unfamiliarity with XSLT and the differences between <xsl:include> and <xsl:import> but I was having a difficult trying to locate the source of the odd results, like spurious output when there shouldn't have been any.

I then switched to a top-down conversion, with a single XSLT file. I rewrote what I had, making naming changes to clarify what template what was and what was going on.

Whatever I did, it cleared up the problems I was having.

It's slow going, and XSLT is not the prettiest of languages to program in (and yes, it is Turing Complete so it is a programming language) and I'm still trying to get used to XPath expressions.

<xsl:call-template name="common-meta-tags">
  <xsl:with-param name="year"><xsl:value-of select="substring(@ref,1,4)"/></xsl:with-param>
</xsl:call-template>

<xsl:if test="position()&gt;1">
  <link 
	type="text/html" 
	rel="next"
	title="{preceding-sibling::about[position()=1]/attribute::date}"
	href="../{preceding-sibling::about[position()=1]/attribute::ref}.html"
  />
</xsl:if>

<xsl:if test="position()&lt;last()">
  <link 
	type="text/html" 
	rel="previous"
	title="{following-sibling::about/attribute::date}"
	href="../{following-sibling::about/attribute::ref}.html"
  />
</xsl:if>

site.xsl—Portion of code to generate the index of about pages

Yes, the relational operators like < have to be encoded as &lt; since this is XML—like I said, it's not pretty. And certain XPath expressions can use the short form, while others (such as selecting adjacent nodes with preceding-sibling and following-sibling) have to use the fully qualified notation and you have to know when that is (of the thirteen axis you can step by, child, descendant, descendant-or-self, parent, ancestor, ancestor-or-self, following-sibling, preceding-sibling, following, preceding, attribute, namespace or self only five can be expressed in a shorthand notation, self (as “.”), parent (as “‥”), child (as the name of the element), descentant-or-self (as “/”) or attribute (with a “@” preceding the name of the attribute)).

I hope you got all that (and I suspect I just lost all my readers at this point).

You also don't have variables, even though <xsl:variable> would lead you to think so; it's more a named constant than a variable.

It's stuff like this that reminds me of the Vietnam draftee Kansas farm boy walking through the jungles of South East Asia oblivious to the various trip wires the Viet-Cong have planted …

Obligatory Picture

[The future's so bright, I gotta wear shades]

Obligatory Contact Info

Obligatory Feeds

Obligatory Links

Obligatory Miscellaneous

You have my permission to link freely to any entry here. Go ahead, I won't bite. I promise.

The dates are the permanent links to that day's entries (or entry, if there is only one entry). The titles are the permanent links to that entry only. The format for the links are simple: Start with the base link for this site: https://boston.conman.org/, then add the date you are interested in, say 2000/08/01, so that would make the final URL:

https://boston.conman.org/2000/08/01

You can also specify the entire month by leaving off the day portion. You can even select an arbitrary portion of time.

You may also note subtle shading of the links and that's intentional: the “closer” the link is (relative to the page) the “brighter” it appears. It's an experiment in using color shading to denote the distance a link is from here. If you don't notice it, don't worry; it's not all that important.

It is assumed that every brand name, slogan, corporate name, symbol, design element, et cetera mentioned in these pages is a protected and/or trademarked entity, the sole property of its owner(s), and acknowledgement of this status is implied.

Copyright © 1999-2024 by Sean Conner. All Rights Reserved.