XSL Duplicate rows Issue

wxdqz

New Member
Hi folks,

I've been playing around with xml/xls for the last couple of days, however I have one issue which I

just can't solve. I hope that anyone here can help me out with it


Sample XML file
===============
<Note>
<message>
<item>
<ordered_item>1111111111</ordered_item>
<description>main_item description</description>
<qty>10</qty>
<subitem>
<no>2222222</no>
<no_of>1/ 2</no_of>
<quantity>7</quantity>
</subitem>
<subitem>
<no>3333333</no>
<no_of>2/ 2</no_of>
<quantity>7</quantity>
</subitem>
</item>
</message>
</Note>
What do I want to archieve?
===========================
I want to generate a html template which displays the information as described below

10 1111111111 main_item description
2222222 1/ 2 3333333
3333333 2/ 2 3333333



I use the following code in my XLS document


<xsl:template match="Note">
<xsl:for-each select="message/item/subitem">
<tr>
<td><xsl:value-of select="../qty" /></td>
<td><xsl:value-of select="../ordered_item"/></td>
<td><xsl:value-of select="../description"/></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><xsl:value-of select="item" /></td>
<td> </td>
<td><xsl:value-of select="no_of" />   <xsl:value-of select="no"/></td>
<td><xsl:value-of select="quantity"/></td>
</tr>
</xsl:for-each>
</xsl:template>

However this code generates the following output

10 1111111111 main_item description
2222222 1/ 2 3333333
10 1111111111 main_item description
3333333 2/ 2 3333333


Can someone point out for me what I am doing wrong and which way would be the best to resolve this

Thanks in advance
 
Back
Top