这是我尝试过的,否则总是有效的。如果 type = 'WEEKLY' 我需要它输出“W”
<xsl:for-each select="times/weekly_monthly">
<tr>
<td>
<xsl:choose>
<xsl:when test="type='WEEKLY'">W</xsl:when>
<xsl:otherwise>
otherwise always works
</xsl:otherwise>
</xsl:choose>
</td>
</tr>
</xsl:for-each>
如果我取出选择,它会很好地迭代。这是xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type= "text/xsl" href= "test.xsl"?>
<!-- Edited by XMLSpy® -->
<times>
<weekly_monthly>
<type>
WEEKLY
</type>
</weekly_monthly>
<weekly_monthly>
<type>
MONTHLY
</type>
</weekly_monthly>
<weekly_monthly>
<type>
NULL
</type>
</weekly_monthly>
</times>