<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method='html' version='1.0' encoding='UTF-8' indent='yes'/>
  <xsl:template match="/">
    <html>
      <head>
        <title>Using XSL to display images and links</title>
      </head>
      <body>
        <div style="width:550px; margin:10px auto; text-align:center;">
          <h1>Using XSL to display images and links</h1>
          <div style="margin:10px;"><xsl:apply-templates select="//picture" /></div>
          <div style="text-align:left"><xsl:apply-templates select="//website"/></div>
          <div style="text-align:left"><xsl:apply-templates select="//email"/></div>
        </div>
      </body>
    </html>
  </xsl:template>
  <xsl:template match="picture">
    <img>
      <xsl:attribute name="src"><xsl:value-of select="./@filename"/></xsl:attribute>
      <xsl:attribute name="width"><xsl:value-of select="./@x"/></xsl:attribute>
      <xsl:attribute name="height"><xsl:value-of select="./@y"/></xsl:attribute>
    </img> 
  </xsl:template> <!-- html image: <img src="image name" width="x" height="y" /img> -->
  <xsl:template match="website">
    <a>
      <xsl:attribute name="href"><xsl:value-of select="./@href"/></xsl:attribute>
      <xsl:attribute name="title"><xsl:value-of select="."/></xsl:attribute>
      <xsl:value-of select="."/>
    </a> 
  </xsl:template> <!-- html link: <a href="http://link">link name</a> -->
  <xsl:template match="email">
    <a>
      <xsl:attribute name="href">mailto:<xsl:value-of select="@href"/></xsl:attribute>
      <xsl:attribute name="title"><xsl:value-of select="."/></xsl:attribute>
      <xsl:value-of select="."/>
    </a>
  </xsl:template>
</xsl:stylesheet>
