Tuesday, November 15, 2005

XSLT: Padding text output to the right width

I'm writing some XSLT that is supposed to generate a text file. I thought I needed to pad the fields with spaces to get them to the right width, but actually I don't, it is delimited text not fixed width.

Thought I better post this somewhere I can find it again if I need to :)



There's two named templates (read, functions), "spaces" that returns a specified number of spaces (up to 255), and one that uses spaces to do truncation or left-justification. Call it like this:



and the result will be the text "this is too short" with 23 spaces after it (making it 40 chars long).

Wednesday, November 02, 2005

JavaScript: Set membership

This is very cool:



This page is powered by Blogger. Isn't yours?