如果满足我的模板条件并且信息显示在邮件中,我正在尝试编辑使用 XSL 1 格式化的邮件以显示一行。邮件具有当前格式:
People attending:
person1
-someinfo
person2
-someinfo
People not attending:
person3
-someinfo
问题是当没有为未参加的人显示任何内容时,邮件仍将显示“未参加的人:”,因为我目前在运行应用模板之前拥有它。
有没有什么好的方法可以在没有人参加的信息之前显示段落,只有在有人没有参加的情况下?两个模板的原因是在我的原始代码中我检查了 xml 中的更改。
代码:
<p>People not attending</p>
<xsl:apply-templates select="1_type/2_group/1_type_f" mode="pn"/>
<xsl:template match="1_type_f" mode="pn">
<xsl:if test="((1_type_f_v/@old_selected='Selected') and (1_type_f_v/@selected!='Selected'))">
<xsl:apply-templates select="t1_type_f_v" mode="pn"/>
</xsl:if>
</xsl:template>
<xsl:template match="1_type_f_v" mode="pn">
<xsl:if test="((@old_selected='Selected') and (@selected!='Selected'))">
<p><xsl:value-of select="../nameOfPerson"/></p>
<ul>
<li><xsl:value-of select="someInfo"/></li>
<p><xsl:value-of select="someInfo2"/></p>
</ul>
</xsl:if>
</xsl:template>