lozina
Lifer
I have found sample online turning generic xml output to tables but they are based on the cell data being in separate text nodes, I need something that will do the same thing but the cell data is in separate attributes.
Example of what my xml output would be equivalent to:
<cars>
<car car_id="1" color="blue" make="Ford" model="Focus"/>
<car car_id="2" color="red" make="Honda" model="Accord"/>
</cars>
I want to be able to use XSLT to turn that xml into an HTML table looking like this:
car_id___|__color__|__make__|__model___|
-----------+----------+------------+------------+
1_______|__blue__|___Ford___|___Focus__|
2_______|__red___|__Honda__|___Accord_|
The thing is the xml output will change in format so the xslt must be able to do this dynamically, without any reference to node names not even knowing how many attributes there are. So while my above example is about cars with those specific attributes it should handle for example another similarly structured xml output but which maybe each node is a book and has completely different attributes. But it should handle this just the same building a simple table out of it.
It must be able to:
1. create a table header based on what attributes are sent for each node
2. iterate through each node and output the attribute values into separate cells
Example of what my xml output would be equivalent to:
<cars>
<car car_id="1" color="blue" make="Ford" model="Focus"/>
<car car_id="2" color="red" make="Honda" model="Accord"/>
</cars>
I want to be able to use XSLT to turn that xml into an HTML table looking like this:
car_id___|__color__|__make__|__model___|
-----------+----------+------------+------------+
1_______|__blue__|___Ford___|___Focus__|
2_______|__red___|__Honda__|___Accord_|
The thing is the xml output will change in format so the xslt must be able to do this dynamically, without any reference to node names not even knowing how many attributes there are. So while my above example is about cars with those specific attributes it should handle for example another similarly structured xml output but which maybe each node is a book and has completely different attributes. But it should handle this just the same building a simple table out of it.
It must be able to:
1. create a table header based on what attributes are sent for each node
2. iterate through each node and output the attribute values into separate cells