親/子の依存関係を持つアイテムはほとんどありません:
アイテム1 -> アイテム2 -> アイテム3
「メイン情報」という同じ名前のフィールドがあります。このフィールドが入力されているものもあれば、「メイン情報」が空のものもあります。主な目標: 「主な情報」が選択されているページが選択されている場合 - この情報を表示します。空の「メイン情報」が選択されたページの場合 - 祖先からの情報を表示します。だから私はレンダリングを持っています:
<xsl:variable name="home" select="$sc_currentitem/ancestor-or-self::*[contains(@template, 'page') and @Main Info != '']" />
<!-- entry point -->
<xsl:template match="*">
<xsl:apply-templates select="$home" mode="main"/>
</xsl:template>
<xsl:template match="*" mode="main">
<sc:text field="Right Footer Text" />
</xsl:template>
これは何も示していません。
<xsl:variable name="home" select="$sc_currentitem/ancestor-or-self::*[contains(@template, 'page')]" />
<xsl:template match="*">
<xsl:apply-templates select="$home" mode="main"/>
</xsl:template>
<xsl:template match="*" mode="main">
<sc:text field="Right Footer Text" />
</xsl:template>
これは、選択した項目のすべての先祖からの「主な情報」を示しています。
「主な情報」を 1 つだけ取得するにはどうすればよいですか? このフィールドが空でない場合は選択したアイテムから、または「メイン情報」が入力された最初の親アイテムから。