Это преобразование XSLT 1.0 :
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:variable name="vAlha" select=
"' ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/*">
<forms>
<xsl:apply-templates select="*[floor(@form_name) = floor(@form_name)]">
<xsl:sort data-type="number"/>
</xsl:apply-templates>
<xsl:apply-templates select=
"*[substring-before(@form_name,' ')
and
translate(substring-before(@form_name,' '),
' 0123456789',
'')
=
''
]">
<xsl:sort select="substring-before(@form_name,' ')" data-type="number"/>
<xsl:sort select="substring-after(@form_name,' ')"/>
</xsl:apply-templates>
<xsl:apply-templates select=
"*[translate(@form_name,$vAlha,'')
=
''
]">
<xsl:sort select="@form_name"/>
</xsl:apply-templates>
<xsl:apply-templates select=
"*[contains($vAlha,substring(@form_name,1,1))
and
not(translate(@form_name, $vAlha, '') = '')
]">
<xsl:sort select="translate(@form_name, ' 0123456789', '')"/>
<xsl:sort select="translate(@form_name, $vAlha, '')" data-type="number"/>
</xsl:apply-templates>
</forms>
</xsl:template>
</xsl:stylesheet>
при применении к предоставленному XML-файлу :
<forms>
<FORM lob="BO" form_name="AI OM 10"/>
<FORM lob="BO" form_name="CL BP 03 01"/>
<FORM lob="BO" form_name="AI OM 107"/>
<FORM lob="BO" form_name="CL BP 00 02"/>
<FORM lob="BO" form_name="123 DDE"/>
<FORM lob="BO" form_name="CL BP 00 02"/>
<FORM lob="BO" form_name="AI OM 98"/>
<FORM lob="BO" form_name="543 ZZE"/>
<FORM lob="BO" form_name="543 ABC"/>
<FORM lob="BO" form_name="256"/>
<FORM lob="BO" form_name="ABC"/>
</forms>
производитжелаемый результат :
<forms>
<FORM lob="BO" form_name="256"></FORM>
<FORM lob="BO" form_name="123 DDE"></FORM>
<FORM lob="BO" form_name="543 ABC"></FORM>
<FORM lob="BO" form_name="543 ZZE"></FORM>
<FORM lob="BO" form_name="ABC"></FORM>
<FORM lob="BO" form_name="AI OM 10"></FORM>
<FORM lob="BO" form_name="AI OM 98"></FORM>
<FORM lob="BO" form_name="AI OM 107"></FORM>
<FORM lob="BO" form_name="CL BP 00 02"></FORM>
<FORM lob="BO" form_name="CL BP 00 02"></FORM>
<FORM lob="BO" form_name="CL BP 03 01"></FORM>
</forms>