0
我是很新的XSLTXSLT嵌套条件 - 如何做到这一点
我有以下XSLT片段(pseudo'ed为清楚起见):
<xsl:for-each select="fields/field">
<xsl:if test="field=someThing">
<div>
<!--some content output-->
<!--here by doing-->
<!--some complex stuff-->
</div>
</xsl:if>
</xsl:for-each>
但根据从现场的价值循环,我可以选择在结束div之前做一些其他的事情。
所以(手持闪亮的新XSL的书)我想我可以做这样的事情:
<xsl:for-each select="fields/field">
<xsl:if test="field=someThing">
<div>
<!--some content output-->
<!--here by doing-->
<!--some complex stuff-->
<xsl:choose>
<xsl:when test="field=someThingSpecific">
<div>
<!--process some additional-->
<!--stuff here-->
</div>
<!--then close div-->
</div>
</xsl:when>
<xsl:otherwise>
<!--nothing to do here-->
<!--just close the div-->
</div>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:for-each>
但它炸毁。
显然是因为结束div已经进入有条件的xsl:选择阻止
所以2个问题真的:
为什么犯规它当作是工作的?
我该如何实现我的目标?
啊,我刚睡醒了“durrhhh时刻”。谢谢澄清 – bule 2012-08-06 07:10:50