<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>

<xsl:template match="Records">
<resultset>
  <source>
    <xsl:attribute name="name"> 
      <xsl:text>New York Times</xsl:text>
    </xsl:attribute>

   <xsl:apply-templates select="Record"/>
  </source>
</resultset>
</xsl:template>


<xsl:template match="Record">

  <xsl:choose>
  <xsl:when test="Title='And Bear In Mind '" />
  <xsl:when test="Title='New &amp; Noteworthy Paperbacks '"/>

  <xsl:otherwise>
  <result>

    <xsl:attribute name="rank">
      <xsl:value-of select="@N" />
    </xsl:attribute>

    <url>
     <xsl:attribute name="title">
       <xsl:value-of select="Details/Content[1]/Title" />
     </xsl:attribute>
    </url>

    <summary>
       <xsl:choose>
          <xsl:when test="Details/Content[1]/Paragraph" >
             <xsl:value-of select="Details/Content[1]/Paragraph" />
          </xsl:when>
          <xsl:otherwise>
             <xsl:value-of select="Details/Content[2]/Paragraph" />
          </xsl:otherwise>
       </xsl:choose>
    </summary>

    <nyTimesContent>
       <xsl:for-each select="Details/Content/Paragraph">
         <paragraph>
           <xsl:value-of select="." />
         </paragraph>
       </xsl:for-each>
    </nyTimesContent>

  </result>

  </xsl:otherwise>
  </xsl:choose>

</xsl:template>

</xsl:stylesheet>
