<table name="ASSETS_TABLE" statement-type="INSERT">
<column name="ASSET_ID">string(/assets/asset/value())</column>
<column name="ASSET_VALUE">
<option name="VALUE_GREATER_THEN_0">/assets/asset > 0</option>
<option name="VALUE_LESS_THEN_0">/assets/asset < 0</option>
<option name="OTHERWISE">1</option>
</column>
<column name="ASSET_DESCRIPTION">string(/assets/asset/text())</column>
</table>
From the above XML, i need to get the values of the attributes (i.e name). For column and option nodes, how would you go about using a loop to get the value of the attribute and using it as an element name or a variable name and the value of the column node as value of the new element or variable.
So I’d want something like
<ASSET_VALUE>
<VALUE_GREATER_THEN_0>/assets/asset > 0</VALUE_GREATER_THEN_0>
<VALUE_LESS_THEN_0>/assets/asset < 0</VALUE_LESS_THEN_0>
<OTHERWISE>1</OTHERWISE>
</ASSET_VALUE>
<ASSET_DESCRIPTION>string(/assets/asset/text())</ASSET_DESCRIPTION>
Any help on this is really appreciated.
Thanks guys
Here’s an example based on my answer here.
You didn’t specify what you wanted done for
table, so I guessed.Using your XML input (modified to be well formed):
With this XSLT 1.0 stylesheet:
Produces this output: