How do I prevent duplicate entries into a list, and then ideally, sort that list? What I\'m doing, is when information at one level is missing, taking the information from
A slightly shorter XSLT 2.0 version, combining approaches from other answers. Note that sorting is alphabetical, so that if the labels "54" and "156" are found, the output will be "156, 54". If a numerical sort is needed, use instead of .