Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simplest XSLT Stylesheet whose output is the XSLT Stylesheet...For learning purposes

Tags:

self

xslt

What's the simplest XSLT (1.0) stylesheet that can be used to output itself?

I have started it off (and haven't got very far...). self.xml is the name of the stylesheet (and the input document):

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="self.xml"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
...

And the output should be, well the same....

EDIT (after reading about quines from a poster...)

Let me make this request harder...

Does an XSLT stylesheet exist which will just simply output any input document. (I mean output, not just internally represent it) : 'any input document' would include itself of course...

like image 636
monojohnny Avatar asked Nov 16 '25 08:11

monojohnny


1 Answers

This kind of program is called a "quine," and a quick Google of "XSLT quine" resulted in this link: http://www2.informatik.hu-berlin.de/~obecker/XSLT/#quine

like image 104
Steven Huwig Avatar answered Nov 18 '25 19:11

Steven Huwig



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!