Archive for the ‘Computers’ Category

Any XSLT/XPath experts out there? I’m a little bit stuck. I have a stylesheet that is effectively transforming XHTML into XHTML (best not to ask) and is matching any element with select = "xhtml:*". However, sometimes empty a elements creep into the original XHTML and get copied across to the output. These can play havoc with the CSS and JavaScript used on the final web page so I’d like to supress them.

How do I modify the select statement above to select all XHTML elements except for a elements that have either no text node children or have text node children composed solely of white space?

In other words if the input contains <a></a> or <a /> or <a> </a> then it should be skipped (assume for now that any attributes are irrelevant and that we’ll deal with the case where it contains another element node but no text nodes later).

I tried select = "xhtml:*[not(self::a[not(text())])][not(self::a[not(text() = ' ')])]" as a first stab but as well as being very ugly it doesn’t seem to be working. Any ideas?

Tags: ,

Evidence One

Evidence Two

Evidence Three

But don’t be too quick to blame Microsoft, etc. ‘cos this is nothing new. A couple of hundred years ago aristocrats would send illustrations of their coats of arms over to China to have them painted on china in order to produce the sort of dinner service that any self respecting stately home should possess. One nobleman decided to save a penny or two and instead of sending a colour illustration sent a black and white illustration with the colours indicated via labels, in English. You can guess the rest.

Got a short e-mail today about my StarDate Converter:

Have you considered making the current stardate available via RSS?

Hmm, interesting. First of all I’d have to translate the calculator to PHP or whatever to do the calculations on the server, but after that making the output available via RSS would be easy enough.

But would it be practical: the second decimal place represents a period of little over five minutes, so if someone wanted this to create a stardate ‘clock’ they’d be hitting my server at least that often. Not a disaster on its own but something that would need keeping an eye on if it proved popular.

Maybe I should test it out with the French Revolutionary Calendar first (I really need to convert that to PHP anyway so that the dates on this blog aren’t reliant on JavaScript). Hmmm, let’s see where this leads.