[0] I can show you how to do that, but before doing that, I do not target the output document in exactly the same as what you propose, in particular, I will not put the genre into the attribute to books (as the same author can write different genre of books). Instead I would show the demo with genre put in the book instead.
[0.1] There are quite a few typo and/or consistency in tagging in the sample. I only take the spirit of it and use a consistently named sample (like date vs published_date).
[0.2] Apart from that, the techniques being used to achieve the result are sufficiently varying so that any change of mind can easily be done by yourself with the techniques as demonstrated.
[1] Here is the xsl document. It is supposed to operate on authors.xml and that the books.xml is in the same directory as authors.xml.
[1.1] I suppose there always exist genre and published_date. In case one or both might be absent, it is easy to add a node
test with xsl:if to filter the cases.