|
next
|
 Subject: how to compare a current value to a value in the next node Author: Dexter McCloud Date: 23 Sep 2004 11:11 AM
|
I am a fledgling developer in the XSLT world. So, I apologize if this
is an obvious question. I have XML, returned from my database, that will look like this:
<row row_type="order_info" order_id="63893" item_id="1146211"/>
<row row_type="order_info" order_id="63903" item_id="1146216"/>
<row row_type="order_info" order_id="63904" item_id="1146216"/>
I am generating HTML based on the values in the XML. I want to emit a
<TR> tag for every row of data; that's the easy part. However, if the
item_id is the same, I want to make the data part of the SAME <TR>.
Example using the data above:
<table>
<tr>
<td>order id</td>
<td>Item id</td>
</TR>
<tr>
<td>63893</td>
<td>1146211</td>
</TR>
<tr>
<td>63903<br>63904
</td>
<td>1146216</td>
</TR>
</table>
As you can see, because the "item_id (2nd column) is the same, I simply
combined the data inside the <TD> tags. Otherwise, each line will
occupy it's own <TR>.
But, how do I do this with XSLT?
Thanks,
Dexter (new user)
item_info.xml example of typical data (4 rows)
|
|
|