kohinoor24
Programmer
Hi,
I have some example xml:
<Root>
<Rec>
<RecType>Type A</RecType>
<Words>testing output of A</Words>
</Rec>
<Rec>
<RecType>Type B</RecType>
<Words>testing output of B</Words>
</Rec>
<Rec>
<RecType>Type A</RecType>
<Words>testing output of A again</Words>
</Rec>
</Root>
I'm basically trying to output each 'RecType' as a heading with the corresponding 'Words' underneath. Using a xsl:for-each only results in all of the results being listed one after the other, whereas I actually want them grouped (i.e. Type A results and then Type B).
I did:
<xsl:for-each select="Rec/RecType">
<table>
<tr>
<td><xsl:value-of select="." /></td>
<td><xsl:value-of select="../Words" /></td>
</tr>
</table>
</xsl:for-each>
Any help appreciated.
Thanks.
I have some example xml:
<Root>
<Rec>
<RecType>Type A</RecType>
<Words>testing output of A</Words>
</Rec>
<Rec>
<RecType>Type B</RecType>
<Words>testing output of B</Words>
</Rec>
<Rec>
<RecType>Type A</RecType>
<Words>testing output of A again</Words>
</Rec>
</Root>
I'm basically trying to output each 'RecType' as a heading with the corresponding 'Words' underneath. Using a xsl:for-each only results in all of the results being listed one after the other, whereas I actually want them grouped (i.e. Type A results and then Type B).
I did:
<xsl:for-each select="Rec/RecType">
<table>
<tr>
<td><xsl:value-of select="." /></td>
<td><xsl:value-of select="../Words" /></td>
</tr>
</table>
</xsl:for-each>
Any help appreciated.
Thanks.