The technical term for this construction is Pied-Piping.
(I don't make up these names, honest; this one, like many others, is due to Haj Ross)
Here's how it works:
Relative clauses modify nouns; these nouns are called antecedents (because they "go before").
Every relative clause contains an anaphor of its antecedent, which becomes a relative pronoun,
and, under certain circumstances, may simply be deleted.
- [
the man
[the man
came to dinner]] --> [the man
[who/that
came to dinner]]
- [
the man
[I saw the man
]] --> [the man
[who/that
I saw]] --> [the man
[I saw]]
In the first example above, the relative pronoun is the subject and may not be deleted.
In the second example, the relative pronoun is the direct object and may be deleted.
That accounts for the majority of relative clauses.
However, subject and object do not exhaust the roles or positions of nouns.
Other roles are called Oblique, as a class, and include objects of prepositions, of all sorts.
In the following examples, I'll leave out the who/that
version, which is always possible,
- [
the man
[I looked at the man
]] --> [the man
[who/that
I looked at]]
because oblique relative pronouns are always deletable.
(Note that these all end up stranding a preposition at the end, just like the one above does):
- [
the man
[I looked at the man
]] --> [the man
[I looked at]]
- [
the man
[I talked to the man
]] --> [the man
[I talked to]]
- [
the man
[I came with the man
]] --> [the man
[I came with]]
- [
the room
[I live in the room
]] --> [the room
[I live in]]
In effect, moving or deleting the relative pronoun breaks up the prepositional phrase.
However, prepositional phrases are constituents, and may optionally be moved as one unit:
- [
the man
[I looked [at the man
]]] --> [the man
[[at whom
] I looked]]
- [
the room
[I live [in the room
]]] --> [the room
[[in which
] I live]]
This process, of moving the whole prepositional phrase instead of only its object,
is what Pied-Piping means. The preposition gets piped away to the front, marking its object.
Moreover, prepositional phrases can modify nouns that are objects of other prepositional phrases,
and they, too, are constituents, and can be moved as a unit. So are, and so can, the noun phrases. Again, only optionally. Which leads to such mind-numbing spectra of nonrestrictive relatives as:
- The government prescribes the height of the lettering on the covers of the reports.
- the reports, which the government prescribes the height of the lettering on the covers of
- the reports, of which the government prescribes the height of the lettering on the covers
- the reports, the covers of which the government prescribes the height of the lettering on
- the reports, on the covers of which the government prescribes the height of the lettering
- the reports, the lettering on the covers of which the government prescribes the height of
- the reports, of the lettering on the covers of which the government prescribes the height
- the reports, the height of the lettering on the covers of which the government prescribes
This kind of syntax seems especially common in pedantic, bureaucratic, or legal contexts.
Opinions vary as to the grammaticality of various portions of the spectrum; pied-piping seems
to be a syntactic habit one picks up, if at all, later in one's education, and individually. I.e, YMMV.