Subject: Re: [docbook-apps] Cannot write xml:lang to content.opf
You are missing the context. 8^)
When that template is applied, the context is already the top-level book element, so the select statement is trying to select /book/book, which does not exist.
Also, you have put @xml:lang in the predicate, but you haven't actually selected its value. Your current select says "apply templates to a book element that has an @xml:lang", which will process the whole <book> if it has the attribute. It's a good thing it didn't work. 8^)
I would suggest the following:
That will select the value of the top-level element's @xml:lang attribute.
If you only want to select if it has such an attribute, then qualify it with a predicate before selecting the attribute: