Commit | Line | Data |
---|---|---|
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 --> | |
b650f479 A |
19 | <xsl:variable name="_read"> |
20 | <xsl:call-template name="READ" /> | |
21 | </xsl:variable> | |
22 | <xsl:variable name="_eval"> | |
23 | <xsl:for-each select="$_read"> | |
24 | <xsl:call-template name="EVAL"></xsl:call-template> | |
25 | </xsl:for-each> | |
26 | </xsl:variable> | |
27 | <stdout> | |
28 | <xsl:for-each select="$_eval"> | |
29 | <xsl:call-template name="PRINT"></xsl:call-template> | |
30 | </xsl:for-each> | |
31 | </stdout> | |
bfae91cc A |
32 | </mal> |
33 | </xsl:template> | |
34 | <xsl:template name="PRINT"> | |
b650f479 | 35 | <xsl:sequence select="."/> |
bfae91cc A |
36 | </xsl:template> |
37 | <xsl:template name="EVAL"> | |
b650f479 | 38 | <xsl:sequence select="."/> |
bfae91cc A |
39 | </xsl:template> |
40 | <xsl:template name="READ"> | |
b650f479 | 41 | <xsl:copy-of select="stdin/text()" /> |
bfae91cc A |
42 | </xsl:template> |
43 | </xsl:stylesheet> |