Javascript 排除xml节点
我被困在一些你可能认为很简单的事情中 在xml文件中,我有这些节点Javascript 排除xml节点,javascript,xml,xslt,Javascript,Xml,Xslt,我被困在一些你可能认为很简单的事情中 在xml文件中,我有这些节点 <Types> <Pas type="1" single="Man" plural="Men" /> <Pas type="2" single="Woman" plural="Women" description="this is a test" /> <Pas type="3" single="Child" plural="Children" description="th
<Types>
<Pas type="1" single="Man" plural="Men" />
<Pas type="2" single="Woman" plural="Women" description="this is a test" />
<Pas type="3" single="Child" plural="Children" description="this is another test" />
</Types>
问题是我不想让男人有这种感觉
有没有办法排除它
问候 您可以添加如下xsl:if语句:
<xsl:if test="@description">
(<xsl:value-of select="$Details/@desc" />)*
</xsl:if>
()*
您只需输入以下特定代码:
(<xsl:value-of select="$Details/@description" />)*
()*
变成条件语句,例如
<xsl:if test='current()/@description and string-length(current()/@description) > 0'>
(<xsl:value-of select="$Details/@description" />)*
</xsl:if>
()*
请注意,这也会处理空属性。谢谢,伙计。它是这样工作的()*注意,这个测试表达式相当于更短的
test=“string(@description)”
@LarsH+1不知道:)
<xsl:if test="@description">
(<xsl:value-of select="$Details/@desc" />)*
</xsl:if>
(<xsl:value-of select="$Details/@description" />)*
<xsl:if test='current()/@description and string-length(current()/@description) > 0'>
(<xsl:value-of select="$Details/@description" />)*
</xsl:if>