start step2-eval
[jackhill/mal.git] / xslt / step0_repl.xslt
CommitLineData
bfae91cc
A
1<?xml version="1.0" encoding="UTF-8"?>
2<!-- Step 0: REPL -->
3<!-- input document must be in the following format -->
4<!--
5<mal>
6 <stdin>...stdin text...</stdin>
7 <stdout> ... ignored, omitted ... </stdout>
8 <state> ignored, preserved </state>
9</mal>
10-->
11<xsl:stylesheet
12 version="1.0"
13 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
14 <xsl:output method='xml' encoding='utf-8' indent='yes'/>
15 <xsl:template match="mal" name="rep">
16 <mal>
17 <stdin></stdin> <!-- clear stdin -->
18 <xsl:copy-of select="state" /> <!-- preserve state -->
19 <stdout><xsl:call-template name="PRINT" /></stdout> <!-- copy stdin to stdout -->
20 </mal>
21 </xsl:template>
22 <xsl:template name="PRINT">
23 <xsl:call-template name="EVAL" />
24 </xsl:template>
25 <xsl:template name="EVAL">
26 <xsl:call-template name="READ" />
27 </xsl:template>
28 <xsl:template name="READ">
29 <xsl:copy-of select="stdin/text()" />
30 </xsl:template>
31</xsl:stylesheet>