diff --git a/MANIFEST b/MANIFEST
index 6772fa20cb..589cb52911 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1317,6 +1317,10 @@
./tools/testfiles/tempty-nons-2.h5.xml
./tools/testfiles/tempty-ns-2.h5.xml
./tools/testfiles/tall-2A.h5.xml
+./tools/testfiles/torderattr4.h5.xml
+./tools/testfiles/torderattr2.h5.xml
+./tools/testfiles/torderattr3.h5.xml
+./tools/testfiles/torderattr1.h5.xml
diff --git a/tools/h5dump/testh5dumpxml.sh.in b/tools/h5dump/testh5dumpxml.sh.in
index 42d0a8eb5b..3e81a056d7 100755
--- a/tools/h5dump/testh5dumpxml.sh.in
+++ b/tools/h5dump/testh5dumpxml.sh.in
@@ -178,6 +178,15 @@ TOOLTEST tempty-dtd-uri.h5.xml --xml --use-dtd --xml-dtd="http://somewhere.net"
TOOLTEST tall-2A.h5.xml --xml -A tall.h5
+# tests for attribute order
+TOOLTEST torderattr1.h5.xml --xml -H --sort_by=name --sort_order=ascending torderattr.h5
+TOOLTEST torderattr2.h5.xml --xml -H --sort_by=name --sort_order=descending torderattr.h5
+TOOLTEST torderattr3.h5.xml --xml -H --sort_by=creation_order --sort_order=ascending torderattr.h5
+TOOLTEST torderattr4.h5.xml --xml -H --sort_by=creation_order --sort_order=descending torderattr.h5
+
+
+
+
if test $nerrors -eq 0 ; then
echo "All $DUMPER tests passed."
fi
diff --git a/tools/testfiles/torderattr1.h5.xml b/tools/testfiles/torderattr1.h5.xml
new file mode 100644
index 0000000000..7ee2f109f6
--- /dev/null
+++ b/tools/testfiles/torderattr1.h5.xml
@@ -0,0 +1,155 @@
+#############################
+Expected output for 'h5dump --xml -H --sort_by=name --sort_order=ascending torderattr.h5'
+#############################
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tools/testfiles/torderattr2.h5.xml b/tools/testfiles/torderattr2.h5.xml
new file mode 100644
index 0000000000..9f5d216844
--- /dev/null
+++ b/tools/testfiles/torderattr2.h5.xml
@@ -0,0 +1,155 @@
+#############################
+Expected output for 'h5dump --xml -H --sort_by=name --sort_order=descending torderattr.h5'
+#############################
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tools/testfiles/torderattr3.h5.xml b/tools/testfiles/torderattr3.h5.xml
new file mode 100644
index 0000000000..6659d1b3a8
--- /dev/null
+++ b/tools/testfiles/torderattr3.h5.xml
@@ -0,0 +1,155 @@
+#############################
+Expected output for 'h5dump --xml -H --sort_by=creation_order --sort_order=ascending torderattr.h5'
+#############################
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tools/testfiles/torderattr4.h5.xml b/tools/testfiles/torderattr4.h5.xml
new file mode 100644
index 0000000000..82e57e0bbf
--- /dev/null
+++ b/tools/testfiles/torderattr4.h5.xml
@@ -0,0 +1,155 @@
+#############################
+Expected output for 'h5dump --xml -H --sort_by=creation_order --sort_order=descending torderattr.h5'
+#############################
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+