<s:include b:url="{concat($bpc_controlpath, 'b-listview/b-listview.xml')}"/> <s:execute> <s:task b:action="show" /> </s:execute> <s:behavior b:name="row-delete"> <s:event b:on="command"> <s:task b:action="hide" b:target="../.."/> <s:task b:action="set" b:target="../../@b:changed" b:value="deleted"/> </s:event> </s:behavior> <s:behavior b:name="row-edit"> <s:event b:on="command"> <s:task b:action="set" b:target="../../@b:changed" b:value="edited"/> </s:event> </s:behavior> <s:behavior b:name="row-new"> <s:event b:on="command"> <s:task b:action="set" b:target="../../@b:changed" b:value="new"/> </s:event> </s:behavior> <s:behavior b:name="save-changes"> <s:event b:on="command"> <!-- Copying the changed rows and removing the editing controls from them. --> <!--s:task b:action="alert" b:value="Copying and removing." /--> <s:task b:action="copy" b:source="id('filmdisplay')/tbody/tr[@b:changed]" b:destination="id('delta-bxml-container')/tbody" b:mode="aslastchild" /> <s:task b:action="remove" b:target="id('delta-bxml-container')/tbody/tr/td[last()]"/> <!-- Loading and putting in BXML format of stylesheet. --> <s:task b:action="load" b:url="data/bxml2xml_bpc.xsl" b:destination="."/> <!-- Doing the transformation, putting the xml in a variable. --> <!--s:task b:action="alert" b:value="Transforming." /--> <s:task b:action="transform" b:stylesheet="$bxml2xml" b:datasource="id('delta-bxml-container')" b:destination="id('delta-xml-container')"/> <s:variable b:name="delta-xml" b:select="id('delta-xml-container')/*"/> <s:task b:action="bxml2string" b:variable="$delta-xml"/> <!-- Sending the processed filmdata to the server and receiving the response. --> <!--s:task b:action="alert" b:value="Sending and loading." /--> <s:variable b:name="response"/> <s:task b:action="load" b:method="POST" b:data="{concat('xmldata=',$delta-xml)}" b:destination="$response" b:url="save_xml.php"/> <!--s:task b:action="alert" b:value="{concat('transform result = ', $delta-xml)}"/--> <!--s:task b:action="alert" b:value="{concat('server response = ', $response)}"/--> <!-- Cleaning the local data so the changes cannot be saved twice. --> <s:task b:action="alert" b:value="Removing elements." /> <s:task b:action="alert" b:value="step 1" /> <s:task b:action="remove" b:target="id('filmdisplay')/tbody/tr[@b:changed='deleted']"/> <s:task b:action="alert" b:value="step 2" /> <s:task b:action="remove" b:target="id('filmdisplay')/tbody/tr/@b:changed"/> <s:task b:action="alert" b:value="step 3" /> <s:task b:action="remove" b:target="id('delta-bxml-container')//tr"/> <s:task b:action="alert" b:value="step 4" /> <s:task b:action="remove" b:target="id('delta-xml-container')/*"/> </s:event> </s:behavior> <div style="margin:50px;"> <div style="width:650px; text-align:left; padding-bottom:20px;"> <h1>XML Databinding - BPC XSLT Engine</h1> In order to save the data in this example, PHP5 must be enabled on your server. </div> <table id="delta-bxml-container" style="display:none;" xmlns="http://www.w3.org/1999/xhtml" xmlns:b="http://www.backbase.com/b" xmlns:s="http://www.backbase.com/s"><tbody></tbody></table> <div id="delta-xml-container" style="display:none;"></div> <div id="filmdisplay-container"> <s:execute> <!-- Loading, cleaning and putting in BXML format of filmdata. --> <s:variable b:name="filmdata_string"/> <s:task b:action="load" b:url="data/filmdata.xml" b:destination="$filmdata_string"/> <s:if b:test="contains($filmdata_string, '?&gt;')"> <s:task b:action="assign" b:target="$filmdata_string" b:select="substring-after($filmdata_string, '?&gt;')" /> </s:if> <s:task b:action="move" b:destination="." b:source="concat('&lt;s:xml b:name=&quot;filmdata_xml&quot; xmlns:s=&quot;http://www.backbase.com/s&quot; xmlns:b=&quot;http://www.backbase.com/b&quot;&gt;', $filmdata_string, '&lt;/s:xml&gt;')"/> <!-- Loading and putting in BXML format of stylesheet. --> <s:task b:action="load" b:url="data/xml2bxml_bpc.xsl" b:destination="."/> <!-- Transform and output the data, then sort the output table. --> <s:task b:action="transform" b:stylesheet="$xml2bxml" b:datasource="$filmdata_xml" b:destination="id('filmdisplay-container')"/> <s:task b:action="sort" b:target="id('filmdisplay')/thead/tr/th[1]" b:reverse="false"/> </s:execute> </div> <div style="width:650px; text-align:right; margin-bottom:2em;"> <b:button b:behavior="save-changes">Save Changes</b:button> </div> </div>