With a slightly modified definition from the answer to "Create rotated prime symbol" (removing the trailing \;) it works.
sidewaystable environments, like table environments, cannot span more than a page. Hence, it's not a good idea to embed a longtable environment in a sidewaystable environment.
Do load the pdflscape package, though, employ its landscape environment, and embed the longtable environment in the landscape environment.
you not provide any code of your table nor information about document layout, so answers can be based only on guessing
as starting I use @Roland answer (+1)
in comparison to @Roland answer in the following MWE the following changes are done:
for table is used is tabularx
added rotated column headers as shown in image
Typing the question out, I have found a solution by looking at the source of pdflscape, based on this answer about setting the rotation attribute with XeLaTeX and the manual of the dvipdfm driver (however I am not sure if this is the correct documentation for \special in XeLaTeX):