Cleaning out your GPX files
I noticed that my “all caches I may hope to find” file has grown tremendously since I starting putting Groundspeak’s info in (i.e. their tags in their namespace). I knew what was doing it — they put in all the logs in, which I don’t really care about. This morning, I was grabbing some caches to put in my GPS and noted that it was taken a while. So I looked at the size of the file. 18MB! Yeah, it was time to go something.
I decided that the best solution was an XSLT. “What? XSLT?!?” Yes. It’s not my favorite thing to do in the world, but writting a Python/Ruby script to do DOM work for this seemed too hard. I was going to delete nodes — a lot of nodes — on a file that was going to grow bigger over time. This was a job for XSLT.
And, just like I thought, it was fairly simple. Maybe one of the easiest XSLT’s you will ever see. Check it out here.
Oh, and my 18MB GPX file? It’s now 1.3MB.