Archive

Archive for January, 2008

SharpTools: HTTP, GET, POST, uploading files and cookie/session authentication in C#

January 26, 2008 2 comments

SharpTools is a general tool library for C#. This release simplifies using HTTP GET, POST, uploading files and cookie persistence when writing .NET applications in C#. Read more…

Advertisements

XSL Date & Time Library

January 26, 2008 Leave a comment

XSL Date & Time Library is an XSL stylesheet which provides various date and time functions for use within your own XSL stylesheets. Read more…

How to tidy up badly formatted XML with an XSL stylesheet

January 21, 2008 1 comment

How do you turn this:

<broadcastScheduler><!-- ================================================================ --><!--
CURRENT SHOWS --><!-- ================================================================ --><recurr
ingBroadcast href="show-varee-season-2" indexStart="26" recurFrequency="14"><firstAirDate channel
="d2" date="2007-09-21T22:00:00-06:00" dstRules="us" automaticStartup="false"/><firstAirDate chan
nel="d1" date="2007-10-05T22:00:00+00:00" dstRules="eu" automaticStartup="true"/></recurringBroad
cast><recurringBroadcast href="show-dan-ascherl-season-1" indexStart="6" recurFrequency="1md"><fi
rstAirDate channel="d1" date="2007-05-04T22:00:00+01:00" dstRules="eu" automaticStartup="true"/><
firstAirDate channel="d2" date="2007-05-04T22:00:00-05:00" dstRules="us" automaticStartup="true"/
><firstAirDate channel="d1" date="2007-05-18T22:00:00+01:00" dstRules="eu" automaticStartup="true
"/><firstAirDate channel="d2" date="2007-05-18T22:00:00-05:00" dstRules="us" automaticStartup="tr
ue"/></recurringBroadcast><recurringBroadcast href="show-bent-killer-season-1" indexStart="21" re
curFrequency="14"><firstAirDate channel="d1" date="2007-08-29T19:30:00+01:00" dstRules="eu" autom
aticStartup="true"/><firstAirDate channel="d2" date="2007-08-29T19:30:00-05:00" dstRules="us" aut
omaticStartup="true"/></recurringBroadcast><recurringBroadcast href="show-serge-season-1" indexSt
art="6" recurFrequency="7"><firstAirDate channel="d1" date="2007-05-04T22:00:00+02:00" dstRules="
eu" automaticStartup="true"/><firstAirDate channel="d2" date="2007-05-04T21:00:00-05:00" dstRules
="us" automaticStartup="true"/></recurringBroadcast><recurringBroadcast href="show-neil-bowles-se
ason-1" indexStart="15" recurFrequency="14"><firstAirDate channel="d1" date="2007-11-01T23:00:00+
01:00" dstRules="eu" automaticStartup="true"/><firstAirDate channel="d2" date="2007-11-01T23:00:0
0-05:00" dstRules="us" automaticStartup="true"/></recurringBroadcast>

into this:

<broadcastScheduler>
<!-- ================================================================ -->
<!-- CURRENT SHOWS -->
<!-- ================================================================ -->
  <recurringBroadcast href="show-varee-season-2" indexStart="26" recurFrequency="14">
    <firstAirDate channel="d2" date="2007-09-21T22:00:00-06:00" dstRules="us" automaticStartup="false"/>
    <firstAirDate channel="d1" date="2007-10-05T22:00:00+00:00" dstRules="eu" automaticStartup="true"/>
  </recurringBroadcast>
  <recurringBroadcast href="show-dan-ascherl-season-1" indexStart="6" recurFrequency="1md">
    <firstAirDate channel="d1" date="2007-05-04T22:00:00+01:00" dstRules="eu" automaticStartup="true"/>
    <firstAirDate channel="d2" date="2007-05-04T22:00:00-05:00" dstRules="us" automaticStartup="true"/>
    <firstAirDate channel="d1" date="2007-05-18T22:00:00+01:00" dstRules="eu" automaticStartup="true"/>
    <firstAirDate channel="d2" date="2007-05-18T22:00:00-05:00" dstRules="us" automaticStartup="true"/>
  </recurringBroadcast>
  <recurringBroadcast href="show-bent-killer-season-1" indexStart="21" recurFrequency="14">
    <firstAirDate channel="d1" date="2007-08-29T19:30:00+01:00" dstRules="eu" automaticStartup="true"/>
    <firstAirDate channel="d2" date="2007-08-29T19:30:00-05:00" dstRules="us" automaticStartup="true"/>
  </recurringBroadcast>
  <recurringBroadcast href="show-serge-season-1" indexStart="6" recurFrequency="7">
    <firstAirDate channel="d1" date="2007-05-04T22:00:00+02:00" dstRules="eu" automaticStartup="true"/>
    <firstAirDate channel="d2" date="2007-05-04T21:00:00-05:00" dstRules="us" automaticStartup="true"/>
  </recurringBroadcast>
  <recurringBroadcast href="show-neil-bowles-season-1" indexStart="15" recurFrequency="14">
    <firstAirDate channel="d1" date="2007-11-01T23:00:00+01:00" dstRules="eu" automaticStartup="true"/>
    <firstAirDate channel="d2" date="2007-11-01T23:00:00-05:00" dstRules="us" automaticStartup="true"/>
  </recurringBroadcast>

3,000 lines of the above was the horror I woke upto one day when PHP decided to stop formatting automated changes to our radio schedules properly. We need our schedules XML to be human-readable so I had to come up with a quick way to reformat it. Read more…

Categories: XSL Tags:
%d bloggers like this: