topical media & game development

talk show tell print

lib-present-course-webtechnology-slides-mydvd.xsl / xsl



  <?xml version="1.0"?>
  <xsl:transform version="1.0"
                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  
    <xsl:template match="/mydvd">
      <html>
        <xsl:comment>This page is generated by XSLT</xsl:comment>
        <head>
          <title>My DVD Collection</title>
        </head>
        <body>
          <h1>My DVD Collection</h1>
          <xsl:apply-templates select="child::dvd">
            <xsl:sort select="released"/>
          </xsl:apply-templates>
        </body>
      </html>
    </xsl:template>
  
    <xsl:template match="dvd">
      <xsl:text><!-- new line to generate break in HTML source: -->
      </xsl:text> 
      <table style="border-top: 1pt solid gray; width: 25em">
        <xsl:apply-templates select="released"/>
        <xsl:apply-templates select="genre|title|director|plot"/>
      </table>
    </xsl:template>
  
    <xsl:template match="title|director|released">
      <tr>
        <td style="width: 5em">
          <xsl:value-of select="local-name()"/>:         
        </td>
        <td style="width: 20em">
          <xsl:value-of select="child::text()"/>
        </td>
      </tr>
    </xsl:template>
  
    <xsl:template match="genre"/>
  
    <xsl:template match="plot">
      <tr>
        <td>plot:</td>
        <td>
          <xsl:copy-of select="*"/>
        </td>
      </tr>
    </xsl:template>
  
  </xsl:transform>
  


(C) Æliens 20/08/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.