Adding a repository is never more than appending to a list... the only problem is how you build what you want to add. Approach suggested by @stdweird and you is working fine as long the URL for both OS version is basically the same except one part. The template approach allows more flexibility as the URL can be completely different even though the template name is similar...
BTW, we can reconcile both approaches as it would not be a problem to add both epel and slx_epel to the repo list as the function add_repository() ignore any non existent repository templates. This has been done on purpose to allow a site to use its own repo templates without editing the standard configuration.