Partilhar via


value Attribute

  Microsoft Speech Technologies Homepage

Specifies part or all of a recognition result to be assigned to a Web page element or script variable. Optional.

HTML <bind value = "value">
JScript bind.value = "value"

Remarks

The result of a successful recognition is an Extensible Markup Language (XML) document defined using the Semantic Markup Language (SML). The SML labels specific words or phrases within the recognition result. Those specific words or phrases are assigned to the value attribute of the bind element. The value attribute is then bound to controls on a Web page or to a script variable

The value attribute consists of an XML Path Language (XPath) string that specifies which words or phrases from within the recognition result are used. The targetelement attribute is the destination for the value attribute. If both targetelement and targetattribute are specified, the word or phrase specified by the value attribute is placed into the named attribute/property of the control specified by targetelement. If value is unspecified, the entire recognition result is placed into the designated targetelement attribute.

The value attribute is ignored if targetmethod is specified.

An XPath query can supply qualifiers to return other values from within the specified SML item. For example, the following code represents an element of a recognition result:

  <destination_city text="New York City" confidence="0.9979967">New York</destination_city>

The following bind element returns the default value "New York" from the recognition:

  <bind targetelement="txtDestination" value="//destination_city" />

Changing the value specification as follows instead returns "New York City":

  <bind targetelement="boxToCity" value="//destination_city/@text"/>

A further change of the value attribute to the following specification, returns the confidence figure, "0.9979967".

  <bind targetelement="boxToCity" value="//destination_city/@confidence"/>

Example

The following code demonstrates the use of the value attribute:

<salt:listen id="listen1" mode="multiple" onreco="Handleonreco()" onnoreco="Handleonnoreco()"  onsilence="Handleonsilence()" onerror="Handleonerror()">
  <salt:grammar id="gram1" src="./cities.grxml"/> 
  <salt:bind targetelement="boxFromCity" targetattribute="value" value="//origin_city"/>
  <salt:bind targetelement="boxToCity" targetattribute="value" value="//destination_city"/>
</salt:listen>

See Also

bind Element |  targetattribute Attribute | targetelement Attribute | bind Element Example