Hello,
this is my XML:

<OPTIONS>

<ROW NUM="1">
<ROW_NUM>1</ROW_NUM>
<INVOICE_NUMBER>000001</INVOICE_NUMBER>
<ID>144795</ID>
<CUS_UK>20544</CUS_UK>
<DESC_LONG>KELEME</DESC_LONG>
</ROW>

<ROW NUM="2">
<ROW_NUM>1</ROW_NUM>
<INVOICE_NUMBER>000001</INVOICE_NUMBER>
<ID>69449</ID>
<CUS_UK>15249</CUS_UK>
<DESC_LONG>PETRIMEX</DESC_LONG>
</ROW>

<ROW NUM="3">
<ROW_NUM>1</ROW_NUM>
<INVOICE_NUMBER>000001</INVOICE_NUMBER>
<ID>4125</ID>
<CUS_UK>15249</CUS_UK>
<DESC_LONG>PETRIMEX</DESC_LONG>
</ROW>

<ROW NUM="4">
<ROW_NUM>3</ROW_NUM>
<INVOICE_NUMBER>000002</INVOICE_NUMBER>
<ID>4152</ID>
<CUS_UK>15249</CUS_UK>
<DESC_LONG>PETRIMEX</DESC_LONG>
</ROW>

<ROW NUM="5">
<ROW_NUM>3</ROW_NUM>
<INVOICE_NUMBER>000002</INVOICE_NUMBER>
<ID>69486</ID>
<CUS_UK>15249</CUS_UK>
<DESC_LONG>PETRIMEX</DESC_LONG>
</ROW>
</OPTIONS>

What I need to do is repeat some header everytime ROW_NUM changes. I came this far:

<xsl:for-each select="OPTIONS/ROW">
  <xsl:choose>
    <xsl:when test="position()=1 or preceding-sibling::ROW_NUM/text()[1] != ./ROW_NUM/text()">
        <!-- this should match the first row and then every row where ROW_NUM is different form previous -->
   </xsl:when>
   <xsl:otherwise>
     <!-- this should match the rest -->
   <xsl:otherwise>
 </xsl:choose>
</xsl:for-each>

I'm having trouble with writing the condition in red. Can someone give me an advice?
Thanks a lot!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.