Example 17-15: Stylesheet to format news headines as titled boxes

<!-- NewsBoxes.xsl: Format news headlines as TitledBoxes -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:include href="TitledBox.xsl"/>
  <xsl:template name="NewsBoxes">
    <xsl:if test="not(page/ROWSET/ROW)">
      <xsl:text>You have not selected any news categories...</xsl:text>
    </xsl:if>
    <xsl:for-each select="page/ROWSET/ROW">
      <xsl:call-template name="TitledBox">
        <xsl:with-param name="Title">
          <!-- Title is the category name with link to details -->
          <a href="NewsCategory.xsql?id={ID}">
            <b><xsl:value-of select="NAME"/></b>
          </a>
        </xsl:with-param>
        <xsl:with-param name="Contents">
          <!-- Contents is a list of News Stories -->
          <xsl:for-each select="STORIES/STORIES_ROW">
          <li>
            <a title="{DESCRIPTION}" target="_top" href="{URL}">
              <xsl:value-of select="TITLE"/>
            </a>
          </li>
          </xsl:for-each>
        </xsl:with-param>
      </xsl:call-template>
      <xsl:if test="position() != last()">
        <br/>
      </xsl:if>
    </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>