<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:r="http://nwalsh.com/xmlns/extreme2006/recipes/"
                xmlns:saxon="http://saxon.sf.net/"
                version="2.0">

  <xsl:output method="text"/>

  <xsl:variable name="numbers">
    <numbers>
      <number>1</number>
      <number>2</number>
      <number>3</number>
      <number>4</number>
      <number>5</number>
      <number>6</number>
      <number>7</number>
      <number>8</number>
      <number>9</number>
      <number>10</number>
      <number>11</number>
      <number>12</number>
    </numbers>
  </xsl:variable>

  <xsl:variable name="one-to-ten" select="$numbers/numbers/number[position() <= 10]"/>
  <xsl:variable name="even" select="$one-to-ten[position() mod 2 = 0]"/>
  <xsl:variable name="odd" select="$one-to-ten except $even"/>
  <xsl:variable name="prime" select="($one-to-ten[2],                                       $one-to-ten[3],                                       $one-to-ten[5],                                       $one-to-ten[7])"/>
  <xsl:variable name="odd-prime" select="$odd intersect $prime"/>
  <xsl:variable name="odd-and-prime" select="$odd union $prime"/>

  <xsl:template match="/">
    <xsl:text>The value of the number elements from 1 to 10: </xsl:text>
    <xsl:value-of select="$one-to-ten" separator=", "/>
    <xsl:text>&#10;</xsl:text>

    <xsl:text>The even numbers: </xsl:text>
    <xsl:value-of select="$even" separator=", "/>
    <xsl:text>&#10;</xsl:text>

    <xsl:text>The odd numbers: </xsl:text>
    <xsl:value-of select="$odd" separator=", "/>
    <xsl:text>&#10;</xsl:text>

    <xsl:text>The prime numbers: </xsl:text>
    <xsl:value-of select="$prime" separator=", "/>
    <xsl:text>&#10;</xsl:text>

    <xsl:text>The odd prime numbers: </xsl:text>
    <xsl:value-of select="$odd-prime" separator=", "/>
    <xsl:text>&#10;</xsl:text>

    <xsl:text>The odd-and-prime numbers: </xsl:text>
    <xsl:value-of select="$odd-and-prime" separator=", "/>
    <xsl:text>&#10;</xsl:text>
  </xsl:template>

</xsl:stylesheet>