<generator name='Microsummary for Lenta.Ru' xmlns='http://www.mozilla.org/microsummaries/0.1'>

  <pages>
    <include>^http://(www\.)?lenta\.ru/$</include>
  </pages>

  <template>
    <transform version='1.0' xmlns='http://www.w3.org/1999/XSL/Transform'>
      <output method='text'/>
      <template match='/'>

        <!-- Зададим переменные:
           - "$mainnews" для «Главной новости за сутки»
           - "$mainstory" для «Сюжета дня»
           - "$hotnews" для «Красной строки»
          /-->

        <!-- В случае отсутствия однозначного id
           - перестрахуемся двумя class`ами.
          /-->

        <variable name='mainnews' select='normalize-space(string(//table[@class=&apos;today&apos;]//div[@class=&apos;m&apos;]))'/>
        <variable name='mainstory' select='normalize-space(string(//td[@id=&apos;mainstory&apos;]/a[2]))'/>

        <!-- В «Красной строке» уберём дату и время,
         - заданные в формате "dd.mm hh:mm".
         - Для этого пропустим первые 12 символов в строке.
        /-->

        <variable name='hotnews' select='substring(normalize-space(string(//table[@class=&apos;top7&apos;]//td[@class=&apos;hot&apos;])), 13)'/>

        <!-- Алгоритм: ищем «Красную строку» либо «Сюжет дня»,
           - в противном случае показываем «Главную новость за сутки».
          /-->

        <choose>
          <when test='not($hotnews)'>
            <choose>
              <when test='not($mainstory)'> <!-- Главная новость за сутки /-->
                <value-of select='$mainnews'/>  
              </when>
              <otherwise> <!-- Сюжет дня /-->
                <text>§ </text>
                <value-of select='$mainstory'/>
              </otherwise>
            </choose>
          </when>
          <otherwise> <!-- Красная строка /-->
            <text>★ </text> <!--  или ☆ /-->
            <value-of select='$hotnews'/>
          </otherwise>
        </choose>
      </template>
    </transform>
  </template>

  <update interval='15'/> <!-- Время обновления в минутах /-->

  <!-- sent bug reports to lohmatii+bug at gmail dot com /-->

</generator>