Declarative-Languages / Declarative Language Practical 2 / 3a.xslt
3a.xslt
Raw
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
    <xsl:output method="xml" indent="yes"/>

	<xsl:template match="/africa">
		<regions>
			<xsl:apply-templates select="region"/>
		</regions>
	</xsl:template>

	<xsl:template match="region">
		<region name="{@name}">
			<xsl:apply-templates select="country"/>
		</region>
	</xsl:template>

	<xsl:template match="country">
		<capital-city>
			<xsl:value-of select="@capital"/>
		</capital-city>
	</xsl:template>

</xsl:stylesheet>