adamc@780: fun sub r = adamc@780: let adamc@780: fun sub' ls = adamc@780: case ls of adamc@780: [] => <xml/> adamc@780: | r :: ls => <xml> adamc@780: <li>{[r.Num]} = {[r.Text]}</li> adamc@780: {sub' ls} adamc@780: </xml> adamc@780: in adamc@780: return <xml><body> adamc@780: {sub' r.Lines} adamc@780: </body></xml> adamc@780: end adamc@780: adamc@780: fun subforms n = adamc@780: if n <= 0 then adamc@780: <xml/> adamc@780: else adamc@780: <xml> adamc@780: <entry> adamc@780: <hidden{#Num} value={show n}/> adamc@780: <li>{[n]}: <textbox{#Text}/></li> adamc@780: </entry> adamc@780: {subforms (n - 1)} adamc@780: </xml> adamc@780: adamc@780: fun form n = return <xml><body> adamc@780: <form> adamc@780: <subforms{#Lines}> adamc@780: {subforms n} adamc@780: </subforms> adamc@780: <submit action={sub}/> adamc@780: </form> adamc@780: adamc@780: <a link={form (n + 1)}>One more blank</a><br/> adamc@780: {if n > 0 then adamc@780: <xml><a link={form (n - 1)}>One fewer blank</a></xml> adamc@780: else adamc@780: <xml/>} adamc@780: </body></xml> adamc@780: adamc@780: fun main () = form 1