Возможна ли сортировка текста на основе следующего брата, когда он получает то же значение атрибута, и не сортировки текста, если он приходит start-with text Generally
. Текст начинается только с одного слова и начинается с Word и Di git Пример S corporation, Co-sale, five504, seven7(a).
В этом XML Три типа значения атрибута Входной файл
<document>
<p specific-use="Main">Accounts and Accounting</p>
<p specific-use="Sub1">Regulation A offerings, accounting fees for, <xref ref-type="other" rid="none">19.9</xref></p>
<p specific-use="Sub1">S corporation, accounting closing provision in buy-sell agreement, <xref ref-type="other" rid="none">3.53ƒ</xref></p>
<p specific-use="Sub1">Sarbanes-Oxley Act of 2002, public accounting firms' required registration with Public Company Accounting Oversight Board (PCAOB) under, <xref ref-type="other" rid="none">17.5</xref>, <xref ref-type="other" rid="none">18.9</xref>, <xref ref-type="other" rid="none">20.13</xref></p>
<p specific-use="Sub1">Stock dividends <emphasis type="roman">versus</emphasis> stock splits, accounting treatment of, <xref ref-type="other" rid="none">18.30</xref></p>
<p specific-use="Main">Agreements</p>
<p specific-use="seeAlso"><emphasis type="roman">See also</emphasis> <emphasis type="bold">Contracts</emphasis></p>
<p specific-use="Sub1">Buy-sell agreements. <emphasis type="roman">See</emphasis> <emphasis type="bold">Buy-Sell Agreement</emphasis></p>
<p specific-use="Sub1">Co-sale agreement. <emphasis type="roman">See</emphasis> <emphasis type="bold">Right of First Refusal and Co-Sale Agreement</emphasis></p>
<p specific-use="Sub1">Confidentiality agreements. <emphasis type="roman">See</emphasis> <emphasis type="bold">Confidentiality</emphasis></p>
<p specific-use="Sub1">Founders, agreements between. <emphasis type="roman">See</emphasis> <emphasis type="bold">Founder of New Business Entity</emphasis></p>
<p specific-use="Sub1">Investment agreement. <emphasis type="roman">See</emphasis> <emphasis type="bold">Investment Agreement</emphasis></p>
<p specific-use="Main">CAN-SPAM Act</p>
<p specific-use="Sub1">Generally, <xref ref-type="other" rid="none">13.24</xref></p>
<p specific-use="Main">Capital</p>
<p specific-use="seeAlso"><emphasis type="roman">See also</emphasis> <emphasis type="bold">Venture Capital</emphasis></p>
<p specific-use="Sub1">Generally, <xref ref-type="other" rid="none">1.1</xref></p>
<p specific-use="Sub1">Attorney's role in obtaining capital</p>
<p specific-use="Sub2">Generally, <xref ref-type="other" rid="none">1.1</xref></p>
<p specific-use="Sub2">Appropriate sources of capital, identification of, <xref ref-type="other" rid="none">1.6</xref></p>
<p specific-use="Sub2">Business plan, preparation of, <xref ref-type="other" rid="none">1.5</xref></p>
<p specific-use="Sub1">Small Business Administration (SBA)</p>
<p specific-use="Sub2">Generally, <xref ref-type="other" rid="none">1.11</xref></p>
<p specific-use="Sub2">five504 loan program, <xref ref-type="other" rid="none">1.11</xref>, <xref ref-type="other" rid="none">1.11C</xref></p>
<p specific-use="Sub2">seven7(a) loan program, <xref ref-type="other" rid="none">1.11</xref>, <xref ref-type="other" rid="none">1.11B</xref></p>
<p specific-use="Sub2">Direct loans by SBA, <xref ref-type="other" rid="none">1.12</xref></p>
<p specific-use="Sub2">Guaranty of loan by SBA, <xref ref-type="other" rid="none">1.11</xref>, <xref ref-type="other" rid="none">1.13</xref></p>
<p specific-use="Sub2">Maximum maturity for loan, <xref ref-type="other" rid="none">1.11B</xref></p>
<p specific-use="Sub2">Specialized SBA loan programs, <xref ref-type="other" rid="none">1.11E</xref></p>
<p specific-use="Sub1">Sources of capital</p>
<p specific-use="Main">Buy-Sell Agreement</p>
<p specific-use="Sub1">Generally, <xref ref-type="other" rid="none">3.13</xref>, <xref ref-type="other" rid="none">4.28</xref></p>
<p specific-use="Sub1">Redemption format, <xref ref-type="other" rid="none">3.19</xref></p>
<p specific-use="Sub1">S corporations. <emphasis type="roman">See</emphasis> <emphasis type="bold">S Corporations</emphasis></p>
<p specific-use="Sub1">Shareholder buy-sell agreement</p>
</document>
Ожидаемый вывод
<document>
<p specific-use="Main">Accounts and Accounting</p>
<p specific-use="Sub1">Regulation A offerings, accounting fees for, <xref ref-type="other" rid="none">19.9</xref></p>
<p specific-use="Sub1">Sarbanes-Oxley Act of 2002, public accounting firms' required registration with Public Company Accounting Oversight Board (PCAOB) under, <xref ref-type="other" rid="none">17.5</xref>, <xref ref-type="other" rid="none">18.9</xref>, <xref ref-type="other" rid="none">20.13</xref></p>
<p specific-use="Sub1">S corporation, accounting closing provision in buy-sell agreement, <xref ref-type="other" rid="none">3.53ƒ</xref></p>
<p specific-use="Sub1">Stock dividends <emphasis type="roman">versus</emphasis> stock splits, accounting treatment of, <xref ref-type="other" rid="none">18.30</xref></p>
<p specific-use="Main">Agreements</p>
<p specific-use="seeAlso"><emphasis type="roman">See also</emphasis> <emphasis type="bold">Contracts</emphasis></p>
<p specific-use="Sub1">Buy-sell agreements. <emphasis type="roman">See</emphasis> <emphasis type="bold">Buy-Sell Agreement</emphasis></p>
<p specific-use="Sub1">Confidentiality agreements. <emphasis type="roman">See</emphasis> <emphasis type="bold">Confidentiality</emphasis></p>
<p specific-use="Sub1">Co-sale agreement. <emphasis type="roman">See</emphasis> <emphasis type="bold">Right of First Refusal and Co-Sale Agreement</emphasis></p>
<p specific-use="Sub1">Founders, agreements between. <emphasis type="roman">See</emphasis> <emphasis type="bold">Founder of New Business Entity</emphasis></p>
<p specific-use="Sub1">Investment agreement. <emphasis type="roman">See</emphasis> <emphasis type="bold">Investment Agreement</emphasis></p>
<p specific-use="Main">CAN-SPAM Act</p>
<p specific-use="Sub1">Generally, <xref ref-type="other" rid="none">13.24</xref></p>
<p specific-use="Main">Capital</p>
<p specific-use="seeAlso"><emphasis type="roman">See also</emphasis> <emphasis type="bold">Venture Capital</emphasis></p>
<p specific-use="Sub1">Generally, <xref ref-type="other" rid="none">1.1</xref></p>
<p specific-use="Sub1">Attorney's role in obtaining capital</p>
<p specific-use="Sub2">Generally, <xref ref-type="other" rid="none">1.1</xref></p>
<p specific-use="Sub2">Appropriate sources of capital, identification of, <xref ref-type="other" rid="none">1.6</xref></p>
<p specific-use="Sub2">Business plan, preparation of, <xref ref-type="other" rid="none">1.5</xref></p>
<p specific-use="Sub1">Small Business Administration (SBA)</p>
<p specific-use="Sub2">Generally, <xref ref-type="other" rid="none">1.11</xref></p>
<p specific-use="Sub2">Direct loans by SBA, <xref ref-type="other" rid="none">1.12</xref></p>
<p specific-use="Sub2">five504 loan program, <xref ref-type="other" rid="none">1.11</xref>, <xref ref-type="other" rid="none">1.11C</xref></p>
<p specific-use="Sub2">Guaranty of loan by SBA, <xref ref-type="other" rid="none">1.11</xref>, <xref ref-type="other" rid="none">1.13</xref></p>
<p specific-use="Sub2">Maximum maturity for loan, <xref ref-type="other" rid="none">1.11B</xref></p>
<p specific-use="Sub2">seven7(a) loan program, <xref ref-type="other" rid="none">1.11</xref>, <xref ref-type="other" rid="none">1.11B</xref></p>
<p specific-use="Sub2">Specialized SBA loan programs, <xref ref-type="other" rid="none">1.11E</xref></p>
<p specific-use="Sub1">Sources of capital</p>
<p specific-use="Main">Buy-Sell Agreement</p>
<p specific-use="Sub1">Generally, <xref ref-type="other" rid="none">3.13</xref>, <xref ref-type="other" rid="none">4.28</xref></p>
<p specific-use="Sub1">Redemption format, <xref ref-type="other" rid="none">3.19</xref></p>
<p specific-use="Sub1">S corporations. <emphasis type="roman">See</emphasis> <emphasis type="bold">S Corporations</emphasis></p>
<p specific-use="Sub1">Shareholder buy-sell agreement</p>
</document>
Не уверен, Как отсортировать текст по условию? Сортировка текста только начало одного слова и начало Word и Di git Пример S corporation, Co-sale, five504, seven7(a).
Помеченное изображение