Populating a DataTable
In this example, a node list is selected from the given Xml document, and a given DataTable is populated with nodes relative to the nodes in the selected nodes.
Smartsite SXML | Copy Code |
---|---|
{buffer.set(d, datatable.createempty())} <se:xmlprocessor save="a" > <se:parameters> <se:parameter name="xml"> <root> <addresses> <address nr="1"> <street>Jaarbeursplein</street> <zipcode>3521 AL</zipcode> <city>Utrecht</city> </address> <address nr="2"> <street>Elektronicaweg 131</street> <zipcode>2628 XG</zipcode> <city>Delft</city> </address> </addresses> </root> </se:parameter> <se:parameter name="actions"> <se:collection> <se:member type="multiplenodes" query="//addresses/address" > {this.populatedatatable($d, 'nr=@nr', 'street=./street', 'zipcode=./zipcode', 'city=./city')} </se:member> </se:collection> </se:parameter> </se:parameters> </se:xmlprocessor> <se:format inputdata="{buffer.get(d)}" resultformat="{page.setforcedresult(this.result())}"> <se:rowformat trim="both"><p> {this.field(street)}<br /> {this.field(zipcode)}, {this.field(city)} </p></se:rowformat> </se:format> |
Example Result | Copy Code |
---|---|
<p> Jaarbeursplein<br /> 3521 AL, Utrecht </p><p> Elektronicaweg 131<br /> 2628 XG, Delft </p> |