The data you want to extract from the XML data source is inside the XML tag itself.
Your XML data can be a bit more complex than a simple combination of nested tags. In the following example, the <Sales> tag makes up an item and also contains information we want to extract:
<html>
<Sales ProductName="Strings" ProductID="101" ProductColor="red" OrderQty="200"
RepName="Peter" OrderDate="2009-08-18" />
<Sales ProductName="Yarn" ProductID="102" ProductColor="green" OrderQty="50"
RepName="Lois" OrderDate="2009-09-06" />
<Sales ProductName="Thread" ProductID="102" ProductColor="blue" OrderQty="150"
RepName="George" OrderDate="2009-11-12" />
</html>
Here is what you need to know:
Using the example data source above, to display the values of the attribute ProductName in column 1, OrderQty in column 2, and OrderDate in column 3, your <style> block would look like this:
<style>
Sales::attribute(ProductName) {
itemcol: 1;
name: "products";
}
Sales::attribute(OrderQty) {
type: number;
itemcol: 2;
name: "quantity";
}
Sales::attribute(OrderDate) {
type: date;
itemcol: 3;
name: "date";
}
Sales {
type: item;
definition: all;
}
</style>
Note the use of the name property in each column. If you ever want to refer to any of the columns, such as from a column that displays the results of a mathematical formula, for specifying which columns to use in a chart or from the klipscript, you can use these names.
Also see: Appendix C in the Klip Developer Guide.