on 2024 Sep 11 2:36 PM
Hi,
i've created Simple Transformation for following xml:
<Fuel type="Diesel CI">
<FuelConsumption unit="l/100km">23</FuelConsumption>
<FuelConsumption unit="l/t-km">26</FuelConsumption>
<FuelConsumption unit="l/m³-km">25</FuelConsumption>
<FuelConsumption unit="g/km">11</FuelConsumption>
<FuelConsumption unit="g/t-km">23</FuelConsumption>
<FuelConsumption unit="g/m³-km">14</FuelConsumption>
</Fuel>
Transformation looks as below:
<Fuel>
<tt:loop ref="FUEL">
<FuelConsumption tt:value-ref="FuelConsumption">
</FuelConsumption>
</tt:loop>
</Fuel>
Currently I am transforming the FuelConsumption values (23,26,25...) to a table, which is fine, but I want to save the attribute unit as well. I have a table with two fields FuelConsumption and Unit. Do you know what the correct syntax would be? I have tried many options, but unfortunately none of them work.
Kind regards
I did find solution by myself finally.
This syntax will do the job:
<Fuel>
<tt:loop ref="FUEL">
<FuelConsumption>
<tt:attribute name="unit" value-ref="$REF.unit"/>
<tt:value ref="FuelConsumption"/>
</FuelConsumption>
</tt:loop>
</Fuel>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
5 | |
4 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.