<?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" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  	<head>
    	<title>10.5.a setindex element rules</title>
    	<link rel="stylesheet" href="../../driverPages/forms/TestSuite11.css" type="text/css"/>
    	<xforms:model>
       		<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>
  	</head>
  	<body>
  		<xforms:group>
  			<xforms:label class="title">10.5.a setindex element rules</xforms:label>
  		</xforms:group>
  		<xforms:group>
  			<xforms:label>
  			  When you activate the Set index To -1 trigger you must see an xforms-scroll-first message 
  			  and the index must display the number 1. 
  			  When you activate the Set index To 100 trigger you must see an xforms-scroll-last message 
  			  and the index must display the number 3. 
  			  When you activate the Set index To 2 trigger you must not see a message 
  			  and the index must display the number 2. 
  			</xforms:label>
  		</xforms:group>
		<xforms:repeat id="lineset" nodeset="/lines/line">
			<xforms:group>
				<xforms:input ref="price">
					<xforms:label>Price:</xforms:label>
				</xforms:input>
				<xforms:input ref="@name">
					<xforms:label>Name:</xforms:label>
				</xforms:input>
			</xforms:group>
			<xforms:group>
	  			<xforms:action ev:event="xforms-scroll-first" ev:observer="lineset">
					<xforms:message level="modal">xforms-scroll-first</xforms:message>
				</xforms:action>
			</xforms:group>
			<xforms:group>
				<xforms:action ev:event="xforms-scroll-last" ev:observer="lineset">
					<xforms:message level="modal">xforms-scroll-last</xforms:message>
				</xforms:action>
			</xforms:group>
		</xforms:repeat>
		
		<xforms:trigger>
			<xforms:label>Set index To -1</xforms:label>
			<xforms:action ev:event="DOMActivate">
				<xforms:setindex repeat="lineset" index="-1"/>
			</xforms:action>
		</xforms:trigger>	
		<xforms:trigger>
			<xforms:label>Set index To 100</xforms:label>
			<xforms:action ev:event="DOMActivate">
				<xforms:setindex repeat="lineset" index="100"/>
			</xforms:action>
		</xforms:trigger>
		<xforms:trigger>
			<xforms:label>Set index To 2</xforms:label>
			<xforms:action ev:event="DOMActivate">
				<xforms:setindex repeat="lineset" index="2"/>
			</xforms:action>
		</xforms:trigger>
		<xforms:group>
		  <xforms:output value="index('lineset')">
			<xforms:label>index : </xforms:label>
		  </xforms:output>
		</xforms:group>
		
  </body>
</html>
