开发者

xslt grab value from other node

I have two xslt dynamic drop down boxes and need a test statement that will test if the other one has been used.

<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>

I pretty much have the two drop 开发者_运维知识库downs and only need it to call a function if the only one has already been selected. I just cannot figure out how to tell if the other drop down has been used.

Thanks.


I'm not sure we can answer that unless you state how you are storing (in the xml) these facts. Personally, though, I think I'd just test it in javascript - i.e. ask selectDOG / selectCAT what options are selected and selectively submit.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜