Web Query and Transformation Languages - Solutions to Exercises

  1. <xsl:template match="/programme">
      <html>
        <head>
          <title>
             <xsl:value-of select="degree"/>
             (<xsl:value-of select="year"/>)
          </title>
        </head>
        <body>
          <h2>List of Distinctions</h2>
          <ul>
            <xsl:for-each select="results/distinction/name">
              <li><xsl:value-of select="."/></li>
            </xsl:for-each>
          </ul>
        <body>
      </html>
    </xsl:template>
    


  2. <xsl:template match="/teaches">
      <teaches>
        <xsl:for-each select="teaches-tuple">
          <teaches-tuple>
            <course><xsl:value-of select="@course"/></course>
            <lecturer><xsl:value-of select="@lecturer"/></lecturer>
          </teaches-tuple>
        </xsl:for-each>
      </teaches>
    </xsl:template>
    


  3. Here are the XSL files and the corresponding HTML output files for the queries: