I have the following XML file (It’s actually SQL server reporting service RDL file). I want to replace the <Value> in the TablixCell to the <DataField> in the Fields by position. That is, “order date1” and “prod id1” should be replaced to “order_date” and “prod_id” respectively.
Preferably it can be done in SQL Server 2008 using XQuery. Xslt is fine to if not.
<Fields>
<Field Name="order_date">
<DataField>order_date</DataField>
<rd:TypeName>System.DateTime</rd:TypeName>
</Field>
<Field Name="prod_id">
<DataField>prod_id</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
....
</Fields>
......
<TablixRows>
<TablixRow>
<Height>0.25in</Height>
<TablixCells>
<TablixCell>
......
<Value>order date1</Value>
......
</TablixCell>
<TablixCell>
.....
<Value>prod id1</Value>
.....
Try the following:
When run this with input XML
the result is the required