[Home] [By Thread] [By Date] [Recent Entries]
Hi Folks,
[Definition]
A quine is a computer program which takes no input
and produces a copy of its own source code as its only
output. The standard terms for these programs in the
computability theory and computer science literature
are self-replicating programs, self-reproducing programs,
and self-copying programs. [1]
Below is an XSLT program that is quine.
I wonder if it is possible to implement a quine in vanilla XML, perhaps using some clever tricks with entities and/or XInclude? That is, after parsing, the XML document contains a copy of itself, embedded in itself.
/Roger
-----------------------------------------------------------------
quine.xsl
-----------------------------------------------------------------
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:output method="xml" />
<xsl:template match="/">
<xsl:sequence select="document('')" />
</xsl:template>
</xsl:stylesheet>
[1] http://en.wikipedia.org/wiki/Quine_%28computing%29
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] |

Cart



