the xml
<publication_date media_type="print">
<month>1</month>
<year>2011</year>
</publication_date>
I have used this code to get title
var year = $xml.find('publication_date year').text();
but sometimes the xml contains two different types like this:
<publication_date media_type="print">
<month>05</month>
<day>22</day>
<year>2012</year>
</publication_date>
<publication_date media_type="online">
<month>04</month>
<day>26</day>
<year>2012</year>
</publication_date>
I want to select the year witch comes with online media-type and if there is no online select print type.