Re: The XProc Quine

George,

Very disturbing one, but nice !

Vojtech just proposed a nice one

<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="1.0">
  <p:output port="result"/>
  <p:identity>
    <p:input port="source">
      <p:document href=""/>
    </p:input>
  </p:identity>
</p:declare-step>

Xmlizer

On Thu, Aug 11, 2011 at 7:03 PM, George Cristian Bina
<george@oxygenxml.com> wrote:
> 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 Friday, 12 August 2011 08:37:33 UTC