xsl-list
[Top] [All Lists]

[xsl] Thorny select: getting surrounding years

2010-10-21 15:12:59
I've been wresting with this, and my brain is melting. I need to get a
list of the surrounding years for an item -- zero to two years before,
the item itself, zero to two years after. There may be gaps in the
sequence, in which case I still need two items before and after (if
available).

Sample xml:

<root>
   <item>
      <id>12345</id>
      <year>2005</year>
   </item>
   <otherYears>
     <item>
        <id>56789</id>
        <year>2001<year>
     </item>
     <item>
        <id>67890</id>
        <year>2002<year>
     </item>
     <item>
        <id>78901</id>
        <year>2003<year>
     </item>
     <item>
        <id>12345</id>
        <year>2005<year>
     </item>
     <item>
        <id>89012</id>
        <year>2006<year>
     </item>
     <item>
        <id>90123</id>
        <year>2008<year>
     </item>
   </otherYears>
</root>

Desired output (or similar, the select is the hard part):

2002 = 67890
2003 = 78901
2005 = 12345
2006 = 89012
2008 = 90123

Many thanks!
-Brooks

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>