かなり簡単な解決策があるはずですが、うまくいきません。
これは私のコードです:
<xsl:value-of select="$currentPage/ancestor-or-self::* [@isDoc and backgroundImage != '' and string(umbracoNaviHide) != '1']/backgroundImage"/>
私が望むのは、プロパティ backgroundImage によってノードに背景画像が添付されている場合、その画像を使用することです。背景画像がない場合は、背景画像の親ノードを確認し、それを使用します。
ノード自体に背景画像がある場合でも、親の背景画像を常にチェックします。
これを解決する方法について何か提案はありますか?
アップデート
<site id="1000" ...>
<backgroundImage>/media/image.jpg</backgroundImage>
<textPage id="1001" ...>
<backgroundImage>/media/image2.jpg</backgroundImage>
</textPage>
<textPage id="1002" ...>
<backgroundImage />
</textPage>
</site>
backgroundImage が nullの場所にいる場合<textPage id="1002">
、から image.jpg を取得したいと思います<site id="1000">
。
backgroundImage が null でない場所にいる場合は<textPage id="1001">
、image2.jpg を取得したいと思います。