Preheat the oven to 170°C/gas 3½. Bring a large pot of lightly salted water to the boil and cook the cavolo nero for 4 minutes, then remove it from the water and drain in a colander. Add the sweet potato to the water in the pot and cook it for around 5 minutes, to the stage where you can just insert a knife through the flesh. Remove the cavolo nero from the colander and carefully tip the sweet potatoes in. Squeeze out as much excess moisture from the cavolo nero as you can, then roughly chop it.
Make the cheese sauce: bring the milk almost to the boil in a pan. In another pan, around 1.5 litres in capacity, add 5 tablespoons of oil, the flour and bay leaves, and cook over a moderate heat, stirring constantly, until the flour is sizzling. Take the pan off the stove and whisk in the hot milk, then return the pan to the heat and bring to a simmer. Cook for 2 minutes, stirring constantly as the sauce thickens. Take off the heat and stir in two-thirds of the cheese and season. Divide the sauce into two and mix the chopped cavolo nero into one half.
In a wide pan, sauté the onions and garlic in the remaining oil until they caramelize. Add the boiling water and let it bubble, then mix in the herbs and season.
Tip half of the onion mixture into the baking dish and level it out. Place half the pasta sheets on top, breaking them to fit in nicely. Next, add a layer of the plain cheese sauce, followed by a layer of the sweet potatoes. Add another layer of the pasta, followed by the cavolo nero cheese sauce, then the rest of the onions. Bake in the centre of the oven for 50 minutes, then spread the remaining cheese on top and grill until the cheese is golden and bubbly.