ここでは、xml全体を検索する単一のループを実行しようとしています。さまざまな条件に応じて、さまざまな変数がさまざまな値を取得します。後で参照できるようにします。
サンプルコード:
<xsl:for-each select='root'>
<xsl:choose>
<xsl:when test='first'>
<xsl:variable name='first' select='root/first' />
</xsl:when>
<xsl:when test='second'>
<xsl:variable name='namew' select='root/second' />
</xsl:when>
<xsl:otherwise>
<xsl:variable name='other'>unknown</xsl:variable>
</xsl:otherwise>
</xsl:choose>
私はそれがここでは機能しないことを知っています、そして私は理由(変数のスコープと変数の一定の振る舞い)も知っています、実際に私はこの問題の代替解決策を知りたいです。