Work around a libxslt limitation

Sometimes filter_names.xsl complains with

XSLTApplyError: Attribute nodes must be added before any child nodes to an element

This seems to be a problem in libxslt and hence etree (which is based on
the former). Moving the apply-templates of the attributes before the
first child element seems to fix the problem.