[xsl] Grouping consecutive page numbers for index (xslt 1.0)

Subject: [xsl] Grouping consecutive page numbers for index (xslt 1.0)
From: Kevin Bird <kevin.bird@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 21 Aug 2013 14:49:34 +0100
Hello,

Would really appreciate some guidance with the following problem.
I'm stuck with XSLT 1.0.
Any pointers as to the best approach would help.

INPUT:
<pages>
	<page>1</page>
	<page>2</page>
	<page>3</page>
	<page>6</page>
	<page>12</page>
	<page>13</page>
	<page>14</page>
	<page>15</page>
	<page>16</page>
</pages>

DESIRED OUTPUT:
<pages>
	<page>1-3</page>
	<page>6</page>
	<page>12-16</page>
</pages>

Regards.

--
Kevin

Current Thread