<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
  xmlns:x="http://www.w3.org/1999/xhtml"
  xmlns:c="http://www.acooke.org/countries"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:output method="xml" version="1.0" encoding="iso-8859-1"
   omit-xml-declaration="no" indent="yes"/>
 <xsl:template match="/">
  <c:countries>
   <xsl:apply-templates/>
  </c:countries>
 </xsl:template>
 <xsl:template match="x:a[parent::x:li]|x:a[parent::x:font[parent::x:li]]">
  <c:country>
   <xsl:apply-templates select="@*"/>
   <xsl:apply-templates select="text()"/>
  </c:country>
 </xsl:template>
 <xsl:template match="x:li/x:a/@href|x:li/x:font/x:a/@href">
  <c:file><xsl:value-of select="substring-after(., '/')"/></c:file>
 </xsl:template>
 <xsl:template match="x:li/x:a/text()|x:li/x:font/x:a/text()">
  <c:name><xsl:value-of select="."/></c:name>
 </xsl:template>
 <xsl:template match="*">
  <xsl:apply-templates select="child::*"/>
 </xsl:template>
 <xsl:template match="@*"/>
 <xsl:template match="text()"/>
</xsl:stylesheet>
