

<generator name='eBay Auction Item' xmlns='http://www.mozilla.org/microsummaries/0.1'>

  <pages>
    <include>^http://cgi\.ebay\.com/.*QQitemZ.*QQcmdZViewItem</include>
    <include>^http://cgi\.ebay\.com/ws/eBayISAPI\.dll\?ViewItem&amp;.*item=</include>
  </pages>

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

        <!-- The name of the item.
           -
           - To conserve space, we only show the first seven characters.
           - Note that we call normalize-space twice.  The inner one strips
           - leading whitespace before we truncate the string so it doesn't
           - count in the seven characters.  The outer one strips trailing
           - whitespace after we truncate the string, to prevent there being
           - a space between the name and the succeeding colon on the off
           - chance the seventh character is a space.
           -->
        <value-of select='normalize-space(substring(normalize-space(/html/body/span[1]/table[1]//tr/td/table[2]//tr[2]/td[4]/h1), 1, 7))'/>
        <text>: </text>

        <!-- The current bid.
           -
           - The current bid is sometimes succeeded by a non-breaking space
           - (&#160;).  Unfortunately, due to Mozilla bug 342273, microsummaries
           - with non-breaking spaces cannot be selected in a drop-down menu
           - like the one for selecting a live title in the bookmark dialogs,
           - so we have to translate non-breaking spaces into regular spaces.
           -->
        <value-of select='normalize-space(translate(id(&apos;DetailsCurrentBidValue&apos;), &apos;&amp;#160;&apos;, &apos; &apos;))'/>
        <text>, </text>

        <!-- The time remaining in the auction.
           -
           - eBay puts this inside different descendants of the tag with the ID
           - 'DetailsTimeLeft' depending on whether the auction is ending
           - within the day or more than a day away, so we find it by looking
           - for the content containing one or more of the strings "day",
           - "hour", "min", and "sec".
           -
           - As with the current bid, we translate non-breaking spaces into
           - regular spaces, but we also strip parentheses, which enclose
           - the time remaining for auctions ending more than a day away.
           -
           - For auctions that have already ended, we just display "ended".
           -->
        <variable name='time' select='normalize-space(translate(id(&apos;DetailsTimeLeft&apos;)/*[contains(., &apos;day&apos;) or contains(.,&apos;hour&apos;) or contains(.,&apos;min&apos;) or contains(.,&apos;sec&apos;)], &apos;&amp;#160;()&apos;, &apos; &apos;))'/>
        <variable name='ended' select='id(&apos;FastVIPDetails&apos;)/table//tr[td=&apos;Ended:&apos;]'/>
        <choose>
          <when test='$ended != &apos;&apos;'>
            <text>ended</text>
          </when>
          <otherwise>
            <value-of select='$time'/>
          </otherwise>
        </choose>

      </template>
    </transform>
  </template>

</generator>
