1. For Christmas
2. It seems you want to launch an obfuscated XSLT contest... ;-)
3. More fun
4. The game of life
5. Game of Life-2, in XSLT
6. Happy Birthday XSLT.


For Christmas

Mike Kay

A Christmas cracker

If anyone is not yet convinced that we have a rather
remarkable language on our hands, try applying this

<a xmlns:xsl="" xsl:version="1.0">
<xsl:value-of select="*******************"/>

to this document


Have fun!



It seems you want to launch an obfuscated XSLT contest... ;-)

Marty McKeever

> I can't remember where i found this one, but it's kinda fun:

 <xsl:stylesheet version="1.0"
 <xsl:output indent="yes"/>
 <xsl:variable  name="abc"
 <xsl:template match="*">
    <xsl:element name="{translate(name(),$abc,$rot13)}">
       <xsl:for-each select="@*">
          <xsl:attribute name="{translate(name(),$abc,$rot13)}">
 		<xsl:value-of select="translate(.,$abc,$rot13)"/>
 	<xsl:for-each select="text()">
 	<xsl:value-of select="translate(.,$abc,$rot13)"/>
 	<xsl:apply-templates select="*"/>


More fun

David Carlisle and Mike Ball

Try this, run it through any xslt engine, with itself as the input file.

From: David Carlisle - today's stylesheet?

<stylesheet xmlns=""
version="1.0"><output method="text"/><variable name="x"
select="'td&#xA;p HiaBr'"/><template match="*"><value-of
select="translate('xra  yw23k6hFGyw6ow','6Fx wr3G2k',$x)"/>
<choose><when test="position()=3"><value-of select=
</choose></template><template match="/*"><apply-templates

Mike Ball quickly replied

<?xml version='1.0'?><stylesheet
xmlns="" version="1.0"><output
method="text"/><variable name="x" select="')elco:rsgv-&#xA; '"/><template
match="*"><value-of select="translate('x!.zfza !.b39 p71','1z.!bpa93f7x
',$x)"/></template><template match="/*"><apply-templates

Ed: This is, I believe how the guru's write their stylesheets:-)


The game of life

Roger Costello

I have implemented the Game of Life using XSLT.

It's kinda neat! It nicely demonstrates some aspects of complex systems such as evolution, attractors and feedback.

For example, here is a simple starting configuration (a filled-in square means it's a live cell, an empty square means it's a dead cell): orig.html

After applying the rules of Life once, the configuration evolves to this: out1.html Then, after applying the rules of Life to that output (i.e., feedback), the configuration evolves to this: out2.html Below I chronicle the configuration's evolution. It settles into a repeating pattern when it gets to the sixth iteration (the pattern alternates between configuration 5 and 6 indefinitely). These two states represents an "attractor". out3.html, out4.html, out5.html out6.html Each configuration is represented as an XML document. Here is the initial configuration: orig-Input.xml

Here is the stylesheet which applies the Life rules, and produces the next configuration: GameOfLife.xsl Here is a stylesheet which creates a graphical image of a configuration: GameOfLifeViewer.xsl Many thanks to Tom Passin, Len Bullard, Didier Martin and Bob Foster for their excellent suggestions and insight!


Game of Life-2, in XSLT

Roger Costello

I have modified the Game of Life stylesheet so that now it adapts based upon interaction with a "Population Control" stylesheet. The Population Control monitors the population (number of live cells) that the Game of Life is producing.

input.xml -> PopulationControl.xsl -> new-input.xml -> GameOfLife.xsl

-> input2.xml -> PopulationControl.xsl -> new-input2.xml

-> GameOfLife.xsl -> input3.xml -> PopulationControl.xsl -> ...

If the population is too low then the Population Control instructs the Game of Life to increase its population. The Game of Life accomplishes this by dynamically modifying its built-in rules such that the modified rules increase the likelihood of growth.

If the population is too high then the Population Control instructs the Game of Life to decrease its population. Again, the Game of Life accomplishes this by dynamically modifying its built-in rules to discourage growth.

Thus, there is a dynamic interaction between the Game of Life and Population Control. The Game of Life continually alters (adapts) itself based upon input from Population Control.

Here is a simple animation of the Game of Life as it interacts with Population Control (thanks to Bob DuCharme for showing me how to create this HTML animation):

Here is the new version of the Game of Life stylesheet: Here is the Population Control stylesheet: Many thanks to Didier and Len for their help and suggestions.


Happy Birthday XSLT.

Dimitre and Jorris.

Sent to the list on 10 Febrary 2005

<stylesheet version="1.0" xmlns=""> <output method="xml"/><template match="/"><for-each select="document('')/*"><element name="{translate(*[1]/@*,'*xaybzcl','*iaybzcg')}" namespace=""> <attribute name="{translate(*[1]/@*,'*xaymzcl','*sayrzcc')}"> <value-of select="concat(concat(substring-before(namespace::*,'1'), '2003/02/'),(document(concat(substring-before(namespace::*,'1'), '2003/02/',*[1]/@*,translate(local-name(*[2]/@*), 'mch','--'),count(//*)-2,'.html'))//*[contains(text(),'!')][1]/following::*/@src)[1])"/> </attribute></element></for-each></template></stylesheet>

and from Joris

 <stylesheet version="1.0" 
 <output method="xml"/><template match="/"><for-each 
 select="document('')/*"> <copy-of