sort attributes by it's sort order and name

In case the sort order is 0, sort alphabetically as well