- Quine (informatique)
-
Pour les articles homonymes, voir Quine.
Un quine en informatique est un programme (une sorte de métaprogramme) dont la sortie et le code source sont identiques. À titre de défi ou d'amusement, certains programmeurs essaient d'écrire le plus court quine dans un langage donné.
L'opération qui consiste à ouvrir le fichier source et à l'afficher est considérée comme une tricherie. Plus généralement, un programme qui utilise une quelconque entrée de données ne peut être considéré comme un quine valide. Une solution triviale est un programme dont le code source est vide. En effet, l'exécution d'un tel programme ne produit pour la plupart des langages aucune sortie, c'est-à-dire le code source du programme.
Un quine est dit polyglotte quand il est valide dans plusieurs langages simultanément. Différents exemples de tels quines sont disponibles dans les liens externes en bas de page.
Les quines tirent leur nom du philosophe et logicien américain W. V. Quine (1908 – 2000), qui a étudié en profondeur l'autoréférence indirecte : il a entre autres forgé l'expression paradoxale (et difficilement traduisible) « 'Yields falsehood when preceded by its quotation' yields falsehood when preceded by its quotation. » C'est-à-dire : [La citation] « 'est fausse lorsque précédée par sa propre citation' est fausse lorsque précédée par sa propre citation ».
Avec le théorème de récursion de Kleene, il est possible de montrer que dans tout langage de programmation (acceptable) il existe un quine.
Exemples
Langages de programmation
Java
Remarque : des sauts de ligne ont été ajoutés pour faciliter la lecture.
public class r {public static void main(String[] args) {String p="public class r { public static void main(String[] args) {",g="\"",n ="System.out.println(p+a+g+p+g+z +c+g+s+g+g+z+b+g+n+g+z+d+g+s+s+g+z+e+g+z+g+z+'a'+'='+g+a+g+z+'b'+'='+g+b+g+z+'c'+'=' +g+c+g+z+'d'+'='+g+d+g+z+'e'+'='+g+e+g+z+'f'+'='+g+f+g+z+'v'+'='+g+v+g+v+n);}}",s="\\", z=",",a="String p=",b="n =",c="g=",d="s=",e="z=",f="v=",v=";";System.out.println( p+a+g+p+g+z+c+g+s+g+g+z+b+g+n+g+z+d+g+s+s+g+z+e+g+z+g+z+'a'+'='+g+a+g+z+'b'+'='+g+b+g+z +'c'+'='+g+c+g+z+'d'+'='+g+d+g+z+'e'+'='+g+e+g+z+'f'+'='+g+f+g+z+'v'+'='+g+v+g+v+n);}}
C
#include<stdio.h> char*i="\\#include<stdio.h>",n='\n',q='"',*p= "%s%cchar*i=%c%c%s%c,n='%cn',q='%c',*p=%c%c%s%c,*m=%c%c%s%c%c;%s%c",*m= "int main(){return!printf(p,i+1,n,q,*i,i,q,*i,q,n,q,p,q,n,q,m,q,n,m,n);}" ;int main(){return!printf(p,i+1,n,q,*i,i,q,*i,q,n,q,p,q,n,q,m,q,n,m,n);}
C++
Remarque : des sauts de ligne ont été ajoutés pour faciliter la lecture. Tout ce qui est en dessous du "#include <iostream>" s'écrit en une ligne.
#include <iostream> main(){int i;char t[2];t[0]=0x00;char *v,*w;v=(char*)malloc(10);w=(char*)malloc(9); t[1]=v[0]=v[9]=w[0]=0x22;v[1]=v[2]=v[7]=v[8]=w[1]=w[2]=0x3C;v[3]=0x75;w[4]=v[4]=0x5B; w[5]=v[5]=0x69;v[6]=w[6]=0x5D;w[3]=0x78;w[7]=0x3B;w[8]=0x7D;std::string u[2],x[2]; u[0]=0x0A;u[1]=v;x[0]=t[0];x[1]=w;for(i=0;i<2;i++)std::cout<<t[i]<<"#include <iostream>" <<u[i]<<"main(){int i;char t[2];t[0]=0x00;char *v,*w;v=(char*)malloc(10);w=(char*)malloc(9); t[1]=v[0]=v[9]=w[0]=0x22;v[1]=v[2]=v[7]=v[8]=w[1]=w[2]=0x3C;v[3]=0x75;w[4]=v[4]=0x5B;w[5]=v[5]=0x69; v[6]=w[6]=0x5D;w[3]=0x78;w[7]=0x3B;w[8]=0x7D;std::string u[2],x[2];u[0]=0x0A;u[1]=v;x[0]=t[0]; x[1]=w;for(i=0;i<2;i++){std::cout<<t[i]<<"<<x[i];}
C#
Remarque : des sauts de ligne ont été ajoutés pour faciliter la lecture.
using System; namespace quine { class Program { [STAThread] static void Main(string[] args) { string s = "using System;{0}namespace quine{0}{2}{0}{1}class Program{0} {1}{2}{0}{1}{1}[STAThread]{0}{1}{1}static void Main(string[] args){0}{1}{1}{2}{0}{1}{1}{1} string s = {4}{6}{4};{0}{1}{1}{1}Console.Write(s, Environment.NewLine, {4}{5}t{4}, {4}{2} {4}, {4}{3}{4}, {4}{5}{4}{4}, {4}{5}{5}{4}, s);{0}{1}{1}{3}{0}{1}{3}{0}{3}"; Console.Write(s, Environment.NewLine, "\t", "{", "}", "\"", "\\", s); } } }
Scheme
((lambda (x) (list x (list (quote quote) x))) (quote (lambda (x) (list x (list (quote quote) x)))))
Common Lisp
(funcall (lambda (x) (append x (list (list 'quote x)))) '(funcall (lambda (x) (append x (list (list 'quote x))))))
OCaml
(fun s -> Printf.printf "%s %S" s s) "(fun s -> Printf.printf \"%s %S\" s s)"
Python
a='a=%s;print a%%`a`';print a%`a`
Un autre exemple :
b='\\';g='"';p='%';s="b='%s%s';g='%s';p='%s';s=%s%s%s;print s%s(b,b,g,p,g,s,g,p)";print s%(b,b,g,p,g,s,g,p)
Un autre exemple dont les 61 derniers caractères sont communs avec le précédent (juste pour montrer que des assignations multiples ne réduisent pas la longueur du programme) :
b,g,p,s='\\','"','%',"b,g,p,s='%s%s','%s','%s',%s%s%s;print s%s(b,b,g,p,g,s,g,p)";print s%(b,b,g,p,g,s,g,p)
Ruby
puts <<2*2,2 puts <<2*2,2 2
JavaScript
unescape(q="unescape(q=%22*%22).replace('*',q)").replace('*',q)
Perl
$_=q{$_=q{Q};s/Q/$_/;print};s/Q/$_/;print
Et un mélange shell/Perl :
perl -le '$n=q{perl -le a$n=q{$x};($_=$n)=~s/\141/\47/g;s/\$x/$n/;printa};($_=$n)=~s/\141/\47/g;s/\$x/$n/;print'
BASIC
10 C=": PRINT CHR(49)+CHR(48)+CHR(32)+CHR(67)+CHR(61)+CHR(34)+C+CHR(34)+C": PRINT CHR(49)+CHR(48)+CHR(32)+CHR(67)+CHR(61)+CHR(34)+C+CHR(34)+C
Pascal
const a='const a=';b='begin write(a,#39,a,#39#59#98#61#39,b,#39#59#10,b) end.'; begin write(a,#39,a,#39#59#98#61#39,b,#39#59#10,b) end.
Brainfuck
Remarque : il devrait s'agir d'une ligne de code continue, mais des retours à la ligne ont été ajoutés pour "faciliter" la lecture.
->+>+++>>+>++>+>+++>>+>++>>>+>+>+>++>+>>>>+++>+>>++>+>+++>>++>++>>+>>+>++>++> +>>>>+++>+>>>>++>++>>>>+>>++>+>+++>>>++>>++++++>>+>>++>+>>>>+++>>+++++>>+>+++ >>>++>>++>>+>>++>+>+++>>>++>>+++++++++++++>>+>>++>+>+++>+>+++>>>++>>++++>>+>> ++>+>>>>+++>>+++++>>>>++>>>>+>+>++>>+++>+>>>>+++>+>>>>+++>+>>>>+++>>++>++>+>+ ++>+>++>++>>>>>>++>+>+++>>>>>+++>>>++>+>+++>+>+>++>>>>>>++>>>+>>>++>+>>>>+++> +>>>+>>++>+>++++++++++++++++++>>>>+>+>>>+>>++>+>+++>>>++>>++++++++>>+>>++>+>> >>+++>>++++++>>>+>++>>+++>+>+>++>+>+++>>>>>+++>>>+>+>>++>+>+++>>>++>>++++++++ >>+>>++>+>>>>+++>>++++>>+>+++>>>>>>++>+>+++>>+>++>>>>+>+>++>+>>>>+++>>+++>>>+ [[->>+<<]<+]+++++[->+++++++++<]>.[+]>>[<<+++++++[->+++++++++<]>- .------------------->-[-<.<+>>]<[+]<+>>>]<<<[-[-[-[>>+<++++++[->+++++<]]>++++ ++++++++++<]>+++<]++++++[->+++++++<]>+<<<-[->>>++<<<]>[->>.<<]<<]
HQ9+
Q
Bourne shell (sh)
#!/bin/sh quine () { echo -e "#!/bin/sh\n$1" echo "quine '$1'" } quine 'quine () { echo -e "#!/bin/sh\\n$1" echo "quine \047$1\047" } '
batch (MS-DOS)
@echo off %1 %2 call %0 goto e %% call %0 goto e %%3 echo.%%4 echo :f goto f :e echo.%4@echo off echo.%4%31 %32 echo.%4call %30 goto e %3%3 echo.%4call %30 goto e %3%33 echo.%3%34 echo.%4echo :f echo.%4goto f echo.%4:e :f
PHP
<? $a='chr(60).chr(63).chr(10).chr(36).chr(97).chr(61).chr(39).$a.chr(39).chr(59).chr(10)."echo $a;".chr(10).chr(63).chr(62)'; echo chr(60).chr(63).chr(10).chr(36).chr(97).chr(61).chr(39).$a.chr(39).chr(59).chr(10)."echo $a;".chr(10).chr(63).chr(62); ?> <? $a='<? $a=2; echo str_replace(1+1,chr(39).$a.chr(39),$a); ?>'; echo str_replace(1+1,chr(39).$a.chr(39),$a); ?>
<?php function Esc($s) { return (str_replace(chr(0x27), chr(0x5c).chr(0x27), $s)); } $aSrc = array( 'echo("<?php\r\n");', 'echo(\' function Esc($s) { return (str_replace(chr(0x27), chr(0x5c).chr(0x27), $s)); }\'); echo("\r\n");', 'echo(\' $aSrc = array(\'); echo("\r\n");', 'foreach ($aSrc as $x) {', ' echo(chr(0x09).chr(0x09)."\'".Esc($x)."\',".chr(0x0d).chr(0x0a));', '}', 'echo("\t);\r\n");', 'foreach ($aSrc as $x) {', ' echo(chr(0x09).$x.chr(0x0d).chr(0x0a));', '}', 'echo("?>\r\n");', ); echo("<?php\r\n"); echo(' function Esc($s) { return (str_replace(chr(0x27), chr(0x5c).chr(0x27), $s)); }'); echo("\r\n"); echo(' $aSrc = array('); echo("\r\n"); foreach ($aSrc as $x) { echo(chr(0x09).chr(0x09)."'".Esc($x)."',".chr(0x0d).chr(0x0a)); } echo("\t);\r\n"); foreach ($aSrc as $x) { echo(chr(0x09).$x.chr(0x0d).chr(0x0a)); } echo("?>\r\n"); ?>
PL1
Remarque : ce plus court quine écrit en PL/I compilera en utilisant la version OS PL/I V2.3.0 du compilateur, mais nécessite une marge à gauche de 1 et l'option COMPILE pour éviter un certain nombre d'erreurs ou d'avertissements.
%dcl z%z='put edit';proc options(main;q=''''put list(m;do i=1,2;z(q)skip;do j= 1to 78c=substr(m(i),j;if c=q z(c;z(c;end;z(q',';dcl(c,q)char,m(2)char(99)init( '%dcl z%z=''put edit'';proc options(main;q=''''''''put list(m;do i=1,2;z(q)skip;do j=', '1to 78c=substr(m(i),j;if c=q z(c;z(c;end;z(q'','';dcl(c,q)char,m(2)char(99)init(',
forth
Remarque : cette quine fonctionne sur tous les systèmes forth.
: q s" 2dup cr 115 emit 34 emit space type 34 emit space type cr" 2dup cr 115 emit 34 emit space type 34 emit space type cr ;
PostScript
(dup == {dup cvx exec} pop 8 12 getinterval =) dup cvx exec
Visual FoxPro
CLEAR SET TALK OFF SET TEXTMERGE ON \CLEAR \SET TALK OFF \SET TEXTMERGE ON
Tcl
proc Quine {} { set n [lindex [info level 0] 0] append s [list proc $n [info args $n] [info body $n]] \n [list $n] puts $s } Quine
Unlambda
À écrire sur une seule ligne. Il est masqué car contient 12 538 caractères.
Une quine en Unlambda````s``s`ks``s`kk`k`d``````.`.`.s.i.`.k.i``s``s`ks``s``s`ks``s`kk`k.```s`kk`ki`` s``s`ks``s``s`ks``s`kk`kc``s``s`ks``s``s`ks``s``s`ks``s`kki``s`kki``s`kk`k``s``s `ks``s``s`ks``s`kki`ki``s`kk`ki`ki``s``s`ks``s`kk`kc``s``s`ks``s``s`ks``s``s`ks` `s`kki``s`kki``s`kk`k``s``s`ks``s``s`ks``s`kk`k`d```````.`.k.`.d.`.k.`..``s``s`k s``s`kki`ki``s`kk`kk`ki``s``s`ks``s``s`ks``s`kk`ks``s``s`ks``s``s`ks``s`kk`ks``s ``s`ks``s`kk`kk``s`kk`ks``s``s`ks``s``s`ks``s`kk`ks``s``s`ks``s``s`ks``s`kk`ks`` s``s`ks``s`kk`kk``s`kk`ks``s``s`ks``s``s`ks``s`kk`ks``s``s`ks``s``s`ks``s`kk`ks` `s``s`ks``s`kk`kk``s`kk`ks``s``s`ks``s``s`ks``s`kk`ks``s``s`ks``s``s`ks``s`kk`ks ``s``s`ks``s`kk`kk``s`kk`ks``s``s`ks``s``s`ks``s`kk`ks``s``s`ks``s`kk`kk``s`kk`k k``s``s`ks``s`kk`kk``s`kki``s``s`ks``s``s`ks``s`kk`ks``s``s`ks``s`kk`kk``s`kk`kk ``s``s`ks``s`kk`kk``s`kki``s``s`ks``s``s`ks``s`kk`ks``s``s`ks``s`kk`kk``s`kk`kk` `s``s`ks``s`kk`kk`ki``s``s`ks``s``s`ks``s`kk`ks``s``s`ks``s``s`ks``s`kk`ks``s``s `ks``s`kk`kk``s`kk`ks``s``s`ks``s``s`ks``s`kk`ks``s``s`ks``s``s`ks``s`kk`ks``s`` s`ks``s`kk`kk``s`kk`ks``s``s`ks``s``s`ks``s`kk`ks``s``s`ks``s`kk`kk``s`kk`kk``s` `s`ks``s`kk`kk`ki``s``s`ks``s``s`ks``s`kk`ks``s``s`ks``s`kk`kk``s`kk`kk``s`kk`ki ``s``s`ks``s`kk`kk``s`kk`ki``s``s`ks``s`kk`kk``s`kk`ki`k`d`k`.``k`d`k`.``k`d`k`. ``k`d`k`.s`k`d`k`.``k`d`k`.``k`d`k`.s`k`d`k`.``k`d`k`.k`k`d`k`.s`k`d`k`.``k`d`k` .``k`d`k`.s`k`d`k`.``k`d`k`.k`k`d`k`.k`k`d`k`.``k`d`k`.k`k`d`k`.``k`d`k`.d`k`d`k `.``k`d`k`.``k`d`k`.``k`d`k`.``k`d`k`.``k`d`k`.``k`d`k`..`k`d`k`.``k`d`k`..`k`d` k`.``k`d`k`..`k`d`k`.s`k`d`k`..`k`d`k`.i`k`d`k`..`k`d`k`.``k`d`k`..`k`d`k`.k`k`d `k`..`k`d`k`.i`k`d`k`.``k`d`k`.``k`d`k`.s`k`d`k`.``k`d`k`.``k`d`k`.s`k`d`k`.``k` d`k`.k`k`d`k`.s`k`d`k`.``k`d`k`.``k`d`k`.s`k`d`k`.``k`d`k`.``k`d`k`.s`k`d`k`.``k `d`k`.k`k`d`k`.s`k`d`k`.``k`d`k`.``k`d`k`.s`k`d`k`.``k`d`k`.k`k`d`k`.k`k`d`k`.`` k`d`k`.k`k`d`k`..`k`d`k`.``k`d`k`.``k`d`k`.``k`d`k`.s`k`d`k`.``k`d`k`.k`k`d`k`.k `k`d`k`.``k`d`k`.k`k`d`k`.i`k`d`k`.``k`d`k`.``k`d`k`.s`k`d`k`.``k`d`k`.``k`d`k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`.s`k`d`k`.``k` d`k`.``k`d`k`.s`k`d`k`.``k`d`k`.k`k`d`k`.s`k`d`k`.``k`d`k`.``k`d`k`.s`k`d`k`.``k `d`k`.k`k`d`k`.k`k`d`k`.``k`d`k`.k`k`d`k`.k`k`d`k`.``k`d`k`.``k`d`k`.s`k`d`k`.`` k`d`k`.k`k`d`k`.k`k`d`k`.``k`d`k`.k`k`d`k`.k`k`d`k`.``k`d`k`.``k`d`k`.s`k`d`k`.` `k`d`k`.k`k`d`k`.k`k`d`k`.``k`d`k`.k`k`d`k`.i`k`d`k`.``k`d`k`.``k`d`k`.s`k`d`k`. ``k`d`k`.``k`d`k`.s`k`d`k`.``k`d`k`.k`k`d`k`.s`k`d`k`.``k`d`k`.``k`d`k`.s`k`d`k` .``k`d`k`.k`k`d`k`.k`k`d`k`.``k`d`k`.k`k`d`k`.k`k`d`k`.``k`d`k`.``k`d`k`.s`k`d`k `.``k`d`k`.k`k`d`k`.k`k`d`k`.``k`d`k`.k`k`d`k`.i`k`d`k`.``k`d`k`.``k`d`k`.s`k`d` k`.``k`d`k`.``k`d`k`.s`k`d`k`.``k`d`k`.k`k`d`k`.s`k`d`k`.``k`d`k`.``k`d`k`.s`k`d `k`.``k`d`k`.k`k`d`k`.k`k`d`k`.``k`d`k`.k`k`d`k`.k`k`d`k`.``k`d`k`.``k`d`k`.s`k` d`k`.``k`d`k`.k`k`d`k`.k`k`d`k`.``k`d`k`.k`k`d`k`.i``si`ki
Vala
using GLib; public class Quine { public static void main() { string s = "using GLib; public class Quine { public static void main() { string s = %c%s%c; stdout.printf(s, 34, s, 34); } }"; stdout.printf(s, 34, s, 34); } }
LaTeX
\documentclass{book}\pagestyle {empty}\def\a{\ensuremath{\backslash}}\def\f {\def\b{\a}\def\c{\{}\def\d{\}}\def \e{\\}\noindent\g\b def\b g\c\def\b{\a b }\def\c{\a c }\def\d{\a d}\def\e{\a e \\}\g\}\a begin\{document\}\a f\a end \{document\}}\def\g{ \b documentclass\c book\d\b pagestyle\e \c empty\d\b def\b a\c \b ensuremath\c \b backslash\d\d\b def\b f\e \c \b def\b b\c \b a\d\b def\b c\c \b \c \d\b def\b d\c \b \d\d\b def\e \b e\c \b \b \d\b noindent\b g\b b def\b b g\b c\b def\b b\c \b a b\e \d\b def\b c\c \b a c \d\b def\b d\c \b a d\d\b def\b e\c \b a e\e \b \b \d\b g\b \d\b a begin\b \c document\b \d\b a f\b a end\e \b \c document\b \d\d}\begin{document}\f\end{document}
XSLT
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="2.0"> <!-- (c) Innovimax 2011 - XSLT 2.0 Quine without DOE --> <xsl:variable name="code"> <xsl:element name="xsl:stylesheet"> <xsl:attribute name="version" select="'2.0'"/> <xsl:comment> (c) Innovimax 2011 - XSLT 2.0 Quine without DOE </xsl:comment> <xsl:element name="xsl:variable"> <xsl:attribute name="name" select="'code'"/> <xsl:element name="foo"/> </xsl:element> <xsl:element name="xsl:template"> <xsl:attribute name="match" select="'/'"/> <xsl:element name="xsl:apply-templates"> <xsl:attribute name="select" select="'$code'"/> <xsl:attribute name="mode" select="'copy'"/> </xsl:element> </xsl:element> <xsl:element name="xsl:template"> <xsl:attribute name="match" select="'@*|node()'"/> <xsl:attribute name="mode" select="'copy'"/> <xsl:element name="xsl:copy"> <xsl:element name="xsl:apply-templates"> <xsl:attribute name="select" select="'@*|node()'"/> <xsl:attribute name="mode" select="'copy'"/> </xsl:element> </xsl:element> </xsl:element> <xsl:element name="xsl:template"> <xsl:attribute name="match" select="'foo'"/> <xsl:attribute name="mode" select="'copy'"/> <xsl:element name="xsl:apply-templates"> <xsl:attribute name="select" select="'$code'"/> <xsl:attribute name="mode" select="'el'"/> </xsl:element> </xsl:element> <xsl:element name="xsl:template"> <xsl:attribute name="match" select="'*'"/> <xsl:attribute name="mode" select="'el'"/> <xsl:element name="xsl:element"> <xsl:attribute name="name" select="'xsl:element'"/> <xsl:element name="xsl:attribute"> <xsl:attribute name="name" select="'name'"/> <xsl:attribute name="select" select="'name()'"/> </xsl:element> <xsl:element name="xsl:apply-templates"> <xsl:attribute name="select" select="'@*|*|text()|comment()'"/> <xsl:attribute name="mode" select="'el'"/> </xsl:element> </xsl:element> </xsl:element> <xsl:element name="xsl:template"> <xsl:attribute name="match" select="'@*'"/> <xsl:attribute name="mode" select="'el'"/> <xsl:element name="xsl:element"> <xsl:attribute name="name" select="'xsl:attribute'"/> <xsl:element name="xsl:attribute"> <xsl:attribute name="name" select="'name'"/> <xsl:attribute name="select" select="'name()'"/> </xsl:element> <xsl:element name="xsl:attribute"> <xsl:attribute name="name" select="'select'"/> <xsl:text>'</xsl:text> <xsl:element name="xsl:value-of"> <xsl:attribute name="select" select="'.'"/> </xsl:element> <xsl:text>'</xsl:text> </xsl:element> </xsl:element> </xsl:element> <xsl:element name="xsl:template"> <xsl:attribute name="match" select="'text()'"/> <xsl:attribute name="mode" select="'el'"/> <xsl:element name="xsl:element"> <xsl:attribute name="name" select="'xsl:text'"/> <xsl:element name="xsl:value-of"> <xsl:attribute name="select" select="'.'"/> </xsl:element> </xsl:element> </xsl:element> <xsl:element name="xsl:template"> <xsl:attribute name="match" select="'comment()'"/> <xsl:attribute name="mode" select="'el'"/> <xsl:element name="xsl:element"> <xsl:attribute name="name" select="'xsl:comment'"/> <xsl:element name="xsl:value-of"> <xsl:attribute name="select" select="'.'"/> </xsl:element> </xsl:element> </xsl:element> </xsl:element> </xsl:variable> <xsl:template match="/"> <xsl:apply-templates select="$code" mode="copy"/> </xsl:template> <xsl:template match="@*|node()" mode="copy"> <xsl:copy> <xsl:apply-templates select="@*|node()" mode="copy"/> </xsl:copy> </xsl:template> <xsl:template match="foo" mode="copy"> <xsl:apply-templates select="$code" mode="el"/> </xsl:template> <xsl:template match="*" mode="el"> <xsl:element name="xsl:element"> <xsl:attribute name="name" select="name()"/> <xsl:apply-templates select="@*|*|text()|comment()" mode="el"/> </xsl:element> </xsl:template> <xsl:template match="@*" mode="el"> <xsl:element name="xsl:attribute"> <xsl:attribute name="name" select="name()"/> <xsl:attribute name="select">'<xsl:value-of select="."/>'</xsl:attribute> </xsl:element> </xsl:template> <xsl:template match="text()" mode="el"> <xsl:element name="xsl:text"> <xsl:value-of select="."/> </xsl:element> </xsl:template> <xsl:template match="comment()" mode="el"> <xsl:element name="xsl:comment"> <xsl:value-of select="."/> </xsl:element> </xsl:template> </xsl:stylesheet>
XProc
<?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>
Autres
Français
Recopier puis recopier entre guillemets la phrase « Recopier puis recopier entre guillemets la phrase ».
Voir aussi
Liens externes
Wikimedia Foundation. 2010.