PXSL Tools 1.0: Your ticket out of XML Hell

Posted by Tom Moertel Tue, 18 Dec 2007 03:33:00 GMT

XML is fine for representing document-like things, but when it’s twisted to represent build recipes, configuration files, and little programming languages, it opens the gates to XML Hell. Once the gates are opened, the demons of cargo-cult thinking are loosed upon the world, where they are free to trick innocent programmers into working with grotesquely twisted XML documents – something no human mind was designed to comprehend. Ensnared, these programmers are slowly drawn into the depths of XML Hell, from which their lamentations echo across the universe.

When the demons of cargo-cult thinking come for you, don’t be ensnared! Instead, be prepared – with PXSL – the Parsimonious XML Shorthand Language (pronounced “pixel”).

What’s PXSL? It’s a luxurious, thermonuclear smoking jacket that you can slip on using a convenient preprocessor. Use it whenever you see grotesque XML on the horizon. Within PXSL’s plush (and stylish) protection, you can create all the nasty, twisted XML that may be demanded of you, but you need not descend into XML Hell to do it. Instead, you can work from the comfort of a well-stocked lounge, where clarity and conciseness are always on tap.

For example, here’s a snippet from an XSLT stylesheet, in the original XML:

<xsl:template match="/">
  <xsl:for-each select="//*/@src|//*/@href">
    <xsl:value-of select="."/>
    <xsl:text>&#10;</xsl:text>
  </xsl:for-each>
</xsl:template>

And here’s the same snippet, written in PXSL:

template /
  for-each //*/@src|//*/@href
    value-of .
    text <<&#10;>>

Isn’t that refreshing?

Why PXSL?

There are lots of XML shorthands available. (The PXSL FAQ lists about ten of them.) So why choose PXSL? Here’s why:

Also, PXSL is battle tested. It was first released in 2003 and has been saving people from XML Hell since. People who try it seem to like it:

  • I think PXSL could do wonders for soothing my irrational hatred for all things XML.kowey
  • Impressive… I converted some of my files from XML to PXSL and the readability was much improved.chris
  • Quite aside from the fact that XSLT is finally somewhat readable, the fact that you’ve added a serious macro system means that some serious scripting of XML can occur. I’m very impressed.invisible

The next time you’re headed for XML Hell, why not give the venerable PXSL a try? You might just find that you like it, too.


This public service announcement was brought to you in celebration of the 1.0 release of the pxsl-tools package. The PXSL-to-XML compiler pxslcc is written in Haskell and uses the cross-platform Haskell Cabal build/package system to let you use PXSL just about anywhere.

Posted in
Tags , , ,
8 comments
no trackbacks
Reddit Delicious

Comments

  1. Kristian said 5 days later:

    That’s very nice and all (and I remember you espousing PSXL before on HuSi), but what if one isn’t running Haskell? Any idea how har it would be to wrap this for, say, Python?

  2. Tom Moertel said 5 days later:

    Kristian, the PXSL-to-XML preprocessor is written in Haskell, but the result is a stand-alone binary – you don’t need to learn (or use) Haskell to use it. If you’re running Fedora Linux, for example, you can just install one of the pxsl-tools RPMs I’ve packaged, and you’ll be ready to roll. Other folks have contributed binaries for Windows and Mac OS X, but they are a bit out of date. (Contributions of more-recent versions are welcome.)

  3. Cory von Wallenstein said 20 days later:

    Thanks to your tip that I picked up last week, I’ve found myself requiring my XML validator probably about a quarter as often as I required when I was buried deep in XML Hell. Thanks!

  4. defel said 48 days later:

    Many thanks for PXSL .. I am using XML and XSL for years, and waited always for something like pxsl, great utility! :)

  5. Quark said 122 days later:

    1.0! Lovely :). I’ve been a PXSL user for years now. PXSL is a really nice language and a really elegant design.

    I use it for all web pages I generate from XML, and these days I use it for a fair number of configuration files too (e.g. for OPML for bookmarks).

    Thanks for the lovely tool Tom.

  6. Tom Moertel said 124 days later:

    Thanks for the kind words, Quark! You made my day.   :-)

  7. hdh said 195 days later:

    Hi, is there an emacs mode for PXSL? I see the PXSL page has “mode: outline” at the end, but I don’t see any use for it when editing PXSL.

  8. Tom Moertel said 195 days later:

    hdh, there is not a PXSL mode for Emacs, as far as I know.

    Writing one would be an interesting exercise. A simple PXSL mode, supporting only PXSL syntax, would be straightforward to implement. A more advanced PXSL mode, offering XML editing features within PXSL’s XML fragments (you can embedd XML in PXSL documents), would be a much more difficult project.

    If you (or anybody) is interested in writing a PXSL mode, I would be happy to add it to the official PXSL distribution. ;-)

    Cheers,
    Tom

Trackbacks

Use the following link to trackback from your own site:
http://blog.moertel.com/articles/trackback/672

(leave url/email »)

   Comment Markup Help Preview comment