Mode:

Compact lists

Showing:

Documentation
Parameters
Used by
References
Source
Main stylesheet books.xsl
Documentation

Description

Created on: May 8, 2013

Author: octavian_nadolu

Stylesheet version 2.0
Template books
Documentation

Description

Generates a table with books.

Namespace No namespace
Match books
Mode #default
References
Parameter
Import precedence 0
Source
<xsl:template match="books">
  <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
      <title>Recommended Books</title>
    </head>
    <body>
      <h1>The list of recommended books</h1>
      <xsl:choose>
        <xsl:when test="$groupByTechnology">
          <xsl:for-each-group select="book" group-by="@technology">
            <h2>
              <xsl:value-of select="@technology"/>
            </h2>
            <hr/>
            <table cellspacing="12px">
              <xsl:apply-templates select="current-group()"/>
            </table>
          </xsl:for-each-group>
        </xsl:when>
        <xsl:otherwise>
          <table cellspacing="12px">
            <xsl:apply-templates select="book"/>
          </table>
        </xsl:otherwise>
      </xsl:choose>
    </body>
  </html>
</xsl:template>
Template book
Namespace No namespace
Match book
Mode #default
References
Template
Import precedence 0
Source
<xsl:template match="book">
  <!-- Book -->
  <tr>
    <td valign="top">
      <!--Image-->
      <xsl:apply-templates select="image"/>
    </td>
    <td>
      <xsl:variable name="title" select="title"/>
      <xsl:variable name="titleURI" select="@targeturi"/>
      <xsl:call-template name="linkTitle">
        <xsl:with-param name="titleUri" select="$titleURI"/>
        <xsl:with-param name="title" select="$title"/>
      </xsl:call-template>
      <!-- Author -->
      <p>
        <i>by 
                        <xsl:value-of select="author"/>
        </i>
      </p>
      <!-- Book info -->
      <b>Paperback: </b><xsl:value-of select="paperback"/> | 
                <b>Publisher: </b><xsl:value-of select="publisher"/> | 
                <b>Isbn: </b><xsl:value-of select="isbn"/>
      <!-- Description -->
      <xsl:apply-templates select="description"/>
    </td>
  </tr>
</xsl:template>
Template description
Namespace No namespace
Match description
Mode #default
Import precedence 0
Source
<xsl:template match="description">
  <p>
    <xsl:apply-templates/>
  </p>
</xsl:template>
Template linkTitle
Documentation

Description

Generates a title with link

Parameters

titleUri The URI of the title
title The value of the title
Namespace No namespace
Used by
Template
Parameters
QName Namespace
title No namespace
titleUri No namespace
Import precedence 0
Source
<xsl:template name="linkTitle">
  <xsl:param name="titleUri"/>
  <xsl:param name="title"/>
  <!-- Title with link -->
  <h3>
    <a href="{$titleUri}" title="{$title}">
      <xsl:value-of select="$title"/>
    </a>
  </h3>
</xsl:template>
Template image
Namespace No namespace
Match image
Mode #default
Import precedence 0
Source
<xsl:template match="image">
  <img src="{@src}" alt="{@description}" width="110" height="140"/>
</xsl:template>
Parameter groupByTechnology
Documentation

Description

Specifies if the books should be grouped by technology.
Namespace No namespace
Select false()
Used by
Template
Source
<xsl:param name="groupByTechnology" select="false()"/>