XSLT 変数に値を再割り当てできない、または
<xsl:for-each
条件付き
で XMLを終了できますか
<R>
<A id="a">
<S id="a111">1</S>
<S id="a222">2</S>
<S id="a333">3
<S id="a3331">3.1</S>
<S id="a3332">3.2</S>
<S id="a3333">3.3</S>
</S>
<S id="a444">4</S>
<S id="a555">5</S>
<S id="a666">6</S>
</A>
<A id="x">
<S id="x111">1</S>
<S id="x222">2</S>
<S id="x333">3
<S id="x3331">3.1</S>
<S id="x3332">3.2</S>
<S id="x3333">3.3</S>
</S>
<S id="x444">4</S>
<S id="x555">5</S>
<S id="x666">6</S>
</A>
</R>
私のXSLT
<select id ="S" name="SList">
<option>
<xsl:attribute name="value"></xsl:attribute> Please Select S
</option>
<xsl:for-each select="A[id='x']//S">
<xsl:if test="'x3333'= @id">
<xsl:variable name="currentS" select="true()"/>
</xsl:if>
<xsl:if test="'x3333'!= @id">
<xsl:variable name="currentS" select="false()"/>
</xsl:if>
<xsl:if test="@currentS = false()">
<option>
<xsl:if test="@id = 'x3333'">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:attribute name="value">
<xsl:value-of select="@id"/>
</xsl:attribute>
<xsl:value-of select="Text"/>
</option>
</xsl:if>
</xsl:for-each>
ドロップダウン リストを作成しようとしていますS
が、リストに項目を含める必要があります。S
現在の位置 (この例ではx3333
current ) と の現在の ID を渡していA
ます。S
最新の要素内の要素のリストのみを取得したいA
。
この例では、私の currentS
はx3333
で id はA
isであるため、リストx
に含める必要があるのはx111
, x222
, x333
,だけです。つまり、これらを排除する必要がありますx3331
x3332
<S id="x444">4</S>,
<S id="x555">5</S>,
<S id="x666">6</S>, nodes
このコードから<xsl:for-each select="A[id='x']//S">
どこでS
要素のリストを取得していますA
id='x'
誰かが私に解決策を提案できますか?