0
votes

I am using Saxon-CE and XSLT 2.0 to generate and manipulate controls on a page. Generating the a combobox is not problem, but I cannot seem to get the value from the combobox's option entries when I change the combo-box. Here is the illustrative XSLT code:

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

What I want to do is when the user changes the value of the combbox, the value of the option they select is stored in the variable $myVal. I then use that variable to affect the transformation on the main page. Right now what I have does not work at all (currently it get all the values of all the options, not the one that the user selects).

Ideas?

1

1 Answers

2
votes

Try

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

with the namespace declaration xmlns:ixsl="http://saxonica.com/ns/interactiveXSLT"