setURL

You can programmatically change the URL and the XPath of the data set. This will allow you to pull in data from another XML file without having to define a separate data set.

Just changing the values of the URL or XPath won't cause the data to reload. Use the loadData() function to load the new data.

Load Employees 2 | Load Employees 3

Last Name First Name Phone
{lastname}
{firstname}
{phone}

The current URL for the data set is: "../../data/employees-01.xml"

In the above example, 'employees-3.xml' does not have a 'phone' node, so we use spry:if to hide the column if undefined.

setXPath

XPath can also be set to refine the data set. Be aware that changing the XPath will change the data references that are available to the data set. Ensure that undefined data references are dealt with.

Last Name First Name
{lastname}
{firstname}

Last Name only | First Name only | Original

The current XPath for the data set is "employees/employee".