W3C home > Mailing lists > Public > xproc-dev@w3.org > August 2011

RE: The XProc Quine

From: David Lee <dlee@calldei.com>
Date: Thu, 11 Aug 2011 13:32:09 -0400
To: "'George Cristian Bina'" <george@oxygenxml.com>, "'mozer'" <xmlizer@gmail.com>
Cc: "'XProc Dev'" <xproc-dev@w3.org>
Message-ID: <010101cc584c$9a08f9a0$ce1aece0$@calldei.com>
Ok I had to put this in.  xmlsh Quine (providing it means what I think it
does ...

	import commands posix
	cat "$0"



----------------------------------------
David A. Lee
dlee@calldei.com
http://www.xmlsh.org


-----Original Message-----
From: xproc-dev-request@w3.org [mailto:xproc-dev-request@w3.org] On Behalf
Of George Cristian Bina
Sent: Thursday, August 11, 2011 1:03 PM
To: mozer
Cc: XProc Dev
Subject: Re: The XProc Quine


Nice!
Does this qualify as the second :) ?

<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="1.0">
     <p:documentation>
         <p>(c) Syncro Soft / oXygen XML Editor 2011 - The second XProc 
Quine</p>
     </p:documentation>
     <p:output port="result"/>
     <p:xslt template-name="main">
         <p:input port="source"><p:empty/></p:input>
         <p:input port="stylesheet">
             <p:inline>
                 <xsl:stylesheet 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
                     <xsl:template name="main">
                         <xsl:copy-of select="document('')"/>
                     </xsl:template>
                 </xsl:stylesheet>
             </p:inline>
         </p:input>
         <p:input port="parameters"><p:empty/></p:input>
     </p:xslt>
</p:declare-step>

Best Regards,
George
-- 
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

On 8/11/11 5:38 PM, mozer wrote:
> http://blog.innovimax.fr/index.php/2011/08/11/38-xproc-quine
>
> You may have heard of the Quicksort implementation in XProc
> <http://en.literateprograms.org/Quicksort_(XProc)> of the famous
> algorithm <http://en.wikipedia.org/wiki/Quicksort> in XProc
> <http://w3.org/TR/xproc>
>
> Here comes now the Quine
> <http://en.wikipedia.org/wiki/Quine_(computing)>, /i.e/ "a computer
> program which takes no input and produces a copy of its own source code
> as its only output."
>
> <?xml version="1.0"  encoding="UTF-8"?>
> <p:declare-step xmlns:p="http://www.w3.org/ns/xproc"  version="1.0">
>   <p:documentation>
>     <p>(c) Innovimax 2011 - The first XProc Quine</p>
>   </p:documentation>
>   <p:output port="result"/>
>   <p:identity>
>     <p:input port="source">
>       <p:inline>
>         <p:declare-step version="1.0">
>           <p:documentation>
>             <p>(c) Innovimax 2011 - The first XProc Quine</p>
>           </p:documentation>
>           <p:output port="result"/>
>           <p:identity>
>             <p:input port="source">
>               <p:inline/>
>             </p:input>
>           </p:identity>
>           <p:insert match="p:inline"  position="first-child">
>             <p:input port="source"/>
>             <p:input port="insertion"/>
>           </p:insert>
>         </p:declare-step>
>       </p:inline>
>     </p:input>
>   </p:identity>
>   <p:insert match="p:inline"  position="first-child">
>     <p:input port="source"/>
>     <p:input port="insertion"/>
>   </p:insert>
> </p:declare-step>
>
> It works in any of the many implementations of XProc
> <http://xproc.org/implementations/>. If you run for GPL
> <http://en.wikipedia.org/wiki/GNU_General_Public_License>, go look
> atQuiXProc <http://code.google.com/p/quixproc>
>
> Xmlizer
Received on Thursday, 11 August 2011 17:32:44 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 11 August 2011 17:32:45 GMT