<?xml-stylesheet type="text/xsl" href="/xforms-tests/xsltforms/xsltforms.xsl"?>
<html xmlns:my="http://commerce.example.com/payment" xmlns:txs="http://sourceforge.net/projects/txs" xmlns="http://www.w3.org/1999/xhtml" xmlns:req="http://www.agencexml.com/requests" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <head>
        <title>9.3.1.e repeat element example</title>
        <xforms:model xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <xforms:instance xmlns="">
                <lines>
                    <line name="a">
                        <price>3.00</price>
                    </line>
                    <line name="b">
                        <price>32.25</price>
                    </line>
                    <line name="c">
                        <price>132.99</price>
                    </line>
                </lines>
            </xforms:instance>
        </xforms:model>
        <link href="../../../driverPages/forms/TestSuite11.css" rel="stylesheet"/>
    </head>
    <body>
        <xforms:group xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <xforms:label class="title">9.3.1.e repeat element example</xforms:label>
        </xforms:group>
        <xforms:group xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <xforms:label>
				You must see three items (named a, b, and c) and a price for each item (3.00, 
				32.25, and 132.99 respectively).  You must be able to add and remove items. 
				When you add an item its initial name will be an empty input control and 
				initial price will be 0.00.
			</xforms:label>
        </xforms:group>
        <xforms:group xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <xforms:label/>
            <xforms:repeat id="lineset" nodeset="/lines/line">
                <xforms:group>
                    <xforms:label/>
                    <xforms:input ref="price">
                        <xforms:label>Line Item:</xforms:label>
                    </xforms:input>
                    <xforms:input ref="@name">
                        <xforms:label>Name:</xforms:label>
                    </xforms:input>
                </xforms:group>
            </xforms:repeat>
        </xforms:group>
        <xforms:trigger xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <xforms:label>Insert New Item After The Current One</xforms:label>
            <xforms:action ev:event="DOMActivate">
                <xforms:insert at="index('lineset')" nodeset="/lines/line" position="after"/>
                <xforms:setvalue ref="/lines/line[index('lineset')]/@name"/>
                <xforms:setvalue ref="/lines/line[index('lineset')]/price">0.00</xforms:setvalue>
            </xforms:action>
        </xforms:trigger>
        <xforms:trigger xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <xforms:label>Remove Current Item</xforms:label>
            <xforms:delete at="index('lineset')" ev:event="DOMActivate" nodeset="/lines/line"/>
        </xforms:trigger>
        <xforms:group>
			<xforms:output value="index('lineset')">
				<xforms:label>Current index : </xforms:label>
			</xforms:output>
		</xforms:group>
        
    </body>
</html>
