変換に問題があり、いくつかのアイデアを期待していました。すべての重要なノードが互いに兄弟である、非常にフラットな入力ドキュメントを扱っています。
これは次のようになります。
<title1> Rule 51 </title1>
<p> text here </p>
<p> text here </p>
<note> Source </note>
<p> text here </p>
<title1> Rule 52 </title1>
<p> text here </p>
<p> text here </p>
<note> Source </note>
<p> text here </p>
私の目標は、この入力が次のようになることです。
<section>
<title1> Rule 51 </title1>
<p> text here </p>
<p> text here </p>
<note> Source </note>
<p> text here </p>
</section>
<section>
<title1> Rule 52 </title1>
<p> text here </p>
<p> text here </p>
<p> text here </p>
<p> text here </p>
<note> Source </note>
<p> text here </p>
</section>
上記のように、私の主な目標は、各title1とそれに続くすべての兄弟を、別のtitle1がセクション要素にヒットするまでグループ化することです。何か案は??
前もって感謝します。