I spent a good few hours searching the internet for ways to customise the XSL in SharePoint for a custom content query webpart and could find nothing on changing the outer html of the code so it was unique.
So figuring it out I found the only way is edit the ContentQueryMain.xsl within the style library. While this is easy to changing it will render all webparts using the file to have the same classes.
To get around this you have to copy the file ,rename it and then make the changes.
the next step is to export a content query web part and change the link to the main xml link
Then you’ll need to save and upload the web part and then it’s ready to use.