有时需要根据情况显示数据,xsl中可以使用if来做判断:
<xsl:for-each select="ROOT/ALOOP/FRPARA1/LOOP/FPARA1"> <xsl:if test="MCRECORD[position() =2]/ILOOP/MC/TR/TD/MCCONTENT/CONTENT = '名字典故'"> <li> <span class="date"> <a href="{MCRECORD/ILOOP/MC/TR/TD/MCCONTENT/CONTENTLINK}" target="_blank">详情</a> </span> <a href="{MCRECORD/ILOOP/MC/TR/TD/MCCONTENT/CONTENTLINK}" target="_blank"> <xsl:value-of select="substring(MCRECORD/ILOOP/MC/TR/TD/MCCONTENT/LCONTENT,1,30)"/> </a> </li> </xsl:if> </xsl:for-each>