Я пытаюсь сортировать по тексту, первый текст должен быть в верхнем регистре, тогда как другие начинаются с заглавных букв или маленькой буквы. Ввод XML
<?xml version="1.0" encoding="UTF-8"?>
<root>
<p content-type="emCase"><named-content content-type="emEntry">B</named-content></p>
<p content-type="emCase"><named-content content-type="emEntry">BTS, USA, Inc. v Executive Perspectives, LLC (Conn. Super, Oct. 16, 2014, No. X10CV116010685) 2014 Conn Super Lexis 2644, aff’d (Conn App 2016) 142 A3d 342:</named-content></p>
<p content-type="emCase"><named-content content-type="emEntry">buySAFE, Inc. v Google, Inc. (Fed Cir 2014) 765 F3d 1350:</named-content></p>
<p content-type="emCase"><named-content content-type="emEntry">Babcock v Butler County (3d Cir 2015) 806 F3d 153:</named-content></p>
<p content-type="emCase"><named-content content-type="emEntry">Buxbom v Smith (1944) 23 C2d 535:</named-content></p>
<p content-type="emCase"><named-content content-type="emEntry">Byrd v Roadway Express, Inc. (5th Cir 1982) 687 F2d 85:</named-content></p>
<p content-type="emCase"><named-content content-type="emEntry">B.K.B. v Maui Police Dep’t (9th Cir 2002) 276 F3d 1091:</named-content></p>
</root>
Ожидаемый вывод
<root>
<p content-type="emCase"><named-content content-type="emEntry">B</named-content></p>
<p content-type="emCase"><named-content content-type="emEntry">B.K.B. v Maui Police Dep’t (9th Cir 2002) 276 F3d 1091:</named-content></p>
<p content-type="emCase"><named-content content-type="emEntry">BTS, USA, Inc. v Executive Perspectives, LLC (Conn. Super, Oct. 16, 2014, No. X10CV116010685) 2014 Conn Super Lexis 2644, aff’d (Conn App 2016) 142 A3d 342:</named-content></p>
<p content-type="emCase"><named-content content-type="emEntry">Babcock v Butler County (3d Cir 2015) 806 F3d 153:</named-content></p>
<p content-type="emCase"><named-content content-type="emEntry">Buxbom v Smith (1944) 23 C2d 535:</named-content></p>
<p content-type="emCase"><named-content content-type="emEntry">buySAFE, Inc. v Google, Inc. (Fed Cir 2014) 765 F3d 1350:</named-content></p>
<p content-type="emCase"><named-content content-type="emEntry">Byrd v Roadway Express, Inc. (5th Cir 1982) 687 F2d 85:</named-content></p>
</root>
Мой XSLT-код
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="root">
<xsl:copy>
<xsl:for-each select="p[named-content[@content-type='emEntry'][matches(., '^([A-Za-z]+)')]]">
<xsl:sort select="if(named-content[@content-type='emEntry' and matches(., '^([A-Z]+)')]) then named-content[@content-type='emEntry' and matches(., '^([A-Z]+)')] else upper-case(named-content[@content-type='emEntry'])" data-type="text" order="ascending"/>
<xsl:text>
</xsl:text>
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:for-each>
</xsl:copy>
</xsl:template>
Может ли кто-нибудь помочь мне, где мой неправильный код?