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>

<when test="graphic">

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

</when>

</select>

<serialize type="xhtml" />

</match>

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" />

</when>

<otherwise>

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

</when>

</select>

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

<serialize type="xhtml" />

</match>

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">

<aggregate>

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

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

</generate>

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

</aggregate>

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

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

<serialize type="xhtml" />

</match>

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