xQuery - Concering Date Decrementation - Yearly



I have been having a problem trying to work out how to display a date decrementing yearly as an xquery. The output I need needs to correspond to a specific .xml file I have. I have my code below which sets the basic format however I cannot understand where I need to place the decrementer in order to set each "Year"



My code is listed below

for $year-pubs in doc("dblp.xml")//year
return <publisher>
<year-pubs>
<year>{$year-pubs/author/text()} </year>
</year-pubs>
</publisher>



The expected output .xml output is:

<publisher>
<year-pubs>
<year>2013</year>
<!-- other 2013 records -->
</year-pubs>
<year-pubs>
<year>2012</year>
<!-- other 2012 records -->
</year-pubs>

No comments:

Post a Comment