An Islamic court in Aceh province has handed a public caning sentence to two men for having sex together.