私は階層をいくつかの汚い押し出された組版 XML に追加しようとしています。同じ親要素で複数の種類のグループを一度にグループ化することはできないようです。
私が持っているもの(単純化、明らかに):
<article>
<h1>A section title here</h1>
<p>A paragraph.</p>
<p>Another paragraph.</p>
<bl>Bulleted list item.</bl>
<bl>Another bulleted list item.</bl>
<h1>Another section title</h1>
<p>Yet another paragraph.</p>
</article>
私が欲しいもの:
<article>
<sec>
<h1>A section title here</h1>
<p>A paragraph.</p>
<p>Another paragraph.</p>
<list>
<list-item>Bulleted list item.</list-item>
<list-item>Another bulleted list item.</list-item>
</list>
</sec>
<sec>
<h1>Another section title</h1>
<p>Yet another paragraph.</p>
</sec>
</article>
これは、リスト項目に対してほぼ機能します。
<xsl:for-each-group select="*" group-adjacent="boolean(self::BL)">
<xsl:choose>
<xsl:when test="current-grouping-key()">
<list><xsl:apply-templates select="current-group()"/></list>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="current-group()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each-group>
ただし、記事の最初のリストのみを処理します。セクションをカバーするために別の xsl:for-each-group を追加しようとするとすぐに、リスト項目の 1 つが機能しなくなります。
アイデア?よろしくお願いします!