XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Self-replicating XML

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]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS