Re: The XProc Quine

For my money, there's something that's not quite as aesthetically
pleasing about these types of quines that invoke a system call to read
and print out the source document.  It seems like cheating.

For those not on the xsl-list, he did an XSLT quine, too:
http://www.biglist.com/lists/lists.mulberrytech.com/xsl-list/archives/201108/msg00073.html

Chris Maloney

On Fri, Aug 12, 2011 at 8:25 AM,  <vojtech.toman@emc.com> wrote:
> It works because relative URIs in p:document/@href (but also in other
> places) are resolved against the base URI of the containing element – which
> in this case is equal  to the base URI of the entire pipeline document
> (because nor the p:document nor any of its ancestors specify a different
> base URI). Therefore the p:document “returns” the pipeline document.
>
>
>
> I would say this is a fairly expected behavior. Similar things happen also
> in other contexts where you need to work with relative URIs (XSLT, XQuery,
> …)
>
>
>
> The wrinkle I was talking about is that in order to run Florent’s pipeline,
> you need to provide it with an input document or you get a dynamic error
> (because the implicit “source” input port of p:pipeline is a non-sequence
> port). My original pipeline didn’t have an input port at all, so you don’t
> have to pass any document to it. But is it is all just a very minor thing.
>
>
>
> Regards,
>
> Vojtech
>
>
>
> --
>
> Vojtech Toman
>
> Consultant Software Engineer
>
> EMC | Information Intelligence Group
>
> vojtech.toman@emc.com
>
> http://developer.emc.com/xmltech
>
>
>
> From: Alex Muir [mailto:alex.g.muir@gmail.com]
> Sent: Friday, August 12, 2011 2:13 PM
> To: Toman, Vojtech
> Cc: xproc-dev@w3.org
> Subject: Re: The XProc Quine
>
>
>
> Vojtech,
>
> That's interesting why does an empty href <p:document href=""/> load the
> document itself?
>
> Is that a common feature across other tools?
>
> Florents example seems to work when I run it.. I don't understand the
> wrinkle but port law always confuses me so no surprise.
>
> Alex
>
> On Fri, Aug 12, 2011 at 9:20 AM, <vojtech.toman@emc.com> wrote:
>
>>   Excellent.  By using the appropriate shortcuts, we can even
>> reduce it further:
>>
>>     <p:pipeline xmlns:p="http://www.w3.org/ns/xproc" version="1.0">
>>      <p:identity>
>>       <p:input port="source"><p:document href=""/></p:input>
>>      </p:identity>
>>     </p:pipeline>
>>
>
> Yes, except for the small wrinkle that in order to run this pipeline, you
> would have to provide some input to its "source" input port.
>
> Regards,
> Vojtech
>
>
> --
> Vojtech Toman
> Consultant Software Engineer
> EMC | Information Intelligence Group
> vojtech.toman@emc.com
> http://developer.emc.com/xmltech
>
>
>
>
> --
>
> Alex Muir
> Instructor | Program Organizer - University Technology Student Work
> Experience Building
> University of the Gambia
> http://sites.utg.edu.gm/alex/
>
> Low budget software development benefiting development in the Gambia, West
> Africa
> Experience of a lifetime, come to Gambia and Join UTSWEB -
> http://sites.utg.edu.gm/utsweb/
>
>

Received on Friday, 12 August 2011 14:35:20 UTC