Wikipedia has several languages listed as declarative languages. One of these languages listed is XSLT, which is a language for applying transformations to XML.
As I understand it though, imperative languages say HOW to do something, while declarative languages only say WHAT to do and leave it up to the eg. compiler to figure out the imperative details.
In this light, since when writing XSLT we still say "Do transform A, then do transform B", it seems like we are still writing imperative code.
Furthermore, taking a language like C++ which is arguably imperative, it actually seems semi declarative because the optimizer can re-order instructions or, change algorithms.
In fact, a switch statement seems to be a declarative associative structure, with containing values known at compile time, letting the optimizer make the imperative details based on the type of data it stores. It can do binary searching, jump tables, if/else if chains and more. http://www.codeproject.com/Articles/100473/Something-You-May-Not-Know-About-the-Switch-Statem
This leads to my question...
Is it possible to have a purely declarative language? If so, what would it look like, and could an interpreter/compiler actually be made to convert anything into imperative machine code, beyond a no-op?
It also seems impossible to have a purely imperative language in modern days, as the CPU can do instruction re-ordering, speculative branch predictions, and similar, making your instructions more of hints as to what to do, as opposed to exact instructions of what to do.
Or am I completely off base here?