2010-01-25 110 views
1

我有两个xslt动态下拉框,需要一个测试语句来测试另一个是否已被使用。xslt从其他节点获取值

<xsl:template match="cat"> 
    <xsl:choose> 
    <xsl:when test = (if dog has already been selected) 
     <select id="selectCAT"> 
      <option value="" onchange="submitCAT()"> 
      <option value="shorthair"> 
     </select> 
    </xsl:when> 
    <xsl:otherwise> 
     <select id="selectCAT"> 
      <option value=""> 
      <option value="longhair"> 
     </select> 
    </xsl:otherwise> 
    </xsl:choose> 
</xsl:template> 

<xsl:template match="dog"> 
    <xsl:choose> 
    <xsl:when test = (if cat has already been selected) 
     <select id="selectDOG"> 
      <option value="" onchange="submitDOG()"> 
      <option value="shorthair"> 
     </select> 
    </xsl:when> 
    <xsl:otherwise> 
     <select id="selectDOG"> 
      <option value=""> 
      <option value="longhair"> 
     </select> 
    </xsl:otherwise> 
    </xsl:choose> 
</xsl:template> 

我几乎有两个下拉,只需要调用一个函数,如果唯一已经被选中。我只是无法弄清楚如何判断是否使用了其他的下拉菜单。

谢谢。

+0

请问您可以发布XML样本吗? – 2010-01-25 09:36:35

回答

0

我不确定我们可以回答,除非你说明你如何存储(在xml中)这些事实。就个人而言,我认为我只是在javascript中测试它 - 即询问selectDOG/selectCAT选择哪些选项并选择性地提交。