View Single Post
  #1 (permalink)  
Old March 2nd, 2010, 07:34 AM
anil_yadav26@hotmail.com anil_yadav26@hotmail.com is offline
Authorized User
 
Join Date: Feb 2009
Location: Gurgaon
Posts: 31
Thanks: 6
Thanked 1 Time in 1 Post
Send a message via MSN to anil_yadav26@hotmail.com
Default [XSLT] Index Page Range

Hi,

I have an xml file in which pages are appearing under the <link> tag. I have to make the page range for continuous appearing pages e.g. in ITEM 3 pages are appearing like this:

<link>410</link><link>411</link><link>412</link><link>413</link><link>420</link>

and need to transform like this:

<link>410--413</link><link></link><link></link><link></link><link>420</link>

Can anybody suggest me to write the XSLT, XQuery for the same.

NOTE: Please note that all the <link> tags are required because they contains some attribute IDs which can be use in future for updates.

Source XML File

Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<book>
<endmatter>
<index>
<title><emphasis type="bold">European Court of Justice: Cases in case number order</emphasis></title>
<index-list>
<index-item><index-entry>1/58 Stork v High ECR 17</index-entry>&#x2002;<link>232--233</link></index-item>
<index-item><index-entry>42 SNUPAT v High Authority</index-entry>&#x2002;<link>410</link><link>411</link><link>412</link><link>413</link><link>420</link><link>448</link><link>449</link></index-item>
<index-item><index-entry>16/62 Confration Nationale </index-entry>&#x2002;<link>520</link><link>521</link><link>524</link><link>525</link><link>530</link><link>595</link></index-item>
</index-list>
</index>
</endmatter>
</book>
Output required

Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<book>
<endmatter>
<index>
<title><emphasis type="bold">European Court of Justice: Cases in case number order</emphasis></title>
<index-list>
<index-item><index-entry>1/58 Stork v High ECR 17</index-entry>&#x2002;<link>232--233</link></index-item>
<index-item><index-entry>42 SNUPAT v High Authority</index-entry>&#x2002;<link>410--413</link><link></link><link></link><link></link><link>420</link><link>448-449</link><link></link></index-item>
<index-item><index-entry>16/62 Confration Nationale </index-entry>&#x2002;<link>520--521</link><link></link><link>524--525</link><link></link><link>530</link><link>595</link></index-item>
</index-list>
</index>
</endmatter>
</book>
I'll really appreciate any help on this.

Regards,
Anil Yadav

Last edited by anil_yadav26@hotmail.com; March 2nd, 2010 at 08:00 AM..
Reply With Quote