Index: src/org/openstreetmap/josm/gui/mappaint/mapcss/Functions.java
===================================================================
--- src/org/openstreetmap/josm/gui/mappaint/mapcss/Functions.java	(revision 15262)
+++ src/org/openstreetmap/josm/gui/mappaint/mapcss/Functions.java	(working copy)
@@ -494,6 +494,16 @@
     }

     /**
+     * Sort an array of strings
+     * @param sortables The array to sort
+     * @return The sorted array
+     */
+    public static List<String> sort(String... sortables) {
+        Arrays.parallelSort(sortables);
+        return Arrays.asList(sortables);
+    }
+
+    /**
      * Returns the role of current object in parent relation, or role of child if current object is a relation.
      * @param env the environment
      * @return role of current object in parent relation, or role of child if current object is a relation

Index: test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTest.java
===================================================================
--- test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTest.java	(revision 15262)
+++ test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTest.java	(working copy)
@@ -9,8 +9,10 @@

 import java.awt.Color;
 import java.io.StringReader;
+import java.util.Arrays;
 import java.util.List;

 import org.junit.Rule;
@@ -407,6 +409,21 @@
     }

     @Test
+    public void testSort() throws Exception {
+        assertEquals(Arrays.asList(new String[] {"alpha", "beta"}), Functions.sort("beta", "alpha"));
+        Way way1 = TestUtils.newWay("highway=residential name=Alpha alt_name=Beta", new Node(new LatLon(0.001, 0.001)),
+                new Node(new LatLon(0.002, 0.002)));
+
+        MapCSSStyleSource source = new MapCSSStyleSource("way[highway] {sorted: join_list(\",\", sort(tag(\"alt_name\"), tag(\"name\")));}");
+        source.loadStyleSource();
+        assertEquals(1, source.rules.size());
+        Environment e = new Environment(way1, new MultiCascade(), Environment.DEFAULT_LAYER, null);
+        assertTrue(source.rules.get(0).selector.matches(e));
+        source.rules.get(0).declaration.execute(e);
+        assertEquals(Functions.join(",", "Alpha", "Beta"), e.getCascade(Environment.DEFAULT_LAYER).get("sorted", null, String.class));
+    }
+
+    @Test
     public void testCountRoles() throws Exception {
         DataSet ds = new DataSet();
         Way way1 = TestUtils.newWay("highway=residential name=1",
