This is my XML:
<SECTION_CONTENT_LIST>
<SECTION_CONTENT_LIST_ITEM>
<NTC_LIGHTLISTPRODUCT>
<REGION>10-Mediterraneo Occidentale - Francia</REGION>
<ITA_LIGHT_NUMBER>0840</ITA_LIGHT_NUMBER>
</NTC_LIGHTLISTPRODUCT>
</SECTION_CONTENT_LIST_ITEM>
<SECTION_CONTENT_LIST_ITEM>
<NTC_LIGHTLISTPRODUCT>
<REGION>10-Mediterraneo Occidentale - Francia</REGION>
<ITA_LIGHT_NUMBER>0843</ITA_LIGHT_NUMBER>
</NTC_LIGHTLISTPRODUCT>
</SECTION_CONTENT_LIST_ITEM>
<SECTION_CONTENT_LIST_ITEM>
<NTC_LIGHTLISTPRODUCT>
<REGION>10-Mediterraneo Occidentale - Francia</REGION>
<ITA_LIGHT_NUMBER>0850</ITA_LIGHT_NUMBER>
</NTC_LIGHTLISTPRODUCT>
</SECTION_CONTENT_LIST_ITEM>
<SECTION_CONTENT_LIST_ITEM>
<NTC_LIGHTLISTPRODUCT>
<REGION>16-Mar Tirreno - Francia (Corsica)</REGION>
<ITA_LIGHT_NUMBER>0906</ITA_LIGHT_NUMBER>
</NTC_LIGHTLISTPRODUCT>
</SECTION_CONTENT_LIST_ITEM>
<SECTION_CONTENT_LIST_ITEM>
<NTC_LIGHTLISTPRODUCT>
<REGION>16-Mar Tirreno - Francia (Corsica)</REGION>
<ITA_LIGHT_NUMBER>0922.15</ITA_LIGHT_NUMBER>
</NTC_LIGHTLISTPRODUCT>
</SECTION_CONTENT_LIST_ITEM>
<SECTION_CONTENT_LIST_ITEM>
<NTC_LIGHTLISTPRODUCT>
<REGION>25-Mare Adriatico - Slovenia</REGION>
<ITA_LIGHT_NUMBER>3620</ITA_LIGHT_NUMBER>
</NTC_LIGHTLISTPRODUCT>
</SECTION_CONTENT_LIST_ITEM>
</SECTION_CONTENT_LIST>
This is my XSLT 1.0:
<table style='border-collapse:collapse; width:100%; align:center' cellspacing="0" cellpadding="0">
<xsl:for-each select="//ITA_LIGHT_NUMBER">
<xsl:sort select="." order="ascending" data-type="text"/>
<tr style="line-height:0.78cm">
<xsl:variable name="regione" select="preceding-sibling::REGION"/>
<td style="height:0.68cm;border-bottom:dotted 1.0">
<xsl:if test="following::REGION != $regione">
<xsl:value-of select="preceding-sibling::REGION"/>
</xsl:if>
</td>
<td style="height:0.68cm;border-bottom:dotted 1.0">
<xsl:value-of select="."/>
</td>
</tr>
</xsl:for-each>
</table>
This create a table in two column. In the first column write Region and in the second column write ITA_LIGHT_NUMBER.
10-Mediterraneo Occidentale - Francia 0840
10-Mediterraneo Occidentale - Francia 0843
10-Mediterraneo Occidentale - Francia 0850
16-Mar Tirreno - Francia (Corsica) 0906
16-Mar Tirreno - Francia (Corsica) 0922.15
25-Mare Adriatico - Slovenia 3620
But I want this output:
10-Mediterraneo Occidentale - Francia 0840 - 0850
16-Mar Tirreno - Francia (Corsica) 0906 - 0922.15
25-Mare Adriatico - Slovenia 3620
Pratically: write the first region and the first ITA_LIGHT_NAME, if the following REGION is different from the current write the ITA_LIGHT_NUMBER.
XSLT 1.0andgroupingto find numerous examples.