特定的值。這是我的XML:檢查是否至少有一個孩子有XSLT 1.0
<LIGHT_INFORMATION_LIST>
<LIGHT_INFORMATION>
<LIGHT_CHARACTERISTICS>Al</LIGHT_CHARACTERISTICS>
<LIGHT_COLOUR>W-G</LIGHT_COLOUR>
</LIGHT_INFORMATION>
<LIGHT_INFORMATION>
<LIGHT_CHARACTERISTICS>Al</LIGHT_CHARACTERISTICS>
<LIGHT_COLOUR>W-R</LIGHT_COLOUR>
</LIGHT_INFORMATION>
<LIGHT_INFORMATION>
<LIGHT_CHARACTERISTICS>F</LIGHT_CHARACTERISTICS>
<LIGHT_COLOUR>R</LIGHT_COLOUR>
</LIGHT_INFORMATION>
<LIGHT_INFORMATION>
<LIGHT_CHARACTERISTICS>F</LIGHT_CHARACTERISTICS>
<LIGHT_COLOUR>G</LIGHT_COLOUR>
</LIGHT_INFORMATION>
<LIGHT_INFORMATION>
<LIGHT_CHARACTERISTICS>F</LIGHT_CHARACTERISTICS>
<LIGHT_COLOUR>W</LIGHT_COLOUR>
</LIGHT_INFORMATION>
</LIGHT_INFORMATION_LIST>
我竟被插入控件:
如果LIGHT_COLOUR的至少一個元素插入此LIGHT_INFORMATION_LIST包含「 - 」
我試過白衣這一點,但完全是錯誤的:
<xsl:choose>
<xsl:when test="not(contains(.,'-'))">
<!-- do A -->
</xsl:when>
<xsl:otherwise>
<!-- do B -->
</xsl:otherwise>
</xsl:choose>
這是ACTU加盟我的XSLT代碼:
<xsl:for-each select="LIGHT_INFORMATION">
<xsl:for-each select="LIGHT_COLOUR">
<xsl:choose>
<xsl:when test="not(contains(.,'-'))"> <!-- This is the test Required -->
<xsl:choose>
<xsl:when test="following-sibling::LIGHT_RANGE >= 15">
<span style="font-family:Univers Condensed; font-weight:bold;">
<xsl:if test="not(preceding::LIGHT_COLOUR[1][preceding::IMMUTABLE_ID = $EF])">
<xsl:value-of select="."/>
</xsl:if>
<xsl:if test=". != preceding::LIGHT_COLOUR[1][preceding::IMMUTABLE_ID = $EF]">
<xsl:value-of select="."/>
</xsl:if>
</span>
</xsl:when>
<xsl:otherwise>
<xsl:if test="not(preceding::LIGHT_COLOUR[1][preceding::IMMUTABLE_ID = $EF])">
<xsl:value-of select="."/>
</xsl:if>
<xsl:if test=". != preceding::LIGHT_COLOUR[1][preceding::IMMUTABLE_ID = $EF]">
<xsl:value-of select="."/>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
ciao <!-- I would insert this control here if LIGHT_COLOUR contain '-' -->
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
現在輸出的是:
的Ciao Ciao的RGW
我想,如果只有一個在LIGHT_INFORMATION_LIST的這個節點元素包含到LIGHT_COLOUR ' - ' 寫 '僑'
我建議你澄清你的[上一個問題](http://stackoverflow.com/questions/26238335/xml-element-distinct-using-xslt-1-0),而不是開始另一個。 – 2014-10-08 10:04:58