<?xml version="1.0"  encoding="ASCII"?>
<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml" 
            xmlns:xforms="http://www.w3.org/2002/xforms"
            xmlns:ev="http://www.w3.org/2001/xml-events">
    <xhtml:head>
        <xhtml:title>
            2.4.3/2.4.4 Accessing Context Information for Events (xforms-submit-done)
        </xhtml:title>
        <xforms:model version="1.1">
            <xforms:instance id="data">
                <this>
                    <that>
                        <the_other_thing>this that and the other thing...</the_other_thing>
                    </that>
                </this>
            </xforms:instance>
            <xforms:submission id="submitme" method="post" action="http://xformstest.org/cgi-bin/echo.sh" replace="none">
                <xforms:action ev:event="xforms-submit-done">
                    <!--  will event('code') still return 200/202 below? sure hope so... -->
                    <xforms:setvalue model="subdata" ref="/subinfo/code" value="event('code')" />
                    <!-- how to insert all the headers into an instance? or do *anything* with them as a set of non-predetermined size? -->
                    <!-- the below clearly won't work, as @origin and other insert mechanisms operate on a single node -->
                    <xforms:insert model="subdata" nodeset="/subinfo/headers" origin="event('headers')" />
                </xforms:action>
            </xforms:submission>
        </xforms:model>
        <xforms:model id="subdata">
            <xforms:instance>
                <subinfo>
                    <code />
                    <headers />
                </subinfo>
            </xforms:instance>
        </xforms:model>
    </xhtml:head>
    <xhtml:body>
        <xforms:group>
            <xforms:label>Accessing Context Information for Events (xforms-submit)</xforms:label>
        </xforms:group>
        <xforms:submit submission="submitme">
            <xforms:label>Submit</xforms:label>
        </xforms:submit>
        <xforms:group>
            <xforms:output model="subdata" ref="code">
                <xforms:label>return code:</xforms:label>
            </xforms:output>
        </xforms:group>
        <xforms:group>
            <xforms:label>header information:</xforms:label>
            <xforms:repeat model="subdata" nodeset="headers">
                <xforms:group>
                    <xforms:output ref="./@name">
                        <xforms:label>header name:</xforms:label>
                    </xforms:output>
                </xforms:group>
                <xforms:group>
                    <xforms:output ref=".">
                        <xforms:label>header contents:</xforms:label>
                    </xforms:output>
                </xforms:group>
            </xforms:repeat>
        </xforms:group>
    </xhtml:body>
</xhtml:html>