2013-01-14 120 views
0

我使用Saxon-CE和XSLT 2.0來生成和操作頁面上的控件。生成組合框不是問題,但當我更改組合框時,似乎無法從組合框的選項條目中獲取值。下面是說明XSLT代碼:Saxon-ce獲取組合框選項值

<xsl:stylesheet version="2.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:ixsl="http://saxonica.com/ns/interactiveXSLT" 
extension-element-prefixes="ixsl"> 

<xsl:template match="/"> 

<xsl:result-document href="#comboBox"> 
    <select id="myBox"> 
    <option value="1">One</option> 
    <option value="2">two</option> 
    </select> 
</xsl:result-document> 

</xsl:template> 

<xsl:template match="select[@id='myBox'] mode=ixsl:onchange"> 
    <xsl:variable name="myVal" select="option/@value'/> 
    .... code that affects what is displayed ... 
</xsl:template> 

</xsl:stylesheet> 

當用戶改變combbox的價值我想要做的是,他們選擇該選項的值存儲在變量$設爲myVal。然後,我使用該變量來影響主頁面上的轉換。現在我所擁有的根本不起作用(目前它獲得所有選項的所有值,而不是用戶選擇的值)。

想法?

回答

1

嘗試

<xsl:variable name="control" select="."/> 
<xsl:variable name="value" select="ixsl:get($control, 'value')"/> 

與命名空間聲明xmlns:ixsl="http://saxonica.com/ns/interactiveXSLT"

+0

活泉!這很好用!謝謝! –