Restructuring XML file

I have a client who would like to have drop down list added to his registration form that lists all of the provinces in the world by their country code. To that end, he gave me this file. Unfortunately, the structure of the data will not work for what I need to do. Below is the structure I'd like to have. Is there some way to automatically restructure the data, perhaps by using XSLT or something similar? Thanks!

  <country code="US">


This is easily accomplished by adding a single template to the XSLT identity transform:

<xsl:stylesheet version="1.0" xmlns:xsl="">

   <xsl:output method="xml" indent="yes"/>

   <xsl:template match="node() | @*">
          <xsl:apply-templates select="node() | @*" />

   <xsl:template match="countries/*">
       <country code="{name()}">
          <xsl:apply-templates select="region"/>


Need Your Help

Trouble removing duplicates from a LinkedList

java iterator linked-list

For a linked list we are supposed to find duplicates in a linked list, however, the method that I've written seems to only go through once and does not remove all duplicates. Any idea on why it is ...