Spent the weekend hacking and I now have selectors in Pycoon (my Cocoon rip-off).

Its amazing how adding just one little feature seems to make the whole framework appear more usable. You can now do things like this:

<match type="uri" pattern="/">

<generate type="file" src="index.xml" />

<select type="browser-class">

<when test="text">

<transform type="xslt" src="page2simple.xslt" />


<when test="graphic">

<transform type="xslt" src="page2fancy.xslt" />



<serialize type="xhtml" />


Or, even better, return NOT_ACCEPTABLE errors to MSIE users just for giggles:

<match type="uri" pattern="/special">

<select type="browser">

<when test="msie">

<throw error-code="406" />



<generate type="file" src="answer-to-the-universe.xml" />



<transform type="xslt" src="page2html.xslt" />

<serialize type="xhtml" />


And I added selectors for "resource exists" and "request parameter" which are quite nifty (in fact, they were ideas stolen from Cocoon).

I also added an http_generator which allows you to get your XML source streams using HTTP requests:

<match type="uri" pattern="/news">


<generate type="http" src="http://newsrss.bbc.co.uk/rss.xml">

<parameter name="edition" value="uk" />


<generate type="http" src="http://planet.alug.org.uk/rss20.xml" />


<transform type="xslt" src="news2html.xslt" />

<transform type="xslt" src="apply-page-furniture.xslt" />

<serialize type="xhtml" />


Now I'm looking forward to the 0.0.1 release ;-)