<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="xml" indent="yes" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"/>
    <xsl:template match="websites">
        <html>
            <head>
                <title><xsl:value-of select="title"/></title>
                <link rel="stylesheet" type="text/css" media="all" href="portfolio.css"/>
            </head>
            <body>
                <div id="wrapper">
                    <h1><xsl:value-of select="title"/></h1>
                    <p>Page generated using <a href="portfolio.xml">XML</a> transformed with <a href="portfolio.xsl">XSLT</a> server-side by <a href="portfolio_xml">PHP</a>.</p>
                    <small>(PHP Source available in HTML Source)</small>
                    <xsl:apply-templates select="website"/>
                </div>
            </body>
        </html>
    </xsl:template>
    <xsl:template match="website">
        <div class="website">
            <h2><xsl:value-of select="title"/></h2>
            <xsl:element name="a">
                <xsl:attribute name="href"><xsl:value-of select="url"/></xsl:attribute>
                <xsl:element name="img">
                    <xsl:attribute name="src">images/screens/150x100/<xsl:value-of select="image"/></xsl:attribute>
                    <xsl:attribute name="alt"><xsl:value-of select="title"/></xsl:attribute>
                    <xsl:attribute name="title"><xsl:value-of select="title"/></xsl:attribute>
                </xsl:element>
            </xsl:element>
            <div class="info">
                <div><xsl:value-of select="description" disable-output-escaping="yes"/></div>
                <xsl:element name="a">
                    <xsl:attribute name="href">
                        <xsl:value-of select="url"/>
                    </xsl:attribute>
                    <xsl:value-of select="url"/>
                </xsl:element>
                <h3>Languages Used</h3>
                <ul>
                    <xsl:for-each select="languages/language">
                        <li><xsl:value-of select="current()"/></li>
                    </xsl:for-each>
                </ul>
                <xsl:if test="child::applications">
                    <h3>Software Utilised</h3>
                    <ul>
                        <xsl:for-each select="applications/application">
                            <li><xsl:value-of select="current()"/></li>
                        </xsl:for-each>
                    </ul>
                </xsl:if>
             </div>
        </div>
    </xsl:template>
</xsl:stylesheet>